diff --git a/.github/workflows/docker-image-dev.yml b/.github/workflows/docker-image-dev.yml index dc43f1ae..63fdafee 100644 --- a/.github/workflows/docker-image-dev.yml +++ b/.github/workflows/docker-image-dev.yml @@ -2,8 +2,7 @@ name: Docker Build and Push (Dev) on: schedule: - - cron: '0 0 * * *' - # push: + - cron: '0 0 * * *' # every day at midnight UTC # branches: # - dev workflow_dispatch: # 允许手动触发工作流 @@ -28,11 +27,11 @@ jobs: fetch-depth: 0 # Clone required dependencies - - name: Clone maim_message - run: git clone https://github.com/MaiM-with-u/maim_message maim_message + # - name: Clone maim_message + # run: git clone https://github.com/MaiM-with-u/maim_message maim_message - name: Clone lpmm - run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM + run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -82,11 +81,11 @@ jobs: fetch-depth: 0 # Clone required dependencies - - name: Clone maim_message - run: git clone https://github.com/MaiM-with-u/maim_message maim_message + # - name: Clone maim_message + # run: git clone https://github.com/MaiM-with-u/maim_message maim_message - name: Clone lpmm - run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM + run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -147,8 +146,8 @@ jobs: with: images: ${{ secrets.DOCKERHUB_USERNAME }}/maibot tags: | - type=ref,event=branch - type=sha,prefix=${{ github.ref_name }}-,enable=${{ github.ref_type == 'branch' }} + type=raw,value=dev + type=schedule,pattern=dev-{{date 'YYMMDD'}} - name: Create and Push Manifest run: | diff --git a/.github/workflows/docker-image-main.yml b/.github/workflows/docker-image-main.yml index 25dc67ea..3d9b14ab 100644 --- a/.github/workflows/docker-image-main.yml +++ b/.github/workflows/docker-image-main.yml @@ -31,11 +31,11 @@ jobs: fetch-depth: 0 # Clone required dependencies - - name: Clone maim_message - run: git clone https://github.com/MaiM-with-u/maim_message maim_message + # - name: Clone maim_message + # run: git clone https://github.com/MaiM-with-u/maim_message maim_message - name: Clone lpmm - run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM + run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -84,11 +84,11 @@ jobs: fetch-depth: 0 # Clone required dependencies - - name: Clone maim_message - run: git clone https://github.com/MaiM-with-u/maim_message maim_message + # - name: Clone maim_message + # run: git clone https://github.com/MaiM-with-u/maim_message maim_message - name: Clone lpmm - run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM + run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/src/chat/emoji_system/emoji_manager.py b/src/chat/emoji_system/emoji_manager.py index cfa86320..f7d132a3 100644 --- a/src/chat/emoji_system/emoji_manager.py +++ b/src/chat/emoji_system/emoji_manager.py @@ -271,7 +271,7 @@ def _to_emoji_objects(data: Any) -> Tuple[List["MaiEmoji"], int]: emoji.description = emoji_data.description # Deserialize emotion string from DB to list - emoji.emotion = emoji_data.emotion.split(",") if emoji_data.emotion else [] + emoji.emotion = emoji_data.emotion.replace(",",",").split(",") if emoji_data.emotion else [] emoji.usage_count = emoji_data.usage_count db_last_used_time = emoji_data.last_used_time @@ -732,7 +732,7 @@ class EmojiManager: emoji_record = Emoji.get_or_none(Emoji.emoji_hash == emoji_hash) if emoji_record and emoji_record.emotion: logger.info(f"[缓存命中] 从数据库获取表情包情感标签: {emoji_record.emotion[:50]}...") - return emoji_record.emotion.split(",") + return emoji_record.emotion.replace(",",",").split(",") except Exception as e: logger.error(f"从数据库查询表情包情感标签时出错: {e}") @@ -993,7 +993,7 @@ class EmojiManager: ) # 处理情感列表 - emotions = [e.strip() for e in emotions_text.split(",") if e.strip()] + emotions = [e.strip() for e in emotions_text.replace(",",",").split(",") if e.strip()] # 根据情感标签数量随机选择 - 超过5个选3个,超过2个选2个 if len(emotions) > 5: diff --git a/src/chat/message_receive/uni_message_sender.py b/src/chat/message_receive/uni_message_sender.py index 93f5a0fa..3e33511f 100644 --- a/src/chat/message_receive/uni_message_sender.py +++ b/src/chat/message_receive/uni_message_sender.py @@ -40,6 +40,90 @@ def is_webui_virtual_group(group_id: str) -> bool: return group_id and group_id.startswith(VIRTUAL_GROUP_ID_PREFIX) +def parse_message_segments(segment) -> list: + """解析消息段,转换为 WebUI 可用的格式 + + 参考 NapCat 适配器的消息解析逻辑 + + Args: + segment: Seg 消息段对象 + + Returns: + list: 消息段列表,每个元素为 {"type": "...", "data": ...} + """ + from maim_message import Seg + + result = [] + + if segment is None: + return result + + if segment.type == "seglist": + # 处理消息段列表 + if segment.data: + for seg in segment.data: + result.extend(parse_message_segments(seg)) + elif segment.type == "text": + # 文本消息 + if segment.data: + result.append({"type": "text", "data": segment.data}) + elif segment.type == "image": + # 图片消息(base64) + if segment.data: + result.append({"type": "image", "data": f"data:image/png;base64,{segment.data}"}) + elif segment.type == "emoji": + # 表情包消息(base64) + if segment.data: + result.append({"type": "emoji", "data": f"data:image/gif;base64,{segment.data}"}) + elif segment.type == "imageurl": + # 图片链接消息 + if segment.data: + result.append({"type": "image", "data": segment.data}) + elif segment.type == "face": + # 原生表情 + result.append({"type": "face", "data": segment.data}) + elif segment.type == "voice": + # 语音消息(base64) + if segment.data: + result.append({"type": "voice", "data": f"data:audio/wav;base64,{segment.data}"}) + elif segment.type == "voiceurl": + # 语音链接 + if segment.data: + result.append({"type": "voice", "data": segment.data}) + elif segment.type == "video": + # 视频消息(base64) + if segment.data: + result.append({"type": "video", "data": f"data:video/mp4;base64,{segment.data}"}) + elif segment.type == "videourl": + # 视频链接 + if segment.data: + result.append({"type": "video", "data": segment.data}) + elif segment.type == "music": + # 音乐消息 + result.append({"type": "music", "data": segment.data}) + elif segment.type == "file": + # 文件消息 + result.append({"type": "file", "data": segment.data}) + elif segment.type == "reply": + # 回复消息 + result.append({"type": "reply", "data": segment.data}) + elif segment.type == "forward": + # 转发消息 + forward_items = [] + if segment.data: + for item in segment.data: + forward_items.append({ + "content": parse_message_segments(item.get("message_segment", {})) if isinstance(item, dict) else [] + }) + result.append({"type": "forward", "data": forward_items}) + else: + # 未知类型,尝试作为文本处理 + if segment.data: + result.append({"type": "unknown", "original_type": segment.type, "data": str(segment.data)}) + + return result + + async def _send_message(message: MessageSending, show_log=True) -> bool: """合并后的消息发送函数,包含WS发送和日志记录""" message_preview = truncate_message(message.processed_plain_text, max_length=200) @@ -56,11 +140,25 @@ async def _send_message(message: MessageSending, show_log=True) -> bool: import time from src.config.config import global_config + # 解析消息段,获取富文本内容 + message_segments = parse_message_segments(message.message_segment) + + # 判断消息类型 + # 如果只有一个文本段,使用简单的 text 类型 + # 否则使用 rich 类型,包含完整的消息段 + if len(message_segments) == 1 and message_segments[0].get("type") == "text": + message_type = "text" + segments = None + else: + message_type = "rich" + segments = message_segments + await chat_manager.broadcast( { "type": "bot_message", "content": message.processed_plain_text, - "message_type": "text", + "message_type": message_type, + "segments": segments, # 富文本消息段 "timestamp": time.time(), "group_id": group_id, # 包含群 ID 以便前端区分不同的聊天标签 "sender": { diff --git a/src/llm_models/model_client/gemini_client.py b/src/llm_models/model_client/gemini_client.py index b3fafca0..b52474e4 100644 --- a/src/llm_models/model_client/gemini_client.py +++ b/src/llm_models/model_client/gemini_client.py @@ -143,10 +143,14 @@ def _convert_tool_options(tool_options: list[ToolOption]) -> list[FunctionDeclar :param tool_option_param: 工具参数对象 :return: 转换后的工具参数字典 """ - # JSON Schema要求使用"boolean"而不是"bool" + # JSON Schema 类型名称修正: + # - 布尔类型使用 "boolean" 而不是 "bool" + # - 浮点数使用 "number" 而不是 "float" param_type_value = tool_option_param.param_type.value if param_type_value == "bool": param_type_value = "boolean" + elif param_type_value == "float": + param_type_value = "number" return_dict: dict[str, Any] = { "type": param_type_value, diff --git a/src/llm_models/model_client/openai_client.py b/src/llm_models/model_client/openai_client.py index f573d33e..5793d4f9 100644 --- a/src/llm_models/model_client/openai_client.py +++ b/src/llm_models/model_client/openai_client.py @@ -118,10 +118,14 @@ def _convert_tool_options(tool_options: list[ToolOption]) -> list[dict[str, Any] :param tool_option_param: 工具参数对象 :return: 转换后的工具参数字典 """ - # JSON Schema要求使用"boolean"而不是"bool" + # JSON Schema 类型名称修正: + # - 布尔类型使用 "boolean" 而不是 "bool" + # - 浮点数使用 "number" 而不是 "float" param_type_value = tool_option_param.param_type.value if param_type_value == "bool": param_type_value = "boolean" + elif param_type_value == "float": + param_type_value = "number" return_dict: dict[str, Any] = { "type": param_type_value, diff --git a/webui/dist/assets/charts-DbiuC1q1.js b/webui/dist/assets/charts-DbiuC1q1.js new file mode 100644 index 00000000..1548c853 --- /dev/null +++ b/webui/dist/assets/charts-DbiuC1q1.js @@ -0,0 +1,36 @@ +import{r as h,w as cb,b as Nl,a as sb,i as fb}from"./router-Bz250laD.js";import{c as H}from"./utils-BXc2jIuz.js";import{g as Qt,a as db}from"./react-vendor-BmxF9s7Q.js";var vb=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function $l(e){if(typeof e!="string")return!1;var t=vb;return t.includes(e)}var hb=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],pb=new Set(hb);function cp(e){return typeof e!="string"?!1:pb.has(e)}function sp(e){return typeof e=="string"&&e.startsWith("data-")}function Ze(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(cp(r)||sp(r))&&(t[r]=e[r]);return t}function hr(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return Ze(t)}return typeof e=="object"&&!Array.isArray(e)?Ze(e):null}function $e(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(cp(r)||sp(r)||$l(r))&&(t[r]=e[r]);return t}function mb(e){return e==null?null:h.isValidElement(e)?$e(e.props):typeof e=="object"&&!Array.isArray(e)?$e(e):null}var yb=["children","width","height","viewBox","className","style","title","desc"];function Tu(){return Tu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,width:n,height:i,viewBox:a,className:o,style:u,title:l,desc:s}=e,c=gb(e,yb),f=a||{width:n,height:i,x:0,y:0},d=H("recharts-surface",o);return h.createElement("svg",Tu({},$e(c),{className:d,width:n,height:i,style:u,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,l),h.createElement("desc",null,s),r)}),wb=["children","className"];function Du(){return Du=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,className:n}=e,i=xb(e,wb),a=H("recharts-layer",n);return h.createElement("g",Du({className:a},$e(i),{ref:t}),r)}),fp=h.createContext(null),Ob=()=>h.useContext(fp);function J(e){return function(){return e}}const dp=Math.cos,wi=Math.sin,ht=Math.sqrt,xi=Math.PI,fa=2*xi,Nu=Math.PI,$u=2*Nu,ar=1e-6,Ab=$u-ar;function vp(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return vp;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iar)if(!(Math.abs(f*l-s*c)>ar)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let v=n-o,p=i-u,y=l*l+s*s,m=v*v+p*p,g=Math.sqrt(y),x=Math.sqrt(d),w=a*Math.tan((Nu-Math.acos((y+d-m)/(2*g*x)))/2),P=w/x,b=w/g;Math.abs(P-1)>ar&&this._append`L${t+P*c},${r+P*f}`,this._append`A${a},${a},0,0,${+(f*v>c*p)},${this._x1=t+b*l},${this._y1=r+b*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),l=n*Math.sin(i),s=t+u,c=r+l,f=1^o,d=o?i-a:a-i;this._x1===null?this._append`M${s},${c}`:(Math.abs(this._x1-s)>ar||Math.abs(this._y1-c)>ar)&&this._append`L${s},${c}`,n&&(d<0&&(d=d%$u+$u),d>Ab?this._append`A${n},${n},0,1,${f},${t-u},${r-l}A${n},${n},0,1,${f},${this._x1=s},${this._y1=c}`:d>ar&&this._append`A${n},${n},0,${+(d>=Nu)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Ll(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Eb(t)}function zl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function hp(e){this._context=e}hp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function da(e){return new hp(e)}function pp(e){return e[0]}function mp(e){return e[1]}function yp(e,t){var r=J(!0),n=null,i=da,a=null,o=Ll(u);e=typeof e=="function"?e:e===void 0?pp:J(e),t=typeof t=="function"?t:t===void 0?mp:J(t);function u(l){var s,c=(l=zl(l)).length,f,d=!1,v;for(n==null&&(a=i(v=o())),s=0;s<=c;++s)!(s=v;--p)u.point(w[p],P[p]);u.lineEnd(),u.areaEnd()}g&&(w[d]=+e(m,d,f),P[d]=+t(m,d,f),u.point(n?+n(m,d,f):w[d],r?+r(m,d,f):P[d]))}if(x)return u=null,x+""||null}function c(){return yp().defined(i).curve(o).context(a)}return s.x=function(f){return arguments.length?(e=typeof f=="function"?f:J(+f),n=null,s):e},s.x0=function(f){return arguments.length?(e=typeof f=="function"?f:J(+f),s):e},s.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:J(+f),s):n},s.y=function(f){return arguments.length?(t=typeof f=="function"?f:J(+f),r=null,s):t},s.y0=function(f){return arguments.length?(t=typeof f=="function"?f:J(+f),s):t},s.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:J(+f),s):r},s.lineX0=s.lineY0=function(){return c().x(e).y(t)},s.lineY1=function(){return c().x(e).y(r)},s.lineX1=function(){return c().x(n).y(t)},s.defined=function(f){return arguments.length?(i=typeof f=="function"?f:J(!!f),s):i},s.curve=function(f){return arguments.length?(o=f,a!=null&&(u=o(a)),s):o},s.context=function(f){return arguments.length?(f==null?a=u=null:u=o(a=f),s):a},s}class gp{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function _b(e){return new gp(e,!0)}function kb(e){return new gp(e,!1)}const Bl={draw(e,t){const r=ht(t/xi);e.moveTo(r,0),e.arc(0,0,r,0,fa)}},jb={draw(e,t){const r=ht(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},bp=ht(1/3),Cb=bp*2,Ib={draw(e,t){const r=ht(t/Cb),n=r*bp;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},Mb={draw(e,t){const r=ht(t),n=-r/2;e.rect(n,n,r,r)}},Tb=.8908130915292852,wp=wi(xi/10)/wi(7*xi/10),Db=wi(fa/10)*wp,Nb=-dp(fa/10)*wp,$b={draw(e,t){const r=ht(t*Tb),n=Db*r,i=Nb*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=fa*a/5,u=dp(o),l=wi(o);e.lineTo(l*r,-u*r),e.lineTo(u*n-l*i,l*n+u*i)}e.closePath()}},ro=ht(3),Rb={draw(e,t){const r=-ht(t/(ro*3));e.moveTo(0,r*2),e.lineTo(-ro*r,-r),e.lineTo(ro*r,-r),e.closePath()}},et=-.5,tt=ht(3)/2,Ru=1/ht(12),Lb=(Ru/2+1)*3,zb={draw(e,t){const r=ht(t/Lb),n=r/2,i=r*Ru,a=n,o=r*Ru+r,u=-a,l=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,l),e.lineTo(et*n-tt*i,tt*n+et*i),e.lineTo(et*a-tt*o,tt*a+et*o),e.lineTo(et*u-tt*l,tt*u+et*l),e.lineTo(et*n+tt*i,et*i-tt*n),e.lineTo(et*a+tt*o,et*o-tt*a),e.lineTo(et*u+tt*l,et*l-tt*u),e.closePath()}};function Bb(e,t){let r=null,n=Ll(i);e=typeof e=="function"?e:J(e||Bl),t=typeof t=="function"?t:J(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:J(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:J(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function Pi(){}function Oi(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function xp(e){this._context=e}xp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Oi(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Fb(e){return new xp(e)}function Pp(e){this._context=e}Pp.prototype={areaStart:Pi,areaEnd:Pi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Kb(e){return new Pp(e)}function Op(e){this._context=e}Op.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function qb(e){return new Op(e)}function Ap(e){this._context=e}Ap.prototype={areaStart:Pi,areaEnd:Pi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Wb(e){return new Ap(e)}function Fs(e){return e<0?-1:1}function Ks(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(Fs(a)+Fs(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function qs(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function no(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Ai(e){this._context=e}Ai.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:no(this,this._t0,qs(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,no(this,qs(this,r=Ks(this,e,t)),r);break;default:no(this,this._t0,r=Ks(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Sp(e){this._context=new Ep(e)}(Sp.prototype=Object.create(Ai.prototype)).point=function(e,t){Ai.prototype.point.call(this,t,e)};function Ep(e){this._context=e}Ep.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function Ub(e){return new Ai(e)}function Hb(e){return new Sp(e)}function _p(e){this._context=e}_p.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Ws(e),i=Ws(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Gb(e){return new va(e,.5)}function Vb(e){return new va(e,0)}function Xb(e){return new va(e,1)}function Ir(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function Zb(e,t){return e[t]}function Qb(e){const t=[];return t.key=e,t}function Jb(){var e=J([]),t=Lu,r=Ir,n=Zb;function i(a){var o=Array.from(e.apply(this,arguments),Qb),u,l=o.length,s=-1,c;for(const f of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;ne===0?0:e>0?1:-1,dt=e=>typeof e=="number"&&e!=+e,Ct=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,N=e=>(typeof e=="number"||e instanceof Number)&&!dt(e),bt=e=>N(e)||typeof e=="string",uw=0,cn=e=>{var t=++uw;return"".concat(e||"").concat(t)},Ie=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!N(t)&&typeof t!="string")return n;var a;if(Ct(t)){if(r==null)return n;var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return dt(a)&&(a=n),i&&r!=null&&a>r&&(a=r),a},jp=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;nn&&(typeof t=="function"?t(n):pr(n,t))===r)}var ae=e=>e===null||typeof e>"u",An=e=>ae(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function lw(e){return e!=null}function Sn(){}var cw=["type","size","sizeType"];function zu(){return zu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(An(e));return Ip[t]||Bl},yw=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*pw;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},gw=(e,t)=>{Ip["symbol".concat(An(e))]=t},Wl=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=vw(e,cw),a=Js(Js({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var u=()=>{var d=mw(o),v=Bb().type(d).size(yw(r,n,o)),p=v();if(p!==null)return p},{className:l,cx:s,cy:c}=a,f=$e(a);return N(s)&&N(c)&&N(r)?h.createElement("path",zu({},f,{className:H("recharts-symbols",l),transform:"translate(".concat(s,", ").concat(c,")"),d:u()})):null};Wl.registerSymbol=gw;var Mp=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Ul=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{$l(i)&&(n[i]=(a=>r[i](r,a)))}),n},bw=(e,t,r)=>n=>(e(t,r,n),null),En=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var a=e[i];$l(i)&&typeof a=="function"&&(n||(n={}),n[i]=bw(a,t,r))}),n};function ef(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ww(e){for(var t=1;t(o[u]===void 0&&n[u]!==void 0&&(o[u]=n[u]),o),r);return a}function Si(){return Si=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var d=c.formatter||i,v=H({"recharts-legend-item":!0,["legend-item-".concat(f)]:!0,inactive:c.inactive});if(c.type==="none")return null;var p=c.inactive?a:c.color,y=d?d(c.value,c,f):c.value;return h.createElement("li",Si({className:v,style:l,key:"legend-item-".concat(f)},En(e,c,f)),h.createElement(Rl,{width:r,height:r,viewBox:u,style:s,"aria-label":"".concat(y," legend icon")},h.createElement(jw,{data:c,iconType:o,inactiveColor:a})),h.createElement("span",{className:"recharts-legend-item-text",style:{color:p}},y))})}var Iw=e=>{var t=pe(e,kw),{payload:r,layout:n,align:i}=t;if(!r||!r.length)return null;var a={padding:0,margin:0,textAlign:n==="horizontal"?i:"left"};return h.createElement("ul",{className:"recharts-default-legend",style:a},h.createElement(Cw,Si({},t,{payload:r})))},fo={},vo={},rf;function Mw(){return rf||(rf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){const i=new Map;for(let a=0;a=0}e.isLength=t})(yo)),yo}var of;function Hl(){return of||(of=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Tw();function r(n){return n!=null&&typeof n!="function"&&t.isLength(n.length)}e.isArrayLike=r})(mo)),mo}var go={},uf;function Dw(){return uf||(uf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="object"&&r!==null}e.isObjectLike=t})(go)),go}var lf;function Nw(){return lf||(lf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Hl(),r=Dw();function n(i){return r.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=n})(po)),po}var bo={},wo={},cf;function $w(){return cf||(cf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ql();function r(n){return function(i){return t.get(i,n)}}e.property=r})(wo)),wo}var xo={},Po={},Oo={},Ao={},sf;function Dp(){return sf||(sf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r!==null&&(typeof r=="object"||typeof r=="function")}e.isObject=t})(Ao)),Ao}var So={},ff;function Np(){return ff||(ff=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null||typeof r!="object"&&typeof r!="function"}e.isPrimitive=t})(So)),So}var Eo={},df;function $p(){return df||(df=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return r===n||Number.isNaN(r)&&Number.isNaN(n)}e.eq=t})(Eo)),Eo}var vf;function Rw(){return vf||(vf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Dp(),r=Np(),n=$p();function i(c,f,d){return typeof d!="function"?i(c,f,()=>{}):a(c,f,function v(p,y,m,g,x,w){const P=d(p,y,m,g,x,w);return P!==void 0?!!P:a(p,y,v,w)},new Map)}function a(c,f,d,v){if(f===c)return!0;switch(typeof f){case"object":return o(c,f,d,v);case"function":return Object.keys(f).length>0?a(c,{...f},d,v):n.eq(c,f);default:return t.isObject(c)?typeof f=="string"?f==="":!0:n.eq(c,f)}}function o(c,f,d,v){if(f==null)return!0;if(Array.isArray(f))return l(c,f,d,v);if(f instanceof Map)return u(c,f,d,v);if(f instanceof Set)return s(c,f,d,v);const p=Object.keys(f);if(c==null)return p.length===0;if(p.length===0)return!0;if(v?.has(f))return v.get(f)===c;v?.set(f,c);try{for(let y=0;y{})}e.isMatch=r})(Po)),Po}var _o={},ko={},jo={},pf;function Lw(){return pf||(pf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Object.getOwnPropertySymbols(r).filter(n=>Object.prototype.propertyIsEnumerable.call(r,n))}e.getSymbols=t})(jo)),jo}var Co={},mf;function Lp(){return mf||(mf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}e.getTag=t})(Co)),Co}var Io={},yf;function zp(){return yf||(yf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",r="[object String]",n="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",u="[object Date]",l="[object Map]",s="[object Set]",c="[object Array]",f="[object Function]",d="[object ArrayBuffer]",v="[object Object]",p="[object Error]",y="[object DataView]",m="[object Uint8Array]",g="[object Uint8ClampedArray]",x="[object Uint16Array]",w="[object Uint32Array]",P="[object BigUint64Array]",b="[object Int8Array]",O="[object Int16Array]",S="[object Int32Array]",_="[object BigInt64Array]",I="[object Float32Array]",M="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=d,e.arrayTag=c,e.bigInt64ArrayTag=_,e.bigUint64ArrayTag=P,e.booleanTag=i,e.dataViewTag=y,e.dateTag=u,e.errorTag=p,e.float32ArrayTag=I,e.float64ArrayTag=M,e.functionTag=f,e.int16ArrayTag=O,e.int32ArrayTag=S,e.int8ArrayTag=b,e.mapTag=l,e.numberTag=n,e.objectTag=v,e.regexpTag=t,e.setTag=s,e.stringTag=r,e.symbolTag=o,e.uint16ArrayTag=x,e.uint32ArrayTag=w,e.uint8ArrayTag=m,e.uint8ClampedArrayTag=g})(Io)),Io}var Mo={},gf;function zw(){return gf||(gf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}e.isTypedArray=t})(Mo)),Mo}var bf;function Bp(){return bf||(bf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Lw(),r=Lp(),n=zp(),i=Np(),a=zw();function o(c,f){return u(c,void 0,c,new Map,f)}function u(c,f,d,v=new Map,p=void 0){const y=p?.(c,f,d,v);if(y!==void 0)return y;if(i.isPrimitive(c))return c;if(v.has(c))return v.get(c);if(Array.isArray(c)){const m=new Array(c.length);v.set(c,m);for(let g=0;gt.isMatch(a,i)}e.matches=n})(xo)),xo}var To={},Do={},No={},Pf;function Kw(){return Pf||(Pf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Bp(),r=zp();function n(i,a){return t.cloneDeepWith(i,(o,u,l,s)=>{const c=a?.(o,u,l,s);if(c!==void 0)return c;if(typeof i=="object")switch(Object.prototype.toString.call(i)){case r.numberTag:case r.stringTag:case r.booleanTag:{const f=new i.constructor(i?.valueOf());return t.copyProperties(f,i),f}case r.argumentsTag:{const f={};return t.copyProperties(f,i),f.length=i.length,f[Symbol.iterator]=i[Symbol.iterator],f}default:return}})}e.cloneDeepWith=n})(No)),No}var Of;function qw(){return Of||(Of=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kw();function r(n){return t.cloneDeepWith(n)}e.cloneDeep=r})(Do)),Do}var $o={},Ro={},Af;function Fp(){return Af||(Af=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function r(n,i=Number.MAX_SAFE_INTEGER){switch(typeof n){case"number":return Number.isInteger(n)&&n>=0&&ne,ee=()=>{var e=h.useContext(Yl);return e?e.store.dispatch:Zw},pi=()=>{},Qw=()=>pi,Jw=(e,t)=>e===t;function T(e){var t=h.useContext(Yl);return cb.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Qw,t?t.store.getState:pi,t?t.store.getState:pi,t?e:pi,Jw)}function ex(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function tx(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function rx(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Mf=e=>Array.isArray(e)?e:[e];function nx(e){const t=Array.isArray(e[0])?e[0]:e;return rx(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ix(e,t){const r=[],{length:n}=e;for(let i=0;i{r=Qn(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function lx(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let a=0,o=0,u,l={},s=i.pop();typeof s=="object"&&(l=s,s=i.pop()),ex(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const c={...r,...l},{memoize:f,memoizeOptions:d=[],argsMemoize:v=qp,argsMemoizeOptions:p=[]}=c,y=Mf(d),m=Mf(p),g=nx(i),x=f(function(){return a++,s.apply(null,arguments)},...y),w=v(function(){o++;const b=ix(g,arguments);return u=x.apply(null,b),u},...m);return Object.assign(w,{resultFunc:s,memoizedResultFunc:x,dependencies:g,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>u,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:v})};return Object.assign(n,{withTypes:()=>n}),n}var A=lx(qp),cx=Object.assign((e,t=A)=>{tx(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((o,u,l)=>(o[r[l]]=u,o),{}))},{withTypes:()=>cx}),Bo={},Fo={},Ko={},Df;function sx(){return Df||(Df=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"?1:n===null?2:n===void 0?3:n!==n?4:0}const r=(n,i,a)=>{if(n!==i){const o=t(n),u=t(i);if(o===u&&o===0){if(ni)return a==="desc"?-1:1}return a==="desc"?u-o:o-u}return 0};e.compareValues=r})(Ko)),Ko}var qo={},Wo={},Nf;function Wp(){return Nf||(Nf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"||r instanceof Symbol}e.isSymbol=t})(Wo)),Wo}var $f;function fx(){return $f||($f=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Wp(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(n.test(a)||!r.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(qo)),qo}var Rf;function dx(){return Rf||(Rf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=sx(),r=fx(),n=Kl();function i(a,o,u,l){if(a==null)return[];u=l?void 0:u,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(u)||(u=u==null?[]:[u]),u=u.map(v=>String(v));const s=(v,p)=>{let y=v;for(let m=0;mp==null||v==null?p:typeof v=="object"&&"key"in v?Object.hasOwn(p,v.key)?p[v.key]:s(p,v.path):typeof v=="function"?v(p):Array.isArray(v)?s(p,v):typeof p=="object"?p[v]:p,f=o.map(v=>(Array.isArray(v)&&v.length===1&&(v=v[0]),v==null||typeof v=="function"||Array.isArray(v)||r.isKey(v)?v:{key:v,path:n.toPath(v)}));return a.map(v=>({original:v,criteria:f.map(p=>c(p,v))})).slice().sort((v,p)=>{for(let y=0;yv.original)}e.orderBy=i})(Fo)),Fo}var Uo={},Lf;function vx(){return Lf||(Lf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n=1){const i=[],a=Math.floor(n),o=(u,l)=>{for(let s=0;s1&&n.isIterateeCall(a,o[0],o[1])?o=[]:u>2&&n.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,r.flatten(o),["asc"])}e.sortBy=i})(Bo)),Bo}var Yo,Ff;function px(){return Ff||(Ff=1,Yo=hx().sortBy),Yo}var mx=px();const ha=Qt(mx);var Hp=e=>e.legend.settings,yx=e=>e.legend.size,gx=e=>e.legend.payload,bx=A([gx,Hp],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?ha(n,r):n});function wx(){return T(bx)}var Jn=1;function Yp(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=h.useState({height:0,left:0,top:0,width:0}),n=h.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>Jn||Math.abs(o.left-t.left)>Jn||Math.abs(o.top-t.top)>Jn||Math.abs(o.width-t.width)>Jn)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function _e(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var xx=typeof Symbol=="function"&&Symbol.observable||"@@observable",Kf=xx,Go=()=>Math.random().toString(36).substring(7).split("").join("."),Px={INIT:`@@redux/INIT${Go()}`,REPLACE:`@@redux/REPLACE${Go()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Go()}`},Ei=Px;function Gl(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Gp(e,t,r){if(typeof e!="function")throw new Error(_e(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(_e(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(_e(1));return r(Gp)(e,t)}let n=e,i=t,a=new Map,o=a,u=0,l=!1;function s(){o===a&&(o=new Map,a.forEach((m,g)=>{o.set(g,m)}))}function c(){if(l)throw new Error(_e(3));return i}function f(m){if(typeof m!="function")throw new Error(_e(4));if(l)throw new Error(_e(5));let g=!0;s();const x=u++;return o.set(x,m),function(){if(g){if(l)throw new Error(_e(6));g=!1,s(),o.delete(x),a=null}}}function d(m){if(!Gl(m))throw new Error(_e(7));if(typeof m.type>"u")throw new Error(_e(8));if(typeof m.type!="string")throw new Error(_e(17));if(l)throw new Error(_e(9));try{l=!0,i=n(i,m)}finally{l=!1}return(a=o).forEach(x=>{x()}),m}function v(m){if(typeof m!="function")throw new Error(_e(10));n=m,d({type:Ei.REPLACE})}function p(){const m=f;return{subscribe(g){if(typeof g!="object"||g===null)throw new Error(_e(11));function x(){const P=g;P.next&&P.next(c())}return x(),{unsubscribe:m(x)}},[Kf](){return this}}}return d({type:Ei.INIT}),{dispatch:d,subscribe:f,getState:c,replaceReducer:v,[Kf]:p}}function Ox(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Ei.INIT})>"u")throw new Error(_e(12));if(typeof r(void 0,{type:Ei.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(_e(13))})}function Vp(e){const t=Object.keys(e),r={};for(let a=0;a"u")throw u&&u.type,new Error(_e(14));s[f]=p,l=l||p!==v}return l=l||n.length!==Object.keys(o).length,l?s:o}}function _i(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Ax(...e){return t=>(r,n)=>{const i=t(r,n);let a=()=>{throw new Error(_e(15))};const o={getState:i.getState,dispatch:(l,...s)=>a(l,...s)},u=e.map(l=>l(o));return a=_i(...u)(i.dispatch),{...i,dispatch:a}}}function Xp(e){return Gl(e)&&"type"in e&&typeof e.type=="string"}var Zp=Symbol.for("immer-nothing"),qf=Symbol.for("immer-draftable"),Re=Symbol.for("immer-state");function lt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ve=Object,Mr=Ve.getPrototypeOf,ki="constructor",pa="prototype",Bu="configurable",ji="enumerable",mi="writable",sn="value",It=e=>!!e&&!!e[Re];function vt(e){return e?Qp(e)||ma(e)||!!e[qf]||!!e[ki]?.[qf]||ya(e)||ga(e):!1}var Sx=Ve[pa][ki].toString(),Wf=new WeakMap;function Qp(e){if(!e||!Vl(e))return!1;const t=Mr(e);if(t===null||t===Ve[pa])return!0;const r=Ve.hasOwnProperty.call(t,ki)&&t[ki];if(r===Object)return!0;if(!Er(r))return!1;let n=Wf.get(r);return n===void 0&&(n=Function.toString.call(r),Wf.set(r,n)),n===Sx}function _n(e,t,r=!0){kn(e)===0?(r?Reflect.ownKeys(e):Ve.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function kn(e){const t=e[Re];return t?t.type_:ma(e)?1:ya(e)?2:ga(e)?3:0}var Uf=(e,t,r=kn(e))=>r===2?e.has(t):Ve[pa].hasOwnProperty.call(e,t),Fu=(e,t,r=kn(e))=>r===2?e.get(t):e[t],Ci=(e,t,r,n=kn(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Ex(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ma=Array.isArray,ya=e=>e instanceof Map,ga=e=>e instanceof Set,Vl=e=>typeof e=="object",Er=e=>typeof e=="function",Vo=e=>typeof e=="boolean",Ot=e=>e.copy_||e.base_,Xl=e=>e.modified_?e.copy_:e.base_;function Ku(e,t){if(ya(e))return new Map(e);if(ga(e))return new Set(e);if(ma(e))return Array[pa].slice.call(e);const r=Qp(e);if(t===!0||t==="class_only"&&!r){const n=Ve.getOwnPropertyDescriptors(e);delete n[Re];let i=Reflect.ownKeys(n);for(let a=0;a1&&Ve.defineProperties(e,{set:ei,add:ei,clear:ei,delete:ei}),Ve.freeze(e),t&&_n(e,(r,n)=>{Zl(n,!0)},!1)),e}function _x(){lt(2)}var ei={[sn]:_x};function ba(e){return e===null||!Vl(e)?!0:Ve.isFrozen(e)}var Ii="MapSet",qu="Patches",Jp={};function Tr(e){const t=Jp[e];return t||lt(0,e),t}var kx=e=>!!Jp[e],fn,em=()=>fn,jx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:kx(Ii)?Tr(Ii):void 0});function Hf(e,t){t&&(e.patchPlugin_=Tr(qu),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Wu(e){Uu(e),e.drafts_.forEach(Cx),e.drafts_=null}function Uu(e){e===fn&&(fn=e.parent_)}var Yf=e=>fn=jx(fn,e);function Cx(e){const t=e[Re];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Gf(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[Re].modified_&&(Wu(t),lt(4)),vt(e)&&(e=Vf(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(r[Re].base_,e,t)}else e=Vf(t,r);return Ix(t,e,!0),Wu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Zp?e:void 0}function Vf(e,t){if(ba(t))return t;const r=t[Re];if(!r)return Ql(t,e.handledSet_,e);if(!wa(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);nm(r,e)}return r.copy_}function Ix(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zl(t,r)}function tm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var wa=(e,t)=>e.scope_===t,Mx=[];function rm(e,t,r,n){const i=Ot(e),a=e.type_;if(n!==void 0&&Fu(i,n,a)===t){Ci(i,n,r,a);return}if(!e.draftLocations_){const u=e.draftLocations_=new Map;_n(i,(l,s)=>{if(It(s)){const c=u.get(s)||[];c.push(l),u.set(s,c)}})}const o=e.draftLocations_.get(t)??Mx;for(const u of o)Ci(i,u,r,a)}function Tx(e,t,r){e.callbacks_.push(function(i){const a=t;if(!a||!wa(a,i))return;i.mapSetPlugin_?.fixSetContents(a);const o=Xl(a);rm(e,a.draft_??a,o,r),nm(a,i)})}function nm(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const i=n.getPath(e);i&&n.generatePatches_(e,i,t)}tm(e)}}function Dx(e,t,r){const{scope_:n}=e;if(It(r)){const i=r[Re];wa(i,n)&&i.callbacks_.push(function(){yi(e);const o=Xl(i);rm(e,r,o,t)})}else vt(r)&&e.callbacks_.push(function(){const a=Ot(e);Fu(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ql(Fu(e.copy_,t,e.type_),n.handledSet_,n)})}function Ql(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||It(e)||t.has(e)||!vt(e)||ba(e)||(t.add(e),_n(e,(n,i)=>{if(It(i)){const a=i[Re];if(wa(a,r)){const o=Xl(a);Ci(e,n,o,e.type_),tm(a)}}else vt(i)&&Ql(i,t,r)})),e}function Nx(e,t){const r=ma(e),n={type_:r?1:0,scope_:t?t.scope_:em(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,a=Jl;r&&(i=[n],a=dn);const{revoke:o,proxy:u}=Proxy.revocable(i,a);return n.draft_=u,n.revoke_=o,[u,n]}var Jl={get(e,t){if(t===Re)return e;const r=Ot(e);if(!Uf(r,t,e.type_))return $x(e,r,t);const n=r[t];if(e.finalized_||!vt(n))return n;if(n===Xo(e.base_,t)){yi(e);const i=e.type_===1?+t:t,a=Yu(e.scope_,n,e,i);return e.copy_[i]=a}return n},has(e,t){return t in Ot(e)},ownKeys(e){return Reflect.ownKeys(Ot(e))},set(e,t,r){const n=im(Ot(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Xo(Ot(e),t),a=i?.[Re];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Ex(r,i)&&(r!==void 0||Uf(e.base_,t,e.type_)))return!0;yi(e),Hu(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Dx(e,t,r)),!0},deleteProperty(e,t){return yi(e),Xo(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Hu(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Ot(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[mi]:!0,[Bu]:e.type_!==1||t!=="length",[ji]:n[ji],[sn]:r[t]}},defineProperty(){lt(11)},getPrototypeOf(e){return Mr(e.base_)},setPrototypeOf(){lt(12)}},dn={};_n(Jl,(e,t)=>{dn[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}});dn.deleteProperty=function(e,t){return dn.set.call(this,e,t,void 0)};dn.set=function(e,t,r){return Jl.set.call(this,e[0],t,r,e[0])};function Xo(e,t){const r=e[Re];return(r?Ot(r):e)[t]}function $x(e,t,r){const n=im(t,r);return n?sn in n?n[sn]:n.get?.call(e.draft_):void 0}function im(e,t){if(!(t in e))return;let r=Mr(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Mr(r)}}function Hu(e){e.modified_||(e.modified_=!0,e.parent_&&Hu(e.parent_))}function yi(e){e.copy_||(e.assigned_=new Map,e.copy_=Ku(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Rx=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,i)=>{if(Er(r)&&!Er(n)){const o=n;n=r;const u=this;return function(s=o,...c){return u.produce(s,f=>n.call(this,f,...c))}}Er(n)||lt(6),i!==void 0&&!Er(i)&<(7);let a;if(vt(r)){const o=Yf(this),u=Yu(o,r,void 0);let l=!0;try{a=n(u),l=!1}finally{l?Wu(o):Uu(o)}return Hf(o,i),Gf(a,o)}else if(!r||!Vl(r)){if(a=n(r),a===void 0&&(a=r),a===Zp&&(a=void 0),this.autoFreeze_&&Zl(a,!0),i){const o=[],u=[];Tr(qu).generateReplacementPatches_(r,a,{patches_:o,inversePatches_:u}),i(o,u)}return a}else lt(1,r)},this.produceWithPatches=(r,n)=>{if(Er(r))return(u,...l)=>this.produceWithPatches(u,s=>r(s,...l));let i,a;return[this.produce(r,n,(u,l)=>{i=u,a=l}),i,a]},Vo(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Vo(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Vo(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){vt(t)||lt(8),It(t)&&(t=ft(t));const r=Yf(this),n=Yu(r,t,void 0);return n[Re].isManual_=!0,Uu(r),n}finishDraft(t,r){const n=t&&t[Re];(!n||!n.isManual_)&<(9);const{scope_:i}=n;return Hf(i,r),Gf(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const a=r[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(r=r.slice(n+1));const i=Tr(qu).applyPatches_;return It(t)?i(t,r):this.produce(t,a=>i(a,r))}};function Yu(e,t,r,n){const[i,a]=ya(t)?Tr(Ii).proxyMap_(t,r):ga(t)?Tr(Ii).proxySet_(t,r):Nx(t,r);return(r?.scope_??em()).drafts_.push(i),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?Tx(r,a,n):a.callbacks_.push(function(l){l.mapSetPlugin_?.fixSetContents(a);const{patchPlugin_:s}=l;a.modified_&&s&&s.generatePatches_(a,[],l)}),i}function ft(e){return It(e)||lt(10,e),am(e)}function am(e){if(!vt(e)||ba(e))return e;const t=e[Re];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ku(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ku(e,!0);return _n(r,(i,a)=>{Ci(r,i,am(a))},n),t&&(t.finalized_=!1),r}var Lx=new Rx,om=Lx.produce;function um(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var zx=um(),Bx=um,Fx=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?_i:_i.apply(null,arguments)};function at(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(Xe(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Xp(n)&&n.type===e,r}var lm=class on extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,on.prototype)}static get[Symbol.species](){return on}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new on(...t[0].concat(this)):new on(...t.concat(this))}};function Xf(e){return vt(e)?om(e,()=>{}):e}function ti(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Kx(e){return typeof e=="boolean"}var qx=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new lm;return r&&(Kx(r)?o.push(zx):o.push(Bx(r.extraArgument))),o},cm="RTK_autoBatch",re=()=>e=>({payload:e,meta:{[cm]:!0}}),Zf=e=>t=>{setTimeout(t,e)},sm=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,a=!1,o=!1;const u=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Zf(10):e.type==="callback"?e.queueNotification:Zf(e.timeout),s=()=>{o=!1,a&&(a=!1,u.forEach(c=>c()))};return Object.assign({},n,{subscribe(c){const f=()=>i&&c(),d=n.subscribe(f);return u.add(c),()=>{d(),u.delete(c)}},dispatch(c){try{return i=!c?.meta?.[cm],a=!i,a&&(o||(o=!0,l(s))),n.dispatch(c)}finally{i=!0}}})},Wx=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new lm(e);return n&&i.push(sm(typeof n=="object"?n:void 0)),i};function Ux(e){const t=qx(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let u;if(typeof r=="function")u=r;else if(Gl(r))u=Vp(r);else throw new Error(Xe(1));let l;typeof n=="function"?l=n(t):l=t();let s=_i;i&&(s=Fx({trace:!1,...typeof i=="object"&&i}));const c=Ax(...l),f=Wx(c);let d=typeof o=="function"?o(f):f();const v=s(...d);return Gp(u,a,v)}function fm(e){const t={},r=[];let n;const i={addCase(a,o){const u=typeof a=="string"?a:a.type;if(!u)throw new Error(Xe(28));if(u in t)throw new Error(Xe(29));return t[u]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return r.push({matcher:a,reducer:o}),i},addDefaultCase(a){return n=a,i}};return e(i),[t,r,n]}function Hx(e){return typeof e=="function"}function Yx(e,t){let[r,n,i]=fm(t),a;if(Hx(e))a=()=>Xf(e());else{const u=Xf(e);a=()=>u}function o(u=a(),l){let s=[r[l.type],...n.filter(({matcher:c})=>c(l)).map(({reducer:c})=>c)];return s.filter(c=>!!c).length===0&&(s=[i]),s.reduce((c,f)=>{if(f)if(It(c)){const v=f(c,l);return v===void 0?c:v}else{if(vt(c))return om(c,d=>f(d,l));{const d=f(c,l);if(d===void 0){if(c===null)return c;throw Error("A case reducer on a non-draftable value must not return undefined")}return d}}return c},u)}return o.getInitialState=a,o}var Gx="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Vx=(e=21)=>{let t="",r=e;for(;r--;)t+=Gx[Math.random()*64|0];return t},Xx=Symbol.for("rtk-slice-createasyncthunk");function Zx(e,t){return`${e}/${t}`}function Qx({creators:e}={}){const t=e?.asyncThunk?.[Xx];return function(n){const{name:i,reducerPath:a=i}=n;if(!i)throw new Error(Xe(11));const o=(typeof n.reducers=="function"?n.reducers(eP()):n.reducers)||{},u=Object.keys(o),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(w,P){const b=typeof w=="string"?w:w.type;if(!b)throw new Error(Xe(12));if(b in l.sliceCaseReducersByType)throw new Error(Xe(13));return l.sliceCaseReducersByType[b]=P,s},addMatcher(w,P){return l.sliceMatchers.push({matcher:w,reducer:P}),s},exposeAction(w,P){return l.actionCreators[w]=P,s},exposeCaseReducer(w,P){return l.sliceCaseReducersByName[w]=P,s}};u.forEach(w=>{const P=o[w],b={reducerName:w,type:Zx(i,w),createNotation:typeof n.reducers=="function"};rP(P)?iP(b,P,s,t):tP(b,P,s)});function c(){const[w={},P=[],b=void 0]=typeof n.extraReducers=="function"?fm(n.extraReducers):[n.extraReducers],O={...w,...l.sliceCaseReducersByType};return Yx(n.initialState,S=>{for(let _ in O)S.addCase(_,O[_]);for(let _ of l.sliceMatchers)S.addMatcher(_.matcher,_.reducer);for(let _ of P)S.addMatcher(_.matcher,_.reducer);b&&S.addDefaultCase(b)})}const f=w=>w,d=new Map,v=new WeakMap;let p;function y(w,P){return p||(p=c()),p(w,P)}function m(){return p||(p=c()),p.getInitialState()}function g(w,P=!1){function b(S){let _=S[w];return typeof _>"u"&&P&&(_=ti(v,b,m)),_}function O(S=f){const _=ti(d,P,()=>new WeakMap);return ti(_,S,()=>{const I={};for(const[M,E]of Object.entries(n.selectors??{}))I[M]=Jx(E,S,()=>ti(v,S,m),P);return I})}return{reducerPath:w,getSelectors:O,get selectors(){return O(b)},selectSlice:b}}const x={name:i,reducer:y,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:m,...g(a),injectInto(w,{reducerPath:P,...b}={}){const O=P??a;return w.inject({reducerPath:O,reducer:y},b),{...x,...g(O,!0)}}};return x}}function Jx(e,t,r,n){function i(a,...o){let u=t(a);return typeof u>"u"&&n&&(u=r()),e(u,...o)}return i.unwrapped=e,i}var qe=Qx();function eP(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function tP({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!nP(n))throw new Error(Xe(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?at(e,o):at(e))}function rP(e){return e._reducerDefinitionType==="asyncThunk"}function nP(e){return e._reducerDefinitionType==="reducerWithPrepare"}function iP({type:e,reducerName:t},r,n,i){if(!i)throw new Error(Xe(18));const{payloadCreator:a,fulfilled:o,pending:u,rejected:l,settled:s,options:c}=r,f=i(e,a,c);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),u&&n.addCase(f.pending,u),l&&n.addCase(f.rejected,l),s&&n.addMatcher(f.settled,s),n.exposeCaseReducer(t,{fulfilled:o||ri,pending:u||ri,rejected:l||ri,settled:s||ri})}function ri(){}var aP="task",dm="listener",vm="completed",ec="cancelled",oP=`task-${ec}`,uP=`task-${vm}`,Gu=`${dm}-${ec}`,lP=`${dm}-${vm}`,xa=class{constructor(e){this.code=e,this.message=`${aP} ${ec} (reason: ${e})`}name="TaskAbortError";message},tc=(e,t)=>{if(typeof e!="function")throw new TypeError(Xe(32))},Mi=()=>{},hm=(e,t=Mi)=>(e.catch(t),e),pm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),fr=e=>{if(e.aborted)throw new xa(e.reason)};function mm(e,t){let r=Mi;return new Promise((n,i)=>{const a=()=>i(new xa(e.reason));if(e.aborted){a();return}r=pm(e,a),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Mi})}var cP=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof xa?"cancelled":"rejected",error:r}}finally{t?.()}},Ti=e=>t=>hm(mm(e,t).then(r=>(fr(e),r))),ym=e=>{const t=Ti(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:jr}=Object,Qf={},Pa="listenerMiddleware",sP=(e,t)=>{const r=n=>pm(e,()=>n.abort(e.reason));return(n,i)=>{tc(n);const a=new AbortController;r(a);const o=cP(async()=>{fr(e),fr(a.signal);const u=await n({pause:Ti(a.signal),delay:ym(a.signal),signal:a.signal});return fr(a.signal),u},()=>a.abort(uP));return i?.autoJoin&&t.push(o.catch(Mi)),{result:Ti(e)(o),cancel(){a.abort(oP)}}}},fP=(e,t)=>{const r=async(n,i)=>{fr(t);let a=()=>{};const u=[new Promise((l,s)=>{let c=e({predicate:n,effect:(f,d)=>{d.unsubscribe(),l([f,d.getState(),d.getOriginalState()])}});a=()=>{c(),s()}})];i!=null&&u.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await mm(t,Promise.race(u));return fr(t),l}finally{a()}};return(n,i)=>hm(r(n,i))},gm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:a}=e;if(t)i=at(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(Xe(21));return tc(a),{predicate:i,type:t,effect:a}},bm=jr(e=>{const{type:t,predicate:r,effect:n}=gm(e);return{id:Vx(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Xe(22))}}},{withTypes:()=>bm}),Jf=(e,t)=>{const{type:r,effect:n,predicate:i}=gm(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===i)&&a.effect===n)},Vu=e=>{e.pending.forEach(t=>{t.abort(Gu)})},dP=(e,t)=>()=>{for(const r of t.keys())Vu(r);e.clear()},ed=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},wm=jr(at(`${Pa}/add`),{withTypes:()=>wm}),vP=at(`${Pa}/removeAll`),xm=jr(at(`${Pa}/remove`),{withTypes:()=>xm}),hP=(...e)=>{console.error(`${Pa}/error`,...e)},jn=(e={})=>{const t=new Map,r=new Map,n=v=>{const p=r.get(v)??0;r.set(v,p+1)},i=v=>{const p=r.get(v)??1;p===1?r.delete(v):r.set(v,p-1)},{extra:a,onError:o=hP}=e;tc(o);const u=v=>(v.unsubscribe=()=>t.delete(v.id),t.set(v.id,v),p=>{v.unsubscribe(),p?.cancelActive&&Vu(v)}),l=v=>{const p=Jf(t,v)??bm(v);return u(p)};jr(l,{withTypes:()=>l});const s=v=>{const p=Jf(t,v);return p&&(p.unsubscribe(),v.cancelActive&&Vu(p)),!!p};jr(s,{withTypes:()=>s});const c=async(v,p,y,m)=>{const g=new AbortController,x=fP(l,g.signal),w=[];try{v.pending.add(g),n(v),await Promise.resolve(v.effect(p,jr({},y,{getOriginalState:m,condition:(P,b)=>x(P,b).then(Boolean),take:x,delay:ym(g.signal),pause:Ti(g.signal),extra:a,signal:g.signal,fork:sP(g.signal,w),unsubscribe:v.unsubscribe,subscribe:()=>{t.set(v.id,v)},cancelActiveListeners:()=>{v.pending.forEach((P,b,O)=>{P!==g&&(P.abort(Gu),O.delete(P))})},cancel:()=>{g.abort(Gu),v.pending.delete(g)},throwIfCancelled:()=>{fr(g.signal)}})))}catch(P){P instanceof xa||ed(o,P,{raisedBy:"effect"})}finally{await Promise.all(w),g.abort(lP),i(v),v.pending.delete(g)}},f=dP(t,r);return{middleware:v=>p=>y=>{if(!Xp(y))return p(y);if(wm.match(y))return l(y.payload);if(vP.match(y)){f();return}if(xm.match(y))return s(y.payload);let m=v.getState();const g=()=>{if(m===Qf)throw new Error(Xe(23));return m};let x;try{if(x=p(y),t.size>0){const w=v.getState(),P=Array.from(t.values());for(const b of P){let O=!1;try{O=b.predicate(y,w,m)}catch(S){O=!1,ed(o,S,{raisedBy:"predicate"})}O&&c(b,y,v,g)}}}finally{m=Qf}return x},startListening:l,stopListening:s,clearListeners:f}};function Xe(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var pP={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Pm=qe({name:"chartLayout",initialState:pP,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,a;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:mP,setLayout:yP,setChartSize:gP,setScale:bP}=Pm.actions,wP=Pm.reducer;function Om(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function td(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _r(e){for(var t=1;t{if(t&&r){var{width:n,height:i}=r,{align:a,verticalAlign:o,layout:u}=t;if((u==="vertical"||u==="horizontal"&&o==="middle")&&a!=="center"&&N(e[a]))return _r(_r({},e),{},{[a]:e[a]+(n||0)});if((u==="horizontal"||u==="vertical"&&a==="center")&&o!=="middle"&&N(e[o]))return _r(_r({},e),{},{[o]:e[o]+(i||0)})}return e},Jt=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",Am=(e,t,r,n)=>{if(n)return e.map(u=>u.coordinate);var i,a,o=e.map(u=>(u.coordinate===t&&(i=!0),u.coordinate===r&&(a=!0),u.coordinate));return i||o.push(t),a||o.push(r),o},Sm=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:i,range:a,scale:o,realScaleType:u,isCategorical:l,categoricalDomain:s,tickCount:c,ticks:f,niceTicks:d,axisType:v}=e;if(!o)return null;var p=u==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,y=i==="category"&&o.bandwidth?o.bandwidth()/p:0;if(y=v==="angleAxis"&&a&&a.length>=2?Ae(a[0]-a[1])*2*y:y,f||d){var m=(f||d||[]).map((g,x)=>{var w=n?n.indexOf(g):g;return{coordinate:o(w)+y,value:g,offset:y,index:x}});return m.filter(g=>!dt(g.coordinate))}return l&&s?s.map((g,x)=>({coordinate:o(g)+y,value:g,index:x,offset:y})):o.ticks&&c!=null?o.ticks(c).map((g,x)=>({coordinate:o(g)+y,value:g,offset:y,index:x})):o.domain().map((g,x)=>({coordinate:o(g)+y,value:n?n[g]:g,index:x,offset:y}))},rd=1e-4,SP=e=>{var t=e.domain();if(!(!t||t.length<=2)){var r=t.length,n=e.range(),i=Math.min(n[0],n[1])-rd,a=Math.max(n[0],n[1])+rd,o=e(t[0]),u=e(t[r-1]);(oa||ua)&&e.domain([t[0],t[r-1]])}},EP=(e,t)=>{if(!t||t.length!==2||!N(t[0])||!N(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!N(e[0])||e[0]n)&&(i[1]=n),i[0]>n&&(i[0]=n),i[1]{var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r=0?(e[o][r][0]=i,e[o][r][1]=i+u,i=e[o][r][1]):(e[o][r][0]=a,e[o][r][1]=a+u,a=e[o][r][1])}},kP=e=>{var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r=0?(e[a][r][0]=i,e[a][r][1]=i+o,i=e[a][r][1]):(e[a][r][0]=0,e[a][r][1]=0)}},jP={sign:_P,expand:ew,none:Ir,silhouette:tw,wiggle:rw,positive:kP},CP=(e,t,r)=>{var n=jP[r],i=Jb().keys(t).value((a,o)=>Number(X(a,o,0))).order(Lu).offset(n);return i(e)};function IP(e){return e==null?void 0:String(e)}function nd(e){var{axis:t,ticks:r,bandSize:n,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!ae(i[t.dataKey])){var u=Cp(r,"value",i[t.dataKey]);if(u)return u.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var l=X(i,ae(o)?t.dataKey:o);return ae(l)?null:t.scale(l)}var id=e=>{var{axis:t,ticks:r,offset:n,bandSize:i,entry:a,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+n:null;var u=X(a,t.dataKey,t.scale.domain()[o]);return ae(u)?null:t.scale(u)-i/2+n},MP=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return n<=0&&i>=0?0:i<0?i:n}return r[0]},TP=e=>{var t=e.flat(2).filter(N);return[Math.min(...t),Math.max(...t)]},DP=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],NP=(e,t,r)=>{if(e!=null)return DP(Object.keys(e).reduce((n,i)=>{var a=e[i],{stackedData:o}=a,u=o.reduce((l,s)=>{var c=Om(s,t,r),f=TP(c);return[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(u[0],n[0]),Math.max(u[1],n[1])]},[1/0,-1/0]))},ad=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,od=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Dr=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=ha(t,c=>c.coordinate),a=1/0,o=1,u=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},RP=(e,t)=>t==="centric"?e.angle:e.radius,Rt=e=>e.layout.width,Lt=e=>e.layout.height,LP=e=>e.layout.scale,Em=e=>e.layout.margin,Oa=A(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Aa=A(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),_m="data-recharts-item-index",km="data-recharts-item-data-key",Cn=60;function ld(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ni(e){for(var t=1;te.brush.height;function qP(e){var t=Aa(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Cn;return r+i}return r},0)}function WP(e){var t=Aa(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Cn;return r+i}return r},0)}function UP(e){var t=Oa(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function HP(e){var t=Oa(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var ye=A([Rt,Lt,Em,KP,qP,WP,UP,HP,Hp,yx],(e,t,r,n,i,a,o,u,l,s)=>{var c={left:(r.left||0)+i,right:(r.right||0)+a},f={top:(r.top||0)+o,bottom:(r.bottom||0)+u},d=ni(ni({},f),c),v=d.bottom;d.bottom+=n,d=AP(d,l,s);var p=e-d.left-d.right,y=t-d.top-d.bottom;return ni(ni({brushBottom:v},d),{},{width:Math.max(p,0),height:Math.max(y,0)})}),YP=A(ye,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),rc=A(Rt,Lt,(e,t)=>({x:0,y:0,width:e,height:t})),GP=h.createContext(null),Me=()=>h.useContext(GP)!=null,Sa=e=>e.brush,Ea=A([Sa,ye,Em],(e,t,r)=>({height:e.height,x:N(e.x)?e.x:t.left,y:N(e.y)?e.y:t.top+t.height+t.brushBottom-(r?.bottom||0),width:N(e.width)?e.width:t.width})),Zo={},Qo={},Jo={},cd;function VP(){return cd||(cd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n,{signal:i,edges:a}={}){let o,u=null;const l=a!=null&&a.includes("leading"),s=a==null||a.includes("trailing"),c=()=>{u!==null&&(r.apply(o,u),o=void 0,u=null)},f=()=>{s&&c(),y()};let d=null;const v=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,f()},n)},p=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{p(),o=void 0,u=null},m=()=>{c()},g=function(...x){if(i?.aborted)return;o=this,u=x;const w=d==null;v(),l&&w&&c()};return g.schedule=v,g.cancel=y,g.flush=m,i?.addEventListener("abort",y,{once:!0}),g}e.debounce=t})(Jo)),Jo}var sd;function XP(){return sd||(sd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=VP();function r(n,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:u=!0,maxWait:l}=a,s=Array(2);o&&(s[0]="leading"),u&&(s[1]="trailing");let c,f=null;const d=t.debounce(function(...y){c=n.apply(this,y),f=null},i,{edges:s}),v=function(...y){return l!=null&&(f===null&&(f=Date.now()),Date.now()-f>=l)?(c=n.apply(this,y),f=Date.now(),d.cancel(),d.schedule(),c):(d.apply(this,y),c)},p=()=>(d.flush(),c);return v.cancel=d.cancel,v.flush=p,v}e.debounce=r})(Qo)),Qo}var fd;function ZP(){return fd||(fd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=XP();function r(n,i=0,a={}){const{leading:o=!0,trailing:u=!0}=a;return t.debounce(n,i,{leading:o,maxWait:i,trailing:u})}e.throttle=r})(Zo)),Zo}var eu,dd;function QP(){return dd||(dd=1,eu=ZP().throttle),eu}var JP=QP();const eO=Qt(JP);var Di=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;ai[o++]))}},jm=(e,t,r)=>{var{width:n="100%",height:i="100%",aspect:a,maxHeight:o}=r,u=Ct(n)?e:Number(n),l=Ct(i)?t:Number(i);return a&&a>0&&(u?l=u/a:l&&(u=l*a),o&&l!=null&&l>o&&(l=o)),{calculatedWidth:u,calculatedHeight:l}},tO={width:0,height:0,overflow:"visible"},rO={width:0,overflowX:"visible"},nO={height:0,overflowY:"visible"},iO={},aO=e=>{var{width:t,height:r}=e,n=Ct(t),i=Ct(r);return n&&i?tO:n?rO:i?nO:iO};function oO(e){var{width:t,height:r,aspect:n}=e,i=t,a=r;return i===void 0&&a===void 0?(i="100%",a="100%"):i===void 0?i=n&&n>0?void 0:"100%":a===void 0&&(a=n&&n>0?void 0:"100%"),{width:i,height:a}}function se(e){return Number.isFinite(e)}function wt(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Xu(){return Xu=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:r,height:n}),[r,n]);return sO(i)?h.createElement(Cm.Provider,{value:i},t):null}var nc=()=>h.useContext(Cm),fO=h.forwardRef((e,t)=>{var{aspect:r,initialDimension:n={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:u,maxHeight:l,children:s,debounce:c=0,id:f,className:d,onResize:v,style:p={}}=e,y=h.useRef(null),m=h.useRef();m.current=v,h.useImperativeHandle(t,()=>y.current);var[g,x]=h.useState({containerWidth:n.width,containerHeight:n.height}),w=h.useCallback((_,I)=>{x(M=>{var E=Math.round(_),j=Math.round(I);return M.containerWidth===E&&M.containerHeight===j?M:{containerWidth:E,containerHeight:j}})},[]);h.useEffect(()=>{if(y.current==null||typeof ResizeObserver>"u")return Sn;var _=j=>{var $,{width:L,height:z}=j[0].contentRect;w(L,z),($=m.current)===null||$===void 0||$.call(m,L,z)};c>0&&(_=eO(_,c,{trailing:!0,leading:!1}));var I=new ResizeObserver(_),{width:M,height:E}=y.current.getBoundingClientRect();return w(M,E),I.observe(y.current),()=>{I.disconnect()}},[w,c]);var{containerWidth:P,containerHeight:b}=g;Di(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:O,calculatedHeight:S}=jm(P,b,{width:i,height:a,aspect:r,maxHeight:l});return Di(O!=null&&O>0||S!=null&&S>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,O,S,i,a,o,u,r),h.createElement("div",{id:f?"".concat(f):void 0,className:H("recharts-responsive-container",d),style:hd(hd({},p),{},{width:i,height:a,minWidth:o,minHeight:u,maxHeight:l}),ref:y},h.createElement("div",{style:aO({width:i,height:a})},h.createElement(Im,{width:O,height:S},s)))}),I$=h.forwardRef((e,t)=>{var r=nc();if(wt(r.width)&&wt(r.height))return e.children;var{width:n,height:i}=oO({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=jm(void 0,void 0,{width:n,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return N(a)&&N(o)?h.createElement(Im,{width:a,height:o},e.children):h.createElement(fO,Xu({},e,{width:n,height:i,ref:t}))});function Mm(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var _a=()=>{var e,t=Me(),r=T(YP),n=T(Ea),i=(e=T(Sa))===null||e===void 0?void 0:e.padding;return!t||!n||!i?r:{width:n.width-i.left-i.right,height:n.height-i.top-i.bottom,x:i.left,y:i.top}},dO={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Tm=()=>{var e;return(e=T(ye))!==null&&e!==void 0?e:dO},ic=()=>T(Rt),ac=()=>T(Lt),vO=()=>T(e=>e.layout.margin),q=e=>e.layout.layoutType,In=()=>T(q),hO=()=>{var e=In();return e!==void 0},ka=e=>{var t=ee(),r=Me(),{width:n,height:i}=e,a=nc(),o=n,u=i;return a&&(o=a.width>0?a.width:n,u=a.height>0?a.height:i),h.useEffect(()=>{!r&&wt(o)&&wt(u)&&t(gP({width:o,height:u}))},[t,r,o,u]),null},Dm=Symbol.for("immer-nothing"),pd=Symbol.for("immer-draftable"),Qe=Symbol.for("immer-state");function ct(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var vn=Object.getPrototypeOf;function Nr(e){return!!e&&!!e[Qe]}function mr(e){return e?Nm(e)||Array.isArray(e)||!!e[pd]||!!e.constructor?.[pd]||Mn(e)||Ca(e):!1}var pO=Object.prototype.constructor.toString(),md=new WeakMap;function Nm(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=md.get(r);return n===void 0&&(n=Function.toString.call(r),md.set(r,n)),n===pO}function Ni(e,t,r=!0){ja(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function ja(e){const t=e[Qe];return t?t.type_:Array.isArray(e)?1:Mn(e)?2:Ca(e)?3:0}function Zu(e,t){return ja(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function $m(e,t,r){const n=ja(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function mO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Mn(e){return e instanceof Map}function Ca(e){return e instanceof Set}function or(e){return e.copy_||e.base_}function Qu(e,t){if(Mn(e))return new Map(e);if(Ca(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Nm(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[Qe];let i=Reflect.ownKeys(n);for(let a=0;a1&&Object.defineProperties(e,{set:ii,add:ii,clear:ii,delete:ii}),Object.freeze(e),t&&Object.values(e).forEach(r=>oc(r,!0))),e}function yO(){ct(2)}var ii={value:yO};function Ia(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var gO={};function yr(e){const t=gO[e];return t||ct(0,e),t}var hn;function Rm(){return hn}function bO(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function yd(e,t){t&&(yr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ju(e){el(e),e.drafts_.forEach(wO),e.drafts_=null}function el(e){e===hn&&(hn=e.parent_)}function gd(e){return hn=bO(hn,e)}function wO(e){const t=e[Qe];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function bd(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[Qe].modified_&&(Ju(t),ct(4)),mr(e)&&(e=$i(t,e),t.parent_||Ri(t,e)),t.patches_&&yr("Patches").generateReplacementPatches_(r[Qe].base_,e,t.patches_,t.inversePatches_)):e=$i(t,r,[]),Ju(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Dm?e:void 0}function $i(e,t,r){if(Ia(t))return t;const n=e.immer_.shouldUseStrictIteration(),i=t[Qe];if(!i)return Ni(t,(a,o)=>wd(e,i,t,a,o,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return Ri(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,u=!1;i.type_===3&&(o=new Set(a),a.clear(),u=!0),Ni(o,(l,s)=>wd(e,i,a,l,s,r,u),n),Ri(e,a,!1),r&&e.patches_&&yr("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function wd(e,t,r,n,i,a,o){if(i==null||typeof i!="object"&&!o)return;const u=Ia(i);if(!(u&&!o)){if(Nr(i)){const l=a&&t&&t.type_!==3&&!Zu(t.assigned_,n)?a.concat(n):void 0,s=$i(e,i,l);if($m(r,n,s),Nr(s))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(mr(i)&&!u){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&u)return;$i(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Mn(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&Ri(e,i)}}}function Ri(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&oc(t,r)}function xO(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Rm(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=uc;r&&(i=[n],a=pn);const{revoke:o,proxy:u}=Proxy.revocable(i,a);return n.draft_=u,n.revoke_=o,u}var uc={get(e,t){if(t===Qe)return e;const r=or(e);if(!Zu(r,t))return PO(e,r,t);const n=r[t];return e.finalized_||!mr(n)?n:n===tu(e.base_,t)?(ru(e),e.copy_[t]=rl(n,e)):n},has(e,t){return t in or(e)},ownKeys(e){return Reflect.ownKeys(or(e))},set(e,t,r){const n=Lm(or(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=tu(or(e),t),a=i?.[Qe];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(mO(r,i)&&(r!==void 0||Zu(e.base_,t)))return!0;ru(e),tl(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return tu(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ru(e),tl(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=or(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){ct(11)},getPrototypeOf(e){return vn(e.base_)},setPrototypeOf(){ct(12)}},pn={};Ni(uc,(e,t)=>{pn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});pn.deleteProperty=function(e,t){return pn.set.call(this,e,t,void 0)};pn.set=function(e,t,r){return uc.set.call(this,e[0],t,r,e[0])};function tu(e,t){const r=e[Qe];return(r?or(r):e)[t]}function PO(e,t,r){const n=Lm(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function Lm(e,t){if(!(t in e))return;let r=vn(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=vn(r)}}function tl(e){e.modified_||(e.modified_=!0,e.parent_&&tl(e.parent_))}function ru(e){e.copy_||(e.copy_=Qu(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var OO=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const o=this;return function(l=a,...s){return o.produce(l,c=>r.call(this,c,...s))}}typeof r!="function"&&ct(6),n!==void 0&&typeof n!="function"&&ct(7);let i;if(mr(t)){const a=gd(this),o=rl(t,void 0);let u=!0;try{i=r(o),u=!1}finally{u?Ju(a):el(a)}return yd(a,n),bd(i,a)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===Dm&&(i=void 0),this.autoFreeze_&&oc(i,!0),n){const a=[],o=[];yr("Patches").generateReplacementPatches_(t,i,a,o),n(a,o)}return i}else ct(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...u)=>this.produceWithPatches(o,l=>t(l,...u));let n,i;return[this.produce(t,r,(o,u)=>{n=o,i=u}),n,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){mr(e)||ct(8),Nr(e)&&(e=AO(e));const t=gd(this),r=rl(e,void 0);return r[Qe].isManual_=!0,el(t),r}finishDraft(e,t){const r=e&&e[Qe];(!r||!r.isManual_)&&ct(9);const{scope_:n}=r;return yd(n,t),bd(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=yr("Patches").applyPatches_;return Nr(e)?n(e,t):this.produce(e,i=>n(i,t))}};function rl(e,t){const r=Mn(e)?yr("MapSet").proxyMap_(e,t):Ca(e)?yr("MapSet").proxySet_(e,t):xO(e,t);return(t?t.scope_:Rm()).drafts_.push(r),r}function AO(e){return Nr(e)||ct(10,e),zm(e)}function zm(e){if(!mr(e)||Ia(e))return e;const t=e[Qe];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Qu(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Qu(e,!0);return Ni(r,(i,a)=>{$m(r,i,zm(a))},n),t&&(t.finalized_=!1),r}var SO=new OO;SO.produce;var EO={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Bm=qe({name:"legend",initialState:EO,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:re()},replaceLegendPayload:{reducer(e,t){var{prev:r,next:n}=t.payload,i=ft(e).payload.indexOf(r);i>-1&&(e.payload[i]=n)},prepare:re()},removeLegendPayload:{reducer(e,t){var r=ft(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:re()}}}),{setLegendSize:xd,setLegendSettings:_O,addLegendPayload:Fm,replaceLegendPayload:Km,removeLegendPayload:qm}=Bm.actions,kO=Bm.reducer,jO=["contextPayload"];function nl(){return nl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(_O(e))},[t,e]),null}function zO(e){var t=ee();return h.useEffect(()=>(t(xd(e)),()=>{t(xd({width:0,height:0}))}),[t,e]),null}function BO(e,t,r,n){return e==="vertical"&&N(t)?{height:t}:e==="horizontal"?{width:r||n}:null}var FO={align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function KO(e){var t=pe(e,FO),r=wx(),n=Ob(),i=vO(),{width:a,height:o,wrapperStyle:u,portal:l}=t,[s,c]=Yp([r]),f=ic(),d=ac();if(f==null||d==null)return null;var v=f-(i?.left||0)-(i?.right||0),p=BO(t.layout,o,a,v),y=l?u:$r($r({position:"absolute",width:p?.width||a||"auto",height:p?.height||o||"auto"},RO(u,t,i,f,d,s)),u),m=l??n;if(m==null||r==null)return null;var g=h.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:c},h.createElement(LO,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!l&&h.createElement(zO,{width:s.width,height:s.height}),h.createElement($O,nl({},t,p,{margin:i,chartWidth:f,chartHeight:d,contextPayload:r})));return Nl.createPortal(g,m)}KO.displayName="Legend";function il(){return il=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=" : ",contentStyle:r={},itemStyle:n={},labelStyle:i={},payload:a,formatter:o,itemSorter:u,wrapperClassName:l,labelClassName:s,label:c,labelFormatter:f,accessibilityLayer:d=!1}=e,v=()=>{if(a&&a.length){var b={padding:0,margin:0},O=(u?ha(a,u):a).map((S,_)=>{if(S.type==="none")return null;var I=S.formatter||o||HO,{value:M,name:E}=S,j=M,$=E;if(I){var L=I(M,E,S,_,a);if(Array.isArray(L))[j,$]=L;else if(L!=null)j=L;else return null}var z=nu({display:"block",paddingTop:4,paddingBottom:4,color:S.color||"#000"},n);return h.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(_),style:z},bt($)?h.createElement("span",{className:"recharts-tooltip-item-name"},$):null,bt($)?h.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,h.createElement("span",{className:"recharts-tooltip-item-value"},j),h.createElement("span",{className:"recharts-tooltip-item-unit"},S.unit||""))});return h.createElement("ul",{className:"recharts-tooltip-item-list",style:b},O)}return null},p=nu({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},r),y=nu({margin:0},i),m=!ae(c),g=m?c:"",x=H("recharts-default-tooltip",l),w=H("recharts-tooltip-label",s);m&&f&&a!==void 0&&a!==null&&(g=f(c,a));var P=d?{role:"status","aria-live":"assertive"}:{};return h.createElement("div",il({className:x,style:p},P),h.createElement("p",{className:w,style:y},h.isValidElement(g)?g:"".concat(g)),v())},Zr="recharts-tooltip-wrapper",GO={visibility:"hidden"};function VO(e){var{coordinate:t,translateX:r,translateY:n}=e;return H(Zr,{["".concat(Zr,"-right")]:N(r)&&t&&N(t.x)&&r>=t.x,["".concat(Zr,"-left")]:N(r)&&t&&N(t.x)&&r=t.y,["".concat(Zr,"-top")]:N(n)&&t&&N(t.y)&&n0?i:0),f=r[n]+i;if(t[n])return o[n]?c:f;var d=l[n];if(d==null)return 0;if(o[n]){var v=c,p=d;return vm?Math.max(c,d):Math.max(f,d)}function XO(e){var{translateX:t,translateY:r,useTranslate3d:n}=e;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function ZO(e){var{allowEscapeViewBox:t,coordinate:r,offsetTopLeft:n,position:i,reverseDirection:a,tooltipBox:o,useTranslate3d:u,viewBox:l}=e,s,c,f;return o.height>0&&o.width>0&&r?(c=Ad({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:l,viewBoxDimension:l.width}),f=Ad({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:l,viewBoxDimension:l.height}),s=XO({translateX:c,translateY:f,useTranslate3d:u})):s=GO,{cssProperties:s,cssClasses:VO({translateX:c,translateY:f,coordinate:r})}}function Sd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ai(e){for(var t=1;t{if(t.key==="Escape"){var r,n,i,a;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(r=(n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==null&&r!==void 0?r:0,y:(i=(a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,r;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((r=this.props.coordinate)===null||r===void 0?void 0:r.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:r,animationDuration:n,animationEasing:i,children:a,coordinate:o,hasPayload:u,isAnimationActive:l,offset:s,position:c,reverseDirection:f,useTranslate3d:d,viewBox:v,wrapperStyle:p,lastBoundingBox:y,innerRef:m,hasPortalFromProps:g}=this.props,{cssClasses:x,cssProperties:w}=ZO({allowEscapeViewBox:r,coordinate:o,offsetTopLeft:s,position:c,reverseDirection:f,tooltipBox:{height:y.height,width:y.width},useTranslate3d:d,viewBox:v}),P=g?{}:ai(ai({transition:l&&t?"transform ".concat(n,"ms ").concat(i):void 0},w),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&u?"visible":"hidden",position:"absolute",top:0,left:0}),b=ai(ai({},P),{},{visibility:!this.state.dismissed&&t&&u?"visible":"hidden"},p);return h.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:b,ref:m},a)}}var Wm=()=>{var e;return(e=T(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function ol(){return ol=Object.assign?Object.assign.bind():function(e){for(var t=1;tse(e.x)&&se(e.y),jd=e=>e.base!=null&&Li(e.base)&&Li(e),Qr=e=>e.x,Jr=e=>e.y,i1=(e,t)=>{if(typeof e=="function")return e;var r="curve".concat(An(e));return(r==="curveMonotone"||r==="curveBump")&&t?kd["".concat(r).concat(t==="vertical"?"Y":"X")]:kd[r]||da},a1=e=>{var{type:t="linear",points:r=[],baseLine:n,layout:i,connectNulls:a=!1}=e,o=i1(t,i),u=a?r.filter(Li):r,l;if(Array.isArray(n)){var s=r.map((v,p)=>_d(_d({},v),{},{base:n[p]}));i==="vertical"?l=Zn().y(Jr).x1(Qr).x0(v=>v.base.x):l=Zn().x(Qr).y1(Jr).y0(v=>v.base.y);var c=l.defined(jd).curve(o),f=a?s.filter(jd):s;return c(f)}i==="vertical"&&N(n)?l=Zn().y(Jr).x1(Qr).x0(n):N(n)?l=Zn().x(Qr).y1(Jr).y0(n):l=yp().x(Qr).y(Jr);var d=l.defined(Li).curve(o);return d(u)},lc=e=>{var{className:t,points:r,path:n,pathRef:i}=e;if((!r||!r.length)&&!n)return null;var a=r&&r.length?a1(e):n;return h.createElement("path",ol({},Ze(e),Ul(e),{className:H("recharts-curve",t),d:a===null?void 0:a,ref:i}))},o1=["x","y","top","left","width","height","className"];function ul(){return ul=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(n,"M").concat(a,",").concat(t,"h").concat(r),h1=e=>{var{x:t=0,y:r=0,top:n=0,left:i=0,width:a=0,height:o=0,className:u}=e,l=f1(e,o1),s=u1({x:t,y:r,top:n,left:i,width:a,height:o},l);return!N(t)||!N(r)||!N(a)||!N(o)||!N(n)||!N(i)?null:h.createElement("path",ul({},$e(s),{className:H("recharts-cross",u),d:v1(t,r,a,o,n,i)}))};function p1(e,t,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-i,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function Id(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Md(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),Um=(e,t,r)=>e.map(n=>"".concat(b1(n)," ").concat(t,"ms ").concat(r)).join(","),w1=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((r,n)=>r.filter(i=>n.includes(i))),mn=(e,t)=>Object.keys(t).reduce((r,n)=>Md(Md({},r),{},{[n]:e(n,t[n])}),{});function Td(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function me(e){for(var t=1;te+(t-e)*r,ll=e=>{var{from:t,to:r}=e;return t!==r},Hm=(e,t,r)=>{var n=mn((i,a)=>{if(ll(a)){var[o,u]=e(a.from,a.to,a.velocity);return me(me({},a),{},{from:o,velocity:u})}return a},t);return r<1?mn((i,a)=>ll(a)?me(me({},a),{},{velocity:zi(a.velocity,n[i].velocity,r),from:zi(a.from,n[i].from,r)}):a,t):Hm(e,n,r-1)};function A1(e,t,r,n,i,a){var o,u=n.reduce((d,v)=>me(me({},d),{},{[v]:{from:e[v],velocity:0,to:t[v]}}),{}),l=()=>mn((d,v)=>v.from,u),s=()=>!Object.values(u).filter(ll).length,c=null,f=d=>{o||(o=d);var v=d-o,p=v/r.dt;u=Hm(r,u,p),i(me(me(me({},e),t),l())),o=d,s()||(c=a.setTimeout(f))};return()=>(c=a.setTimeout(f),()=>{var d;(d=c)===null||d===void 0||d()})}function S1(e,t,r,n,i,a,o){var u=null,l=i.reduce((f,d)=>me(me({},f),{},{[d]:[e[d],t[d]]}),{}),s,c=f=>{s||(s=f);var d=(f-s)/n,v=mn((y,m)=>zi(...m,r(d)),l);if(a(me(me(me({},e),t),v)),d<1)u=o.setTimeout(c);else{var p=mn((y,m)=>zi(...m,r(1)),l);a(me(me(me({},e),t),p))}};return()=>(u=o.setTimeout(c),()=>{var f;(f=u)===null||f===void 0||f()})}const E1=(e,t,r,n,i,a)=>{var o=w1(e,t);return r==null?()=>(i(me(me({},e),t)),()=>{}):r.isStepper===!0?A1(e,t,r,o,i,a):S1(e,t,r,n,o,i,a)};var Bi=1e-4,Ym=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Gm=(e,t)=>e.map((r,n)=>r*t**n).reduce((r,n)=>r+n),Dd=(e,t)=>r=>{var n=Ym(e,t);return Gm(n,r)},_1=(e,t)=>r=>{var n=Ym(e,t),i=[...n.map((a,o)=>a*o).slice(1),0];return Gm(i,r)},k1=function(){for(var t=arguments.length,r=new Array(t),n=0;nparseFloat(u));return[o[0],o[1],o[2],o[3]]}}}return r.length===4?r:[0,0,1,1]},j1=(e,t,r,n)=>{var i=Dd(e,r),a=Dd(t,n),o=_1(e,r),u=s=>s>1?1:s<0?0:s,l=s=>{for(var c=s>1?1:s,f=c,d=0;d<8;++d){var v=i(f)-c,p=o(f);if(Math.abs(v-c)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:r=100,damping:n=8,dt:i=17}=t,a=(o,u,l)=>{var s=-(o-u)*r,c=l*n,f=l+(s-c)*i/1e3,d=l*i/1e3+o;return Math.abs(d-u){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Nd(e);case"spring":return C1();default:if(e.split("(")[0]==="cubic-bezier")return Nd(e)}return typeof e=="function"?e:null};function M1(e){var t,r=()=>null,n=!1,i=null,a=o=>{if(!n){if(Array.isArray(o)){if(!o.length)return;var u=o,[l,...s]=u;if(typeof l=="number"){i=e.setTimeout(a.bind(null,s),l);return}a(l),i=e.setTimeout(a.bind(null,s));return}typeof o=="string"&&(t=o,r(t)),typeof o=="object"&&(t=o,r(t)),typeof o=="function"&&o()}};return{stop:()=>{n=!0},start:o=>{n=!1,i&&(i(),i=null),a(o)},subscribe:o=>(r=o,()=>{r=()=>null}),getTimeoutController:()=>e}}class T1{setTimeout(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),i=null,a=o=>{o-n>=r?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{i!=null&&cancelAnimationFrame(i)}}}function D1(){return M1(new T1)}var N1=h.createContext(D1);function $1(e,t){var r=h.useContext(N1);return h.useMemo(()=>t??r(e),[e,t,r])}var R1=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Tn={devToolsEnabled:!1,isSsr:R1()},L1={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},$d={t:0},iu={t:1};function Dn(e){var t=pe(e,L1),{isActive:r,canBegin:n,duration:i,easing:a,begin:o,onAnimationEnd:u,onAnimationStart:l,children:s}=t,c=r==="auto"?!Tn.isSsr:r,f=$1(t.animationId,t.animationManager),[d,v]=h.useState(c?$d:iu),p=h.useRef(null);return h.useEffect(()=>{c||v(iu)},[c]),h.useEffect(()=>{if(!c||!n)return Sn;var y=E1($d,iu,I1(a),i,v,f.getTimeoutController()),m=()=>{p.current=y()};return f.start([l,o,m,i,u]),()=>{f.stop(),p.current&&p.current(),u()}},[c,n,i,a,o,l,u,f]),s(d.t)}function Nn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",r=h.useRef(cn(t)),n=h.useRef(e);return n.current!==e&&(r.current=cn(t),n.current=e),r.current}var z1=["radius"],B1=["radius"];function Rd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ld(e){for(var t=1;t{var a=Math.min(Math.abs(r)/2,Math.abs(n)/2),o=n>=0?1:-1,u=r>=0?1:-1,l=n>=0&&r>=0||n<0&&r<0?1:0,s;if(a>0&&i instanceof Array){for(var c=[0,0,0,0],f=0,d=4;fa?a:i[f];s="M".concat(e,",").concat(t+o*c[0]),c[0]>0&&(s+="A ".concat(c[0],",").concat(c[0],",0,0,").concat(l,",").concat(e+u*c[0],",").concat(t)),s+="L ".concat(e+r-u*c[1],",").concat(t),c[1]>0&&(s+="A ".concat(c[1],",").concat(c[1],",0,0,").concat(l,`, + `).concat(e+r,",").concat(t+o*c[1])),s+="L ".concat(e+r,",").concat(t+n-o*c[2]),c[2]>0&&(s+="A ".concat(c[2],",").concat(c[2],",0,0,").concat(l,`, + `).concat(e+r-u*c[2],",").concat(t+n)),s+="L ".concat(e+u*c[3],",").concat(t+n),c[3]>0&&(s+="A ".concat(c[3],",").concat(c[3],",0,0,").concat(l,`, + `).concat(e,",").concat(t+n-o*c[3])),s+="Z"}else if(a>0&&i===+i&&i>0){var v=Math.min(a,i);s="M ".concat(e,",").concat(t+o*v,` + A `).concat(v,",").concat(v,",0,0,").concat(l,",").concat(e+u*v,",").concat(t,` + L `).concat(e+r-u*v,",").concat(t,` + A `).concat(v,",").concat(v,",0,0,").concat(l,",").concat(e+r,",").concat(t+o*v,` + L `).concat(e+r,",").concat(t+n-o*v,` + A `).concat(v,",").concat(v,",0,0,").concat(l,",").concat(e+r-u*v,",").concat(t+n,` + L `).concat(e+u*v,",").concat(t+n,` + A `).concat(v,",").concat(v,",0,0,").concat(l,",").concat(e,",").concat(t+n-o*v," Z")}else s="M ".concat(e,",").concat(t," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return s},Fd={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Vm=e=>{var t=pe(e,Fd),r=h.useRef(null),[n,i]=h.useState(-1);h.useEffect(()=>{if(r.current&&r.current.getTotalLength)try{var B=r.current.getTotalLength();B&&i(B)}catch{}},[]);var{x:a,y:o,width:u,height:l,radius:s,className:c}=t,{animationEasing:f,animationDuration:d,animationBegin:v,isAnimationActive:p,isUpdateAnimationActive:y}=t,m=h.useRef(u),g=h.useRef(l),x=h.useRef(a),w=h.useRef(o),P=h.useMemo(()=>({x:a,y:o,width:u,height:l,radius:s}),[a,o,u,l,s]),b=Nn(P,"rectangle-");if(a!==+a||o!==+o||u!==+u||l!==+l||u===0||l===0)return null;var O=H("recharts-rectangle",c);if(!y){var S=$e(t),{radius:_}=S,I=zd(S,z1);return h.createElement("path",Fi({},I,{radius:typeof s=="number"?s:void 0,className:O,d:Bd(a,o,u,l,s)}))}var M=m.current,E=g.current,j=x.current,$=w.current,L="0px ".concat(n===-1?1:n,"px"),z="".concat(n,"px 0px"),K=Um(["strokeDasharray"],d,typeof f=="string"?f:Fd.animationEasing);return h.createElement(Dn,{animationId:b,key:b,canBegin:n>0,duration:d,easing:f,isActive:y,begin:v},B=>{var W=ne(M,u,B),R=ne(E,l,B),ke=ne(j,a,B),Te=ne($,o,B);r.current&&(m.current=W,g.current=R,x.current=ke,w.current=Te);var Le;p?B>0?Le={transition:K,strokeDasharray:z}:Le={strokeDasharray:L}:Le={strokeDasharray:z};var Pt=$e(t),{radius:Je}=Pt,nr=zd(Pt,B1);return h.createElement("path",Fi({},nr,{radius:typeof s=="number"?s:void 0,className:O,d:Bd(ke,Te,W,R,s),ref:r,style:Ld(Ld({},Le),t.style)}))})};function Kd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qd(e){for(var t=1;te*180/Math.PI,de=(e,t,r,n)=>({x:e+Math.cos(-Ki*n)*r,y:t+Math.sin(-Ki*n)*r}),Xm=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},V1=(e,t)=>{var{x:r,y:n}=e,{x:i,y:a}=t;return Math.sqrt((r-i)**2+(n-a)**2)},X1=(e,t)=>{var{x:r,y:n}=e,{cx:i,cy:a}=t,o=V1({x:r,y:n},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var u=(r-i)/o,l=Math.acos(u);return n>a&&(l=2*Math.PI-l),{radius:o,angle:G1(l),angleInRadian:l}},Z1=e=>{var{startAngle:t,endAngle:r}=e,n=Math.floor(t/360),i=Math.floor(r/360),a=Math.min(n,i);return{startAngle:t-a*360,endAngle:r-a*360}},Q1=(e,t)=>{var{startAngle:r,endAngle:n}=t,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return e+o*360},J1=(e,t)=>{var{chartX:r,chartY:n}=e,{radius:i,angle:a}=X1({x:r,y:n},t),{innerRadius:o,outerRadius:u}=t;if(iu||i===0)return null;var{startAngle:l,endAngle:s}=Z1(t),c=a,f;if(l<=s){for(;c>s;)c-=360;for(;c=l&&c<=s}else{for(;c>l;)c-=360;for(;c=s&&c<=l}return f?qd(qd({},t),{},{radius:i,angle:Q1(c,t)}):null};function Zm(e){var{cx:t,cy:r,radius:n,startAngle:i,endAngle:a}=e,o=de(t,r,n,i),u=de(t,r,n,a);return{points:[o,u],cx:t,cy:r,radius:n,startAngle:i,endAngle:a}}function cl(){return cl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=Ae(t-e),n=Math.min(Math.abs(t-e),359.999);return r*n},oi=e=>{var{cx:t,cy:r,radius:n,angle:i,sign:a,isExternal:o,cornerRadius:u,cornerIsExternal:l}=e,s=u*(o?1:-1)+n,c=Math.asin(u/s)/Ki,f=l?i:i+a*c,d=de(t,r,s,f),v=de(t,r,n,f),p=l?i-a*c:i,y=de(t,r,s*Math.cos(c*Ki),p);return{center:d,circleTangency:v,lineTangency:y,theta:c}},Qm=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:a,endAngle:o}=e,u=eA(a,o),l=a+u,s=de(t,r,i,a),c=de(t,r,i,l),f="M ".concat(s.x,",").concat(s.y,` + A `).concat(i,",").concat(i,`,0, + `).concat(+(Math.abs(u)>180),",").concat(+(a>l),`, + `).concat(c.x,",").concat(c.y,` + `);if(n>0){var d=de(t,r,n,a),v=de(t,r,n,l);f+="L ".concat(v.x,",").concat(v.y,` + A `).concat(n,",").concat(n,`,0, + `).concat(+(Math.abs(u)>180),",").concat(+(a<=l),`, + `).concat(d.x,",").concat(d.y," Z")}else f+="L ".concat(t,",").concat(r," Z");return f},tA=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:u,startAngle:l,endAngle:s}=e,c=Ae(s-l),{circleTangency:f,lineTangency:d,theta:v}=oi({cx:t,cy:r,radius:i,angle:l,sign:c,cornerRadius:a,cornerIsExternal:u}),{circleTangency:p,lineTangency:y,theta:m}=oi({cx:t,cy:r,radius:i,angle:s,sign:-c,cornerRadius:a,cornerIsExternal:u}),g=u?Math.abs(l-s):Math.abs(l-s)-v-m;if(g<0)return o?"M ".concat(d.x,",").concat(d.y,` + a`).concat(a,",").concat(a,",0,0,1,").concat(a*2,`,0 + a`).concat(a,",").concat(a,",0,0,1,").concat(-a*2,`,0 + `):Qm({cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:l,endAngle:s});var x="M ".concat(d.x,",").concat(d.y,` + A`).concat(a,",").concat(a,",0,0,").concat(+(c<0),",").concat(f.x,",").concat(f.y,` + A`).concat(i,",").concat(i,",0,").concat(+(g>180),",").concat(+(c<0),",").concat(p.x,",").concat(p.y,` + A`).concat(a,",").concat(a,",0,0,").concat(+(c<0),",").concat(y.x,",").concat(y.y,` + `);if(n>0){var{circleTangency:w,lineTangency:P,theta:b}=oi({cx:t,cy:r,radius:n,angle:l,sign:c,isExternal:!0,cornerRadius:a,cornerIsExternal:u}),{circleTangency:O,lineTangency:S,theta:_}=oi({cx:t,cy:r,radius:n,angle:s,sign:-c,isExternal:!0,cornerRadius:a,cornerIsExternal:u}),I=u?Math.abs(l-s):Math.abs(l-s)-b-_;if(I<0&&a===0)return"".concat(x,"L").concat(t,",").concat(r,"Z");x+="L".concat(S.x,",").concat(S.y,` + A`).concat(a,",").concat(a,",0,0,").concat(+(c<0),",").concat(O.x,",").concat(O.y,` + A`).concat(n,",").concat(n,",0,").concat(+(I>180),",").concat(+(c>0),",").concat(w.x,",").concat(w.y,` + A`).concat(a,",").concat(a,",0,0,").concat(+(c<0),",").concat(P.x,",").concat(P.y,"Z")}else x+="L".concat(t,",").concat(r,"Z");return x},rA={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Jm=e=>{var t=pe(e,rA),{cx:r,cy:n,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:u,cornerIsExternal:l,startAngle:s,endAngle:c,className:f}=t;if(a0&&Math.abs(s-c)<360?y=tA({cx:r,cy:n,innerRadius:i,outerRadius:a,cornerRadius:Math.min(p,v/2),forceCornerRadius:u,cornerIsExternal:l,startAngle:s,endAngle:c}):y=Qm({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:s,endAngle:c}),h.createElement("path",cl({},$e(t),{className:d,d:y}))};function nA(e,t,r){if(e==="horizontal")return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if(e==="vertical")return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(Mp(t)){if(e==="centric"){var{cx:n,cy:i,innerRadius:a,outerRadius:o,angle:u}=t,l=de(n,i,a,u),s=de(n,i,o,u);return[{x:l.x,y:l.y},{x:s.x,y:s.y}]}return Zm(t)}}var au={},ou={},uu={},Wd;function iA(){return Wd||(Wd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Wp();function r(n){return t.isSymbol(n)?NaN:Number(n)}e.toNumber=r})(uu)),uu}var Ud;function aA(){return Ud||(Ud=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=iA();function r(n){return n?(n=t.toNumber(n),n===1/0||n===-1/0?(n<0?-1:1)*Number.MAX_VALUE:n===n?n:0):n===0?n:0}e.toFinite=r})(ou)),ou}var Hd;function oA(){return Hd||(Hd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Up(),r=aA();function n(i,a,o){o&&typeof o!="number"&&t.isIterateeCall(i,a,o)&&(a=o=void 0),i=r.toFinite(i),a===void 0?(a=i,i=0):a=r.toFinite(a),o=o===void 0?it?1:e>=t?0:NaN}function cA(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function cc(e){let t,r,n;e.length!==2?(t=Ht,r=(u,l)=>Ht(e(u),l),n=(u,l)=>e(u)-l):(t=e===Ht||e===cA?e:sA,r=e,n=e);function i(u,l,s=0,c=u.length){if(s>>1;r(u[f],l)<0?s=f+1:c=f}while(s>>1;r(u[f],l)<=0?s=f+1:c=f}while(ss&&n(u[f-1],l)>-n(u[f],l)?f-1:f}return{left:i,center:o,right:a}}function sA(){return 0}function ty(e){return e===null?NaN:+e}function*fA(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const dA=cc(Ht),$n=dA.right;cc(ty).center;class Gd extends Map{constructor(t,r=pA){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(Vd(this,t))}has(t){return super.has(Vd(this,t))}set(t,r){return super.set(vA(this,t),r)}delete(t){return super.delete(hA(this,t))}}function Vd({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function vA({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function hA({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function pA(e){return e!==null&&typeof e=="object"?e.valueOf():e}function mA(e=Ht){if(e===Ht)return ry;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function ry(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const yA=Math.sqrt(50),gA=Math.sqrt(10),bA=Math.sqrt(2);function qi(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=yA?10:a>=gA?5:a>=bA?2:1;let u,l,s;return i<0?(s=Math.pow(10,-i)/o,u=Math.round(e*s),l=Math.round(t*s),u/st&&--l,s=-s):(s=Math.pow(10,i)*o,u=Math.round(e/s),l=Math.round(t/s),u*st&&--l),l0))return[];if(e===t)return[e];const n=t=i))return[];const u=a-i+1,l=new Array(u);if(n)if(o<0)for(let s=0;s=n)&&(r=n);return r}function Zd(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function ny(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?ry:mA(i);n>r;){if(n-r>600){const l=n-r+1,s=t-r+1,c=Math.log(l),f=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*f*(l-f)/l)*(s-l/2<0?-1:1),v=Math.max(r,Math.floor(t-s*f/l+d)),p=Math.min(n,Math.floor(t+(l-s)*f/l+d));ny(e,t,v,p,i)}const a=e[t];let o=r,u=n;for(en(e,r,t),i(e[n],a)>0&&en(e,r,n);o0;)--u}i(e[r],a)===0?en(e,r,u):(++u,en(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function en(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function wA(e,t,r){if(e=Float64Array.from(fA(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Zd(e);if(t>=1)return Xd(e);var n,i=(n-1)*t,a=Math.floor(i),o=Xd(ny(e,a).subarray(0,a+1)),u=Zd(e.subarray(a+1));return o+(u-o)*(i-a)}}function xA(e,t,r=ty){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,a=Math.floor(i),o=+r(e[a],a,e),u=+r(e[a+1],a+1,e);return o+(u-o)*(i-a)}}function PA(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?ui(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?ui(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=SA.exec(e))?new Ke(t[1],t[2],t[3],1):(t=EA.exec(e))?new Ke(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=_A.exec(e))?ui(t[1],t[2],t[3],t[4]):(t=kA.exec(e))?ui(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jA.exec(e))?iv(t[1],t[2]/100,t[3]/100,1):(t=CA.exec(e))?iv(t[1],t[2]/100,t[3]/100,t[4]):Qd.hasOwnProperty(e)?tv(Qd[e]):e==="transparent"?new Ke(NaN,NaN,NaN,0):null}function tv(e){return new Ke(e>>16&255,e>>8&255,e&255,1)}function ui(e,t,r,n){return n<=0&&(e=t=r=NaN),new Ke(e,t,r,n)}function TA(e){return e instanceof Rn||(e=bn(e)),e?(e=e.rgb(),new Ke(e.r,e.g,e.b,e.opacity)):new Ke}function hl(e,t,r,n){return arguments.length===1?TA(e):new Ke(e,t,r,n??1)}function Ke(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}dc(Ke,hl,ay(Rn,{brighter(e){return e=e==null?Wi:Math.pow(Wi,e),new Ke(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yn:Math.pow(yn,e),new Ke(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ke(dr(this.r),dr(this.g),dr(this.b),Ui(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rv,formatHex:rv,formatHex8:DA,formatRgb:nv,toString:nv}));function rv(){return`#${lr(this.r)}${lr(this.g)}${lr(this.b)}`}function DA(){return`#${lr(this.r)}${lr(this.g)}${lr(this.b)}${lr((isNaN(this.opacity)?1:this.opacity)*255)}`}function nv(){const e=Ui(this.opacity);return`${e===1?"rgb(":"rgba("}${dr(this.r)}, ${dr(this.g)}, ${dr(this.b)}${e===1?")":`, ${e})`}`}function Ui(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function dr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function lr(e){return e=dr(e),(e<16?"0":"")+e.toString(16)}function iv(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new st(e,t,r,n)}function oy(e){if(e instanceof st)return new st(e.h,e.s,e.l,e.opacity);if(e instanceof Rn||(e=bn(e)),!e)return new st;if(e instanceof st)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,u=a-i,l=(a+i)/2;return u?(t===a?o=(r-n)/u+(r0&&l<1?0:o,new st(o,u,l,e.opacity)}function NA(e,t,r,n){return arguments.length===1?oy(e):new st(e,t,r,n??1)}function st(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}dc(st,NA,ay(Rn,{brighter(e){return e=e==null?Wi:Math.pow(Wi,e),new st(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yn:Math.pow(yn,e),new st(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Ke(cu(e>=240?e-240:e+120,i,n),cu(e,i,n),cu(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new st(av(this.h),li(this.s),li(this.l),Ui(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ui(this.opacity);return`${e===1?"hsl(":"hsla("}${av(this.h)}, ${li(this.s)*100}%, ${li(this.l)*100}%${e===1?")":`, ${e})`}`}}));function av(e){return e=(e||0)%360,e<0?e+360:e}function li(e){return Math.max(0,Math.min(1,e||0))}function cu(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const vc=e=>()=>e;function $A(e,t){return function(r){return e+r*t}}function RA(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function LA(e){return(e=+e)==1?uy:function(t,r){return r-t?RA(t,r,e):vc(isNaN(t)?r:t)}}function uy(e,t){var r=t-e;return r?$A(e,r):vc(isNaN(e)?t:e)}const ov=(function e(t){var r=LA(t);function n(i,a){var o=r((i=hl(i)).r,(a=hl(a)).r),u=r(i.g,a.g),l=r(i.b,a.b),s=uy(i.opacity,a.opacity);return function(c){return i.r=o(c),i.g=u(c),i.b=l(c),i.opacity=s(c),i+""}}return n.gamma=e,n})(1);function zA(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;ir&&(a=t.slice(r,a),u[o]?u[o]+=a:u[++o]=a),(n=n[0])===(i=i[0])?u[o]?u[o]+=i:u[++o]=i:(u[++o]=null,l.push({i:o,x:pt(n,i)})),r=su.lastIndex;return r180?c+=360:c-s>180&&(s+=360),d.push({i:f.push(i(f)+"rotate(",null,n)-2,x:pt(s,c)})):c&&f.push(i(f)+"rotate("+c+n)}function u(s,c,f,d){s!==c?d.push({i:f.push(i(f)+"skewX(",null,n)-2,x:pt(s,c)}):c&&f.push(i(f)+"skewX("+c+n)}function l(s,c,f,d,v,p){if(s!==f||c!==d){var y=v.push(i(v)+"scale(",null,",",null,")");p.push({i:y-4,x:pt(s,f)},{i:y-2,x:pt(c,d)})}else(f!==1||d!==1)&&v.push(i(v)+"scale("+f+","+d+")")}return function(s,c){var f=[],d=[];return s=e(s),c=e(c),a(s.translateX,s.translateY,c.translateX,c.translateY,f,d),o(s.rotate,c.rotate,f,d),u(s.skewX,c.skewX,f,d),l(s.scaleX,s.scaleY,c.scaleX,c.scaleY,f,d),s=c=null,function(v){for(var p=-1,y=d.length,m;++pt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function tS(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i2?rS:tS,l=s=null,f}function f(d){return d==null||isNaN(d=+d)?a:(l||(l=u(e.map(n),t,r)))(n(o(d)))}return f.invert=function(d){return o(i((s||(s=u(t,e.map(n),pt)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,Hi),c()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),r=hc,c()},f.clamp=function(d){return arguments.length?(o=d?!0:Ne,c()):o!==Ne},f.interpolate=function(d){return arguments.length?(r=d,c()):r},f.unknown=function(d){return arguments.length?(a=d,f):a},function(d,v){return n=d,i=v,c()}}function pc(){return Ma()(Ne,Ne)}function nS(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Yi(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Rr(e){return e=Yi(Math.abs(e)),e?e[1]:NaN}function iS(e,t){return function(r,n){for(var i=r.length,a=[],o=0,u=e[0],l=0;i>0&&u>0&&(l+u+1>n&&(u=Math.max(1,n-l)),a.push(r.substring(i-=u,i+u)),!((l+=u+1)>n));)u=e[o=(o+1)%e.length];return a.reverse().join(t)}}function aS(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var oS=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wn(e){if(!(t=oS.exec(e)))throw new Error("invalid format: "+e);var t;return new mc({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}wn.prototype=mc.prototype;function mc(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}mc.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function uS(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var sy;function lS(e,t){var r=Yi(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(sy=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+Yi(e,Math.max(0,t+a-1))[0]}function sv(e,t){var r=Yi(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const fv={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:nS,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>sv(e*100,t),r:sv,s:lS,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function dv(e){return e}var vv=Array.prototype.map,hv=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function cS(e){var t=e.grouping===void 0||e.thousands===void 0?dv:iS(vv.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?dv:aS(vv.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function s(f){f=wn(f);var d=f.fill,v=f.align,p=f.sign,y=f.symbol,m=f.zero,g=f.width,x=f.comma,w=f.precision,P=f.trim,b=f.type;b==="n"?(x=!0,b="g"):fv[b]||(w===void 0&&(w=12),P=!0,b="g"),(m||d==="0"&&v==="=")&&(m=!0,d="0",v="=");var O=y==="$"?r:y==="#"&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",S=y==="$"?n:/[%p]/.test(b)?o:"",_=fv[b],I=/[defgprs%]/.test(b);w=w===void 0?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function M(E){var j=O,$=S,L,z,K;if(b==="c")$=_(E)+$,E="";else{E=+E;var B=E<0||1/E<0;if(E=isNaN(E)?l:_(Math.abs(E),w),P&&(E=uS(E)),B&&+E==0&&p!=="+"&&(B=!1),j=(B?p==="("?p:u:p==="-"||p==="("?"":p)+j,$=(b==="s"?hv[8+sy/3]:"")+$+(B&&p==="("?")":""),I){for(L=-1,z=E.length;++LK||K>57){$=(K===46?i+E.slice(L+1):E.slice(L))+$,E=E.slice(0,L);break}}}x&&!m&&(E=t(E,1/0));var W=j.length+E.length+$.length,R=W>1)+j+E+$+R.slice(W);break;default:E=R+j+E+$;break}return a(E)}return M.toString=function(){return f+""},M}function c(f,d){var v=s((f=wn(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(Rr(d)/3)))*3,y=Math.pow(10,-p),m=hv[8+p/3];return function(g){return v(y*g)+m}}return{format:s,formatPrefix:c}}var si,yc,fy;sS({thousands:",",grouping:[3],currency:["$",""]});function sS(e){return si=cS(e),yc=si.format,fy=si.formatPrefix,si}function fS(e){return Math.max(0,-Rr(Math.abs(e)))}function dS(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Rr(t)/3)))*3-Rr(Math.abs(e)))}function vS(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Rr(t)-Rr(e))+1}function dy(e,t,r,n){var i=dl(e,t,r),a;switch(n=wn(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=dS(i,o))&&(n.precision=a),fy(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=vS(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=fS(i))&&(n.precision=a-(n.type==="%")*2);break}}return yc(n)}function er(e){var t=e.domain;return e.ticks=function(r){var n=t();return sl(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return dy(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,a=n.length-1,o=n[i],u=n[a],l,s,c=10;for(u0;){if(s=fl(o,u,r),s===l)return n[i]=o,n[a]=u,t(n);if(s>0)o=Math.floor(o/s)*s,u=Math.ceil(u/s)*s;else if(s<0)o=Math.ceil(o*s)/s,u=Math.floor(u*s)/s;else break;l=s}return e},e}function vy(){var e=pc();return e.copy=function(){return Ln(e,vy())},ut.apply(e,arguments),er(e)}function hy(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Hi),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return hy(e).unknown(t)},e=arguments.length?Array.from(e,Hi):[0,1],er(r)}function py(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],a=e[n],o;return aMath.pow(e,t)}function gS(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function yv(e){return(t,r)=>-e(-t,r)}function gc(e){const t=e(pv,mv),r=t.domain;let n=10,i,a;function o(){return i=gS(n),a=yS(n),r()[0]<0?(i=yv(i),a=yv(a),e(hS,pS)):e(pv,mv),t}return t.base=function(u){return arguments.length?(n=+u,o()):n},t.domain=function(u){return arguments.length?(r(u),o()):r()},t.ticks=u=>{const l=r();let s=l[0],c=l[l.length-1];const f=c0){for(;d<=v;++d)for(p=1;pc)break;g.push(y)}}else for(;d<=v;++d)for(p=n-1;p>=1;--p)if(y=d>0?p/a(-d):p*a(d),!(yc)break;g.push(y)}g.length*2{if(u==null&&(u=10),l==null&&(l=n===10?"s":","),typeof l!="function"&&(!(n%1)&&(l=wn(l)).precision==null&&(l.trim=!0),l=yc(l)),u===1/0)return l;const s=Math.max(1,n*u/t.ticks().length);return c=>{let f=c/a(Math.round(i(c)));return f*nr(py(r(),{floor:u=>a(Math.floor(i(u))),ceil:u=>a(Math.ceil(i(u)))})),t}function my(){const e=gc(Ma()).domain([1,10]);return e.copy=()=>Ln(e,my()).base(e.base()),ut.apply(e,arguments),e}function gv(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function bv(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function bc(e){var t=1,r=e(gv(t),bv(t));return r.constant=function(n){return arguments.length?e(gv(t=+n),bv(t)):t},er(r)}function yy(){var e=bc(Ma());return e.copy=function(){return Ln(e,yy()).constant(e.constant())},ut.apply(e,arguments)}function wv(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function bS(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function wS(e){return e<0?-e*e:e*e}function wc(e){var t=e(Ne,Ne),r=1;function n(){return r===1?e(Ne,Ne):r===.5?e(bS,wS):e(wv(r),wv(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},er(t)}function xc(){var e=wc(Ma());return e.copy=function(){return Ln(e,xc()).exponent(e.exponent())},ut.apply(e,arguments),e}function xS(){return xc.apply(null,arguments).exponent(.5)}function xv(e){return Math.sign(e)*e*e}function PS(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function gy(){var e=pc(),t=[0,1],r=!1,n;function i(a){var o=PS(e(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return e.invert(xv(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,Hi)).map(xv)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return gy(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},ut.apply(i,arguments),er(i)}function by(){var e=[],t=[],r=[],n;function i(){var o=0,u=Math.max(1,t.length);for(r=new Array(u-1);++o0?r[u-1]:e[0],u=r?[n[r-1],t]:[n[s-1],n[s]]},o.unknown=function(l){return arguments.length&&(a=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return wy().domain([e,t]).range(i).unknown(a)},ut.apply(er(o),arguments)}function xy(){var e=[.5],t=[0,1],r,n=1;function i(a){return a!=null&&a<=a?t[$n(e,a,0,n)]:r}return i.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return xy().domain(e).range(t).unknown(r)},ut.apply(i,arguments)}const fu=new Date,du=new Date;function ge(e,t,r,n){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),u=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,u)=>{const l=[];if(a=i.ceil(a),u=u==null?1:Math.floor(u),!(a0))return l;let s;do l.push(s=new Date(+a)),t(a,u),e(a);while(sge(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,u)=>{if(o>=o)if(u<0)for(;++u<=0;)for(;t(o,-1),!a(o););else for(;--u>=0;)for(;t(o,1),!a(o););}),r&&(i.count=(a,o)=>(fu.setTime(+a),du.setTime(+o),e(fu),e(du),Math.floor(r(fu,du))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const Gi=ge(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Gi.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ge(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Gi);Gi.range;const Et=1e3,it=Et*60,_t=it*60,Mt=_t*24,Pc=Mt*7,Pv=Mt*30,vu=Mt*365,cr=ge(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Et)},(e,t)=>(t-e)/Et,e=>e.getUTCSeconds());cr.range;const Oc=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Et)},(e,t)=>{e.setTime(+e+t*it)},(e,t)=>(t-e)/it,e=>e.getMinutes());Oc.range;const Ac=ge(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*it)},(e,t)=>(t-e)/it,e=>e.getUTCMinutes());Ac.range;const Sc=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Et-e.getMinutes()*it)},(e,t)=>{e.setTime(+e+t*_t)},(e,t)=>(t-e)/_t,e=>e.getHours());Sc.range;const Ec=ge(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*_t)},(e,t)=>(t-e)/_t,e=>e.getUTCHours());Ec.range;const zn=ge(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*it)/Mt,e=>e.getDate()-1);zn.range;const Ta=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Mt,e=>e.getUTCDate()-1);Ta.range;const Py=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Mt,e=>Math.floor(e/Mt));Py.range;function xr(e){return ge(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*it)/Pc)}const Da=xr(0),Vi=xr(1),OS=xr(2),AS=xr(3),Lr=xr(4),SS=xr(5),ES=xr(6);Da.range;Vi.range;OS.range;AS.range;Lr.range;SS.range;ES.range;function Pr(e){return ge(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/Pc)}const Na=Pr(0),Xi=Pr(1),_S=Pr(2),kS=Pr(3),zr=Pr(4),jS=Pr(5),CS=Pr(6);Na.range;Xi.range;_S.range;kS.range;zr.range;jS.range;CS.range;const _c=ge(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());_c.range;const kc=ge(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());kc.range;const Tt=ge(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Tt.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});Tt.range;const Dt=ge(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Dt.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});Dt.range;function Oy(e,t,r,n,i,a){const o=[[cr,1,Et],[cr,5,5*Et],[cr,15,15*Et],[cr,30,30*Et],[a,1,it],[a,5,5*it],[a,15,15*it],[a,30,30*it],[i,1,_t],[i,3,3*_t],[i,6,6*_t],[i,12,12*_t],[n,1,Mt],[n,2,2*Mt],[r,1,Pc],[t,1,Pv],[t,3,3*Pv],[e,1,vu]];function u(s,c,f){const d=cm).right(o,d);if(v===o.length)return e.every(dl(s/vu,c/vu,f));if(v===0)return Gi.every(Math.max(dl(s,c,f),1));const[p,y]=o[d/o[v-1][2]53)return null;"w"in C||(C.w=1),"Z"in C?(Q=pu(tn(C.y,0,1)),Ue=Q.getUTCDay(),Q=Ue>4||Ue===0?Xi.ceil(Q):Xi(Q),Q=Ta.offset(Q,(C.V-1)*7),C.y=Q.getUTCFullYear(),C.m=Q.getUTCMonth(),C.d=Q.getUTCDate()+(C.w+6)%7):(Q=hu(tn(C.y,0,1)),Ue=Q.getDay(),Q=Ue>4||Ue===0?Vi.ceil(Q):Vi(Q),Q=zn.offset(Q,(C.V-1)*7),C.y=Q.getFullYear(),C.m=Q.getMonth(),C.d=Q.getDate()+(C.w+6)%7)}else("W"in C||"U"in C)&&("w"in C||(C.w="u"in C?C.u%7:"W"in C?1:0),Ue="Z"in C?pu(tn(C.y,0,1)).getUTCDay():hu(tn(C.y,0,1)).getDay(),C.m=0,C.d="W"in C?(C.w+6)%7+C.W*7-(Ue+5)%7:C.w+C.U*7-(Ue+6)%7);return"Z"in C?(C.H+=C.Z/100|0,C.M+=C.Z%100,pu(C)):hu(C)}}function _(k,F,U,C){for(var Be=0,Q=F.length,Ue=U.length,He,ir;Be=Ue)return-1;if(He=F.charCodeAt(Be++),He===37){if(He=F.charAt(Be++),ir=b[He in Ov?F.charAt(Be++):He],!ir||(C=ir(k,U,C))<0)return-1}else if(He!=U.charCodeAt(C++))return-1}return C}function I(k,F,U){var C=s.exec(F.slice(U));return C?(k.p=c.get(C[0].toLowerCase()),U+C[0].length):-1}function M(k,F,U){var C=v.exec(F.slice(U));return C?(k.w=p.get(C[0].toLowerCase()),U+C[0].length):-1}function E(k,F,U){var C=f.exec(F.slice(U));return C?(k.w=d.get(C[0].toLowerCase()),U+C[0].length):-1}function j(k,F,U){var C=g.exec(F.slice(U));return C?(k.m=x.get(C[0].toLowerCase()),U+C[0].length):-1}function $(k,F,U){var C=y.exec(F.slice(U));return C?(k.m=m.get(C[0].toLowerCase()),U+C[0].length):-1}function L(k,F,U){return _(k,t,F,U)}function z(k,F,U){return _(k,r,F,U)}function K(k,F,U){return _(k,n,F,U)}function B(k){return o[k.getDay()]}function W(k){return a[k.getDay()]}function R(k){return l[k.getMonth()]}function ke(k){return u[k.getMonth()]}function Te(k){return i[+(k.getHours()>=12)]}function Le(k){return 1+~~(k.getMonth()/3)}function Pt(k){return o[k.getUTCDay()]}function Je(k){return a[k.getUTCDay()]}function nr(k){return l[k.getUTCMonth()]}function Xr(k){return u[k.getUTCMonth()]}function ze(k){return i[+(k.getUTCHours()>=12)]}function to(k){return 1+~~(k.getUTCMonth()/3)}return{format:function(k){var F=O(k+="",w);return F.toString=function(){return k},F},parse:function(k){var F=S(k+="",!1);return F.toString=function(){return k},F},utcFormat:function(k){var F=O(k+="",P);return F.toString=function(){return k},F},utcParse:function(k){var F=S(k+="",!0);return F.toString=function(){return k},F}}}var Ov={"-":"",_:" ",0:"0"},Ee=/^\s*\d+/,$S=/^%/,RS=/[\\^$*+?|[\]().{}]/g;function Y(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a[t.toLowerCase(),r]))}function zS(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function BS(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function FS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function KS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function qS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function Av(e,t,r){var n=Ee.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function Sv(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function WS(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function US(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function HS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function Ev(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function YS(e,t,r){var n=Ee.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function _v(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function GS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function VS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function XS(e,t,r){var n=Ee.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ZS(e,t,r){var n=Ee.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function QS(e,t,r){var n=$S.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function JS(e,t,r){var n=Ee.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function eE(e,t,r){var n=Ee.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function kv(e,t){return Y(e.getDate(),t,2)}function tE(e,t){return Y(e.getHours(),t,2)}function rE(e,t){return Y(e.getHours()%12||12,t,2)}function nE(e,t){return Y(1+zn.count(Tt(e),e),t,3)}function Ay(e,t){return Y(e.getMilliseconds(),t,3)}function iE(e,t){return Ay(e,t)+"000"}function aE(e,t){return Y(e.getMonth()+1,t,2)}function oE(e,t){return Y(e.getMinutes(),t,2)}function uE(e,t){return Y(e.getSeconds(),t,2)}function lE(e){var t=e.getDay();return t===0?7:t}function cE(e,t){return Y(Da.count(Tt(e)-1,e),t,2)}function Sy(e){var t=e.getDay();return t>=4||t===0?Lr(e):Lr.ceil(e)}function sE(e,t){return e=Sy(e),Y(Lr.count(Tt(e),e)+(Tt(e).getDay()===4),t,2)}function fE(e){return e.getDay()}function dE(e,t){return Y(Vi.count(Tt(e)-1,e),t,2)}function vE(e,t){return Y(e.getFullYear()%100,t,2)}function hE(e,t){return e=Sy(e),Y(e.getFullYear()%100,t,2)}function pE(e,t){return Y(e.getFullYear()%1e4,t,4)}function mE(e,t){var r=e.getDay();return e=r>=4||r===0?Lr(e):Lr.ceil(e),Y(e.getFullYear()%1e4,t,4)}function yE(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Y(t/60|0,"0",2)+Y(t%60,"0",2)}function jv(e,t){return Y(e.getUTCDate(),t,2)}function gE(e,t){return Y(e.getUTCHours(),t,2)}function bE(e,t){return Y(e.getUTCHours()%12||12,t,2)}function wE(e,t){return Y(1+Ta.count(Dt(e),e),t,3)}function Ey(e,t){return Y(e.getUTCMilliseconds(),t,3)}function xE(e,t){return Ey(e,t)+"000"}function PE(e,t){return Y(e.getUTCMonth()+1,t,2)}function OE(e,t){return Y(e.getUTCMinutes(),t,2)}function AE(e,t){return Y(e.getUTCSeconds(),t,2)}function SE(e){var t=e.getUTCDay();return t===0?7:t}function EE(e,t){return Y(Na.count(Dt(e)-1,e),t,2)}function _y(e){var t=e.getUTCDay();return t>=4||t===0?zr(e):zr.ceil(e)}function _E(e,t){return e=_y(e),Y(zr.count(Dt(e),e)+(Dt(e).getUTCDay()===4),t,2)}function kE(e){return e.getUTCDay()}function jE(e,t){return Y(Xi.count(Dt(e)-1,e),t,2)}function CE(e,t){return Y(e.getUTCFullYear()%100,t,2)}function IE(e,t){return e=_y(e),Y(e.getUTCFullYear()%100,t,2)}function ME(e,t){return Y(e.getUTCFullYear()%1e4,t,4)}function TE(e,t){var r=e.getUTCDay();return e=r>=4||r===0?zr(e):zr.ceil(e),Y(e.getUTCFullYear()%1e4,t,4)}function DE(){return"+0000"}function Cv(){return"%"}function Iv(e){return+e}function Mv(e){return Math.floor(+e/1e3)}var Or,ky,jy;NE({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function NE(e){return Or=NS(e),ky=Or.format,Or.parse,jy=Or.utcFormat,Or.utcParse,Or}function $E(e){return new Date(e)}function RE(e){return e instanceof Date?+e:+new Date(+e)}function jc(e,t,r,n,i,a,o,u,l,s){var c=pc(),f=c.invert,d=c.domain,v=s(".%L"),p=s(":%S"),y=s("%I:%M"),m=s("%I %p"),g=s("%a %d"),x=s("%b %d"),w=s("%B"),P=s("%Y");function b(O){return(l(O)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>wA(e,a/n))},r.copy=function(){return Ty(t).domain(e)},zt.apply(r,arguments)}function Ra(){var e=0,t=.5,r=1,n=1,i,a,o,u,l,s=Ne,c,f=!1,d;function v(y){return isNaN(y=+y)?d:(y=.5+((y=+c(y))-a)*(n*ye.chartData,Mc=A([rr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),La=(e,t,r,n)=>n?Mc(e):rr(e);function Yt(e){if(Array.isArray(e)&&e.length===2){var[t,r]=e;if(se(t)&&se(r))return!0}return!1}function Tv(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Ry(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[r,n]=e,i,a;if(se(r))i=r;else if(typeof r=="function")return;if(se(n))a=n;else if(typeof n=="function")return;var o=[i,a];if(Yt(o))return o}}function KE(e,t,r){if(!(!r&&t==null)){if(typeof e=="function"&&t!=null)try{var n=e(t,r);if(Yt(n))return Tv(n,t,r)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,u;if(i==="auto")t!=null&&(o=Math.min(...t));else if(N(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t?.[0]))}catch{}else if(typeof i=="string"&&ad.test(i)){var l=ad.exec(i);if(l==null||t==null)o=void 0;else{var s=+l[1];o=t[0]-s}}else o=t?.[0];if(a==="auto")t!=null&&(u=Math.max(...t));else if(N(a))u=a;else if(typeof a=="function")try{t!=null&&(u=a(t?.[1]))}catch{}else if(typeof a=="string"&&od.test(a)){var c=od.exec(a);if(c==null||t==null)u=void 0;else{var f=+c[1];u=t[1]+f}}else u=t?.[1];var d=[o,u];if(Yt(d))return t==null?d:Tv(d,t,r)}}}var Kr=1e9,qE={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},Dc,ie=!0,ot="[DecimalError] ",vr=ot+"Invalid argument: ",Tc=ot+"Exponent out of range: ",qr=Math.floor,ur=Math.pow,WE=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ge,Oe=1e7,te=7,Ly=9007199254740991,Zi=qr(Ly/te),D={};D.absoluteValue=D.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};D.comparedTo=D.cmp=function(e){var t,r,n,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(n=a.d.length,i=e.d.length,t=0,r=ne.d[t]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};D.decimalPlaces=D.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*te;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};D.dividedBy=D.div=function(e){return kt(this,new this.constructor(e))};D.dividedToIntegerBy=D.idiv=function(e){var t=this,r=t.constructor;return Z(kt(t,new r(e),0,1),r.precision)};D.equals=D.eq=function(e){return!this.cmp(e)};D.exponent=function(){return he(this)};D.greaterThan=D.gt=function(e){return this.cmp(e)>0};D.greaterThanOrEqualTo=D.gte=function(e){return this.cmp(e)>=0};D.isInteger=D.isint=function(){return this.e>this.d.length-2};D.isNegative=D.isneg=function(){return this.s<0};D.isPositive=D.ispos=function(){return this.s>0};D.isZero=function(){return this.s===0};D.lessThan=D.lt=function(e){return this.cmp(e)<0};D.lessThanOrEqualTo=D.lte=function(e){return this.cmp(e)<1};D.logarithm=D.log=function(e){var t,r=this,n=r.constructor,i=n.precision,a=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Ge))throw Error(ot+"NaN");if(r.s<1)throw Error(ot+(r.s?"NaN":"-Infinity"));return r.eq(Ge)?new n(0):(ie=!1,t=kt(xn(r,a),xn(e,a),a),ie=!0,Z(t,i))};D.minus=D.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Fy(t,e):zy(t,(e.s=-e.s,e))};D.modulo=D.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(ot+"NaN");return r.s?(ie=!1,t=kt(r,e,0,1).times(e),ie=!0,r.minus(t)):Z(new n(r),i)};D.naturalExponential=D.exp=function(){return By(this)};D.naturalLogarithm=D.ln=function(){return xn(this)};D.negated=D.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};D.plus=D.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?zy(t,e):Fy(t,(e.s=-e.s,e))};D.precision=D.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(vr+e);if(t=he(i)+1,n=i.d.length-1,r=n*te+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};D.squareRoot=D.sqrt=function(){var e,t,r,n,i,a,o,u=this,l=u.constructor;if(u.s<1){if(!u.s)return new l(0);throw Error(ot+"NaN")}for(e=he(u),ie=!1,i=Math.sqrt(+u),i==0||i==1/0?(t=yt(u.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=qr((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new l(t)):n=new l(i.toString()),r=l.precision,i=o=r+3;;)if(a=n,n=a.plus(kt(u,a,o+2)).times(.5),yt(a.d).slice(0,o)===(t=yt(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Z(a,r+1,0),a.times(a).eq(u)){n=a;break}}else if(t!="9999")break;o+=4}return ie=!0,Z(n,r)};D.times=D.mul=function(e){var t,r,n,i,a,o,u,l,s,c=this,f=c.constructor,d=c.d,v=(e=new f(e)).d;if(!c.s||!e.s)return new f(0);for(e.s*=c.s,r=c.e+e.e,l=d.length,s=v.length,l=0;){for(t=0,i=l+n;i>n;)u=a[i]+v[n]*d[i-n-1]+t,a[i--]=u%Oe|0,t=u/Oe|0;a[i]=(a[i]+t)%Oe|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,ie?Z(e,f.precision):e};D.toDecimalPlaces=D.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(xt(e,0,Kr),t===void 0?t=n.rounding:xt(t,0,8),Z(r,e+he(r)+1,t))};D.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=gr(n,!0):(xt(e,0,Kr),t===void 0?t=i.rounding:xt(t,0,8),n=Z(new i(n),e+1,t),r=gr(n,!0,e+1)),r};D.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?gr(i):(xt(e,0,Kr),t===void 0?t=a.rounding:xt(t,0,8),n=Z(new a(i),e+he(i)+1,t),r=gr(n.abs(),!1,e+he(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};D.toInteger=D.toint=function(){var e=this,t=e.constructor;return Z(new t(e),he(e)+1,t.rounding)};D.toNumber=function(){return+this};D.toPower=D.pow=function(e){var t,r,n,i,a,o,u=this,l=u.constructor,s=12,c=+(e=new l(e));if(!e.s)return new l(Ge);if(u=new l(u),!u.s){if(e.s<1)throw Error(ot+"Infinity");return u}if(u.eq(Ge))return u;if(n=l.precision,e.eq(Ge))return Z(u,n);if(t=e.e,r=e.d.length-1,o=t>=r,a=u.s,o){if((r=c<0?-c:c)<=Ly){for(i=new l(Ge),t=Math.ceil(n/te+4),ie=!1;r%2&&(i=i.times(u),Nv(i.d,t)),r=qr(r/2),r!==0;)u=u.times(u),Nv(u.d,t);return ie=!0,e.s<0?new l(Ge).div(i):Z(i,n)}}else if(a<0)throw Error(ot+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,ie=!1,i=e.times(xn(u,n+s)),ie=!0,i=By(i),i.s=a,i};D.toPrecision=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?(r=he(i),n=gr(i,r<=a.toExpNeg||r>=a.toExpPos)):(xt(e,1,Kr),t===void 0?t=a.rounding:xt(t,0,8),i=Z(new a(i),e,t),r=he(i),n=gr(i,e<=r||r<=a.toExpNeg,e)),n};D.toSignificantDigits=D.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(xt(e,1,Kr),t===void 0?t=n.rounding:xt(t,0,8)),Z(new n(r),e,t)};D.toString=D.valueOf=D.val=D.toJSON=D[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=he(e),r=e.constructor;return gr(e,t<=r.toExpNeg||t>=r.toExpPos)};function zy(e,t){var r,n,i,a,o,u,l,s,c=e.constructor,f=c.precision;if(!e.s||!t.s)return t.s||(t=new c(e)),ie?Z(t,f):t;if(l=e.d,s=t.d,o=e.e,i=t.e,l=l.slice(),a=o-i,a){for(a<0?(n=l,a=-a,u=s.length):(n=s,i=o,u=l.length),o=Math.ceil(f/te),u=o>u?o+1:u+1,a>u&&(a=u,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(u=l.length,a=s.length,u-a<0&&(a=u,n=s,s=l,l=n),r=0;a;)r=(l[--a]=l[a]+s[a]+r)/Oe|0,l[a]%=Oe;for(r&&(l.unshift(r),++i),u=l.length;l[--u]==0;)l.pop();return t.d=l,t.e=i,ie?Z(t,f):t}function xt(e,t,r){if(e!==~~e||er)throw Error(vr+e)}function yt(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(u=l=0;ui[u]?1:-1;break}return l}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]1;)n.shift()}return function(n,i,a,o){var u,l,s,c,f,d,v,p,y,m,g,x,w,P,b,O,S,_,I=n.constructor,M=n.s==i.s?1:-1,E=n.d,j=i.d;if(!n.s)return new I(n);if(!i.s)throw Error(ot+"Division by zero");for(l=n.e-i.e,S=j.length,b=E.length,v=new I(M),p=v.d=[],s=0;j[s]==(E[s]||0);)++s;if(j[s]>(E[s]||0)&&--l,a==null?x=a=I.precision:o?x=a+(he(n)-he(i))+1:x=a,x<0)return new I(0);if(x=x/te+2|0,s=0,S==1)for(c=0,j=j[0],x++;(s1&&(j=e(j,c),E=e(E,c),S=j.length,b=E.length),P=S,y=E.slice(0,S),m=y.length;m=Oe/2&&++O;do c=0,u=t(j,y,S,m),u<0?(g=y[0],S!=m&&(g=g*Oe+(y[1]||0)),c=g/O|0,c>1?(c>=Oe&&(c=Oe-1),f=e(j,c),d=f.length,m=y.length,u=t(f,y,d,m),u==1&&(c--,r(f,S16)throw Error(Tc+he(e));if(!e.s)return new c(Ge);for(ie=!1,u=f,o=new c(.03125);e.abs().gte(.1);)e=e.times(o),s+=5;for(n=Math.log(ur(2,s))/Math.LN10*2+5|0,u+=n,r=i=a=new c(Ge),c.precision=u;;){if(i=Z(i.times(e),u),r=r.times(++l),o=a.plus(kt(i,r,u)),yt(o.d).slice(0,u)===yt(a.d).slice(0,u)){for(;s--;)a=Z(a.times(a),u);return c.precision=f,t==null?(ie=!0,Z(a,f)):a}a=o}}function he(e){for(var t=e.e*te,r=e.d[0];r>=10;r/=10)t++;return t}function mu(e,t,r){if(t>e.LN10.sd())throw ie=!0,r&&(e.precision=r),Error(ot+"LN10 precision limit exceeded");return Z(new e(e.LN10),t)}function qt(e){for(var t="";e--;)t+="0";return t}function xn(e,t){var r,n,i,a,o,u,l,s,c,f=1,d=10,v=e,p=v.d,y=v.constructor,m=y.precision;if(v.s<1)throw Error(ot+(v.s?"NaN":"-Infinity"));if(v.eq(Ge))return new y(0);if(t==null?(ie=!1,s=m):s=t,v.eq(10))return t==null&&(ie=!0),mu(y,s);if(s+=d,y.precision=s,r=yt(p),n=r.charAt(0),a=he(v),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)v=v.times(e),r=yt(v.d),n=r.charAt(0),f++;a=he(v),n>1?(v=new y("0."+r),a++):v=new y(n+"."+r.slice(1))}else return l=mu(y,s+2,m).times(a+""),v=xn(new y(n+"."+r.slice(1)),s-d).plus(l),y.precision=m,t==null?(ie=!0,Z(v,m)):v;for(u=o=v=kt(v.minus(Ge),v.plus(Ge),s),c=Z(v.times(v),s),i=3;;){if(o=Z(o.times(c),s),l=u.plus(kt(o,new y(i),s)),yt(l.d).slice(0,s)===yt(u.d).slice(0,s))return u=u.times(2),a!==0&&(u=u.plus(mu(y,s+2,m).times(a+""))),u=kt(u,new y(f),s),y.precision=m,t==null?(ie=!0,Z(u,m)):u;u=l,i+=2}}function Dv(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=qr(r/te),e.d=[],n=(r+1)%te,r<0&&(n+=te),nZi||e.e<-Zi))throw Error(Tc+r)}else e.s=0,e.e=0,e.d=[0];return e}function Z(e,t,r){var n,i,a,o,u,l,s,c,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(n=t-o,n<0)n+=te,i=t,s=f[c=0];else{if(c=Math.ceil((n+1)/te),a=f.length,c>=a)return e;for(s=a=f[c],o=1;a>=10;a/=10)o++;n%=te,i=n-te+o}if(r!==void 0&&(a=ur(10,o-i-1),u=s/a%10|0,l=t<0||f[c+1]!==void 0||s%a,l=r<4?(u||l)&&(r==0||r==(e.s<0?3:2)):u>5||u==5&&(r==4||l||r==6&&(n>0?i>0?s/ur(10,o-i):0:f[c-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return l?(a=he(e),f.length=1,t=t-a-1,f[0]=ur(10,(te-t%te)%te),e.e=qr(-t/te)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=c,a=1,c--):(f.length=c+1,a=ur(10,te-n),f[c]=i>0?(s/ur(10,o-i)%ur(10,i)|0)*a:0),l)for(;;)if(c==0){(f[0]+=a)==Oe&&(f[0]=1,++e.e);break}else{if(f[c]+=a,f[c]!=Oe)break;f[c--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if(ie&&(e.e>Zi||e.e<-Zi))throw Error(Tc+he(e));return e}function Fy(e,t){var r,n,i,a,o,u,l,s,c,f,d=e.constructor,v=d.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new d(e),ie?Z(t,v):t;if(l=e.d,f=t.d,n=t.e,s=e.e,l=l.slice(),o=s-n,o){for(c=o<0,c?(r=l,o=-o,u=f.length):(r=f,n=s,u=l.length),i=Math.max(Math.ceil(v/te),u)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=l.length,u=f.length,c=i0;--i)l[u++]=0;for(i=f.length;i>o;){if(l[--i]0?a=a.charAt(0)+"."+a.slice(1)+qt(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+qt(-i-1)+a,r&&(n=r-o)>0&&(a+=qt(n))):i>=o?(a+=qt(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+qt(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=qt(n))),e.s<0?"-"+a:a}function Nv(e,t){if(e.length>t)return e.length=t,!0}function Ky(e){var t,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(vr+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return Dv(o,a.toString())}else if(typeof a!="string")throw Error(vr+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,WE.test(a))Dv(o,a);else throw Error(vr+a)}if(i.prototype=D,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=Ky,i.config=i.set=UE,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(vr+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(vr+r+": "+n);return this}var Dc=Ky(qE);Ge=new Dc(1);const V=Dc;var HE=e=>e,qy={},Wy=e=>e===qy,$v=e=>function t(){return arguments.length===0||arguments.length===1&&Wy(arguments.length<=0?void 0:arguments[0])?t:e(...arguments)},Uy=(e,t)=>e===1?t:$v(function(){for(var r=arguments.length,n=new Array(r),i=0;io!==qy).length;return a>=e?t(...n):Uy(e-a,$v(function(){for(var o=arguments.length,u=new Array(o),l=0;lWy(c)?u.shift():c);return t(...s,...u)}))}),YE=e=>Uy(e.length,e),gl=(e,t)=>{for(var r=[],n=e;nArray.isArray(t)?t.map(e):Object.keys(t).map(r=>t[r]).map(e)),VE=function(){for(var t=arguments.length,r=new Array(t),n=0;nl(u),a(...arguments))}},bl=e=>Array.isArray(e)?e.reverse():e.split("").reverse().join("");function Hy(e){var t;return e===0?t=1:t=Math.floor(new V(e).abs().log(10).toNumber())+1,t}function Yy(e,t,r){for(var n=new V(e),i=0,a=[];n.lt(t)&&i<1e5;)a.push(n.toNumber()),n=n.add(r),i++;return a}var Gy=e=>{var[t,r]=e,[n,i]=[t,r];return t>r&&([n,i]=[r,t]),[n,i]},Vy=(e,t,r)=>{if(e.lte(0))return new V(0);var n=Hy(e.toNumber()),i=new V(10).pow(n),a=e.div(i),o=n!==1?.05:.1,u=new V(Math.ceil(a.div(o).toNumber())).add(r).mul(o),l=u.mul(i);return t?new V(l.toNumber()):new V(Math.ceil(l.toNumber()))},XE=(e,t,r)=>{var n=new V(1),i=new V(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new V(10).pow(Hy(e)-1),i=new V(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new V(Math.floor(e)))}else e===0?i=new V(Math.floor((t-1)/2)):r||(i=new V(Math.floor(e)));var o=Math.floor((t-1)/2),u=VE(GE(l=>i.add(new V(l-o).mul(n)).toNumber()),gl);return u(0,t)},Xy=function(t,r,n,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((r-t)/(n-1)))return{step:new V(0),tickMin:new V(0),tickMax:new V(0)};var o=Vy(new V(r).sub(t).div(n-1),i,a),u;t<=0&&r>=0?u=new V(0):(u=new V(t).add(r).div(2),u=u.sub(new V(u).mod(o)));var l=Math.ceil(u.sub(t).div(o).toNumber()),s=Math.ceil(new V(r).sub(u).div(o).toNumber()),c=l+s+1;return c>n?Xy(t,r,n,i,a+1):(c0?s+(n-c):s,l=r>0?l:l+(n-c)),{step:o,tickMin:u.sub(new V(l).mul(o)),tickMax:u.add(new V(s).mul(o))})},ZE=function(t){var[r,n]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[u,l]=Gy([r,n]);if(u===-1/0||l===1/0){var s=l===1/0?[u,...gl(0,i-1).map(()=>1/0)]:[...gl(0,i-1).map(()=>-1/0),l];return r>n?bl(s):s}if(u===l)return XE(u,i,a);var{step:c,tickMin:f,tickMax:d}=Xy(u,l,o,a,0),v=Yy(f,d.add(new V(.1).mul(c)),c);return r>n?bl(v):v},QE=function(t,r){var[n,i]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,u]=Gy([n,i]);if(o===-1/0||u===1/0)return[n,i];if(o===u)return[o];var l=Math.max(r,2),s=Vy(new V(u).sub(o).div(l-1),a,0),c=[...Yy(new V(o),new V(u),s),u];return a===!1&&(c=c.map(f=>Math.round(f))),n>i?bl(c):c},Zy=e=>e.rootProps.maxBarSize,JE=e=>e.rootProps.barGap,Qy=e=>e.rootProps.barCategoryGap,e_=e=>e.rootProps.barSize,Bn=e=>e.rootProps.stackOffset,Jy=e=>e.rootProps.reverseStackOrder,Nc=e=>e.options.chartName,$c=e=>e.rootProps.syncId,eg=e=>e.rootProps.syncMethod,Rc=e=>e.options.eventEmitter,ve={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},At={allowDuplicatedCategory:!0,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"category"},Ye={allowDataOverflow:!1,allowDuplicatedCategory:!0,radiusAxisId:0,scale:"auto",tick:!0,tickCount:5,type:"number"},za=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t},t_={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:At.angleAxisId,includeHidden:!1,name:void 0,reversed:At.reversed,scale:At.scale,tick:At.tick,tickCount:void 0,ticks:void 0,type:At.type,unit:void 0},r_={allowDataOverflow:Ye.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Ye.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Ye.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Ye.scale,tick:Ye.tick,tickCount:Ye.tickCount,ticks:void 0,type:Ye.type,unit:void 0},n_={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:At.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:At.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:At.scale,tick:At.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},i_={allowDataOverflow:Ye.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Ye.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Ye.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Ye.scale,tick:Ye.tick,tickCount:Ye.tickCount,ticks:void 0,type:"category",unit:void 0},Lc=(e,t)=>e.polarAxis.angleAxis[t]!=null?e.polarAxis.angleAxis[t]:e.layout.layoutType==="radial"?n_:t_,zc=(e,t)=>e.polarAxis.radiusAxis[t]!=null?e.polarAxis.radiusAxis[t]:e.layout.layoutType==="radial"?i_:r_,Ba=e=>e.polarOptions,Bc=A([Rt,Lt,ye],Xm),tg=A([Ba,Bc],(e,t)=>{if(e!=null)return Ie(e.innerRadius,t,0)}),rg=A([Ba,Bc],(e,t)=>{if(e!=null)return Ie(e.outerRadius,t,t*.8)}),a_=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]},ng=A([Ba],a_);A([Lc,ng],za);var ig=A([Bc,tg,rg],(e,t,r)=>{if(!(e==null||t==null||r==null))return[t,r]});A([zc,ig],za);var ag=A([q,Ba,tg,rg,Rt,Lt],(e,t,r,n,i,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||r==null||n==null)){var{cx:o,cy:u,startAngle:l,endAngle:s}=t;return{cx:Ie(o,i,i/2),cy:Ie(u,a,a/2),innerRadius:r,outerRadius:n,startAngle:l,endAngle:s,clockWise:!1}}}),oe=(e,t)=>t,Fn=(e,t,r)=>r;function Fc(e){return e?.id}function og(e,t,r){var{chartData:n=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=r,o=new Map;return e.forEach(u=>{var l,s=(l=u.data)!==null&&l!==void 0?l:n;if(!(s==null||s.length===0)){var c=Fc(u);s.forEach((f,d)=>{var v=a==null||i?d:String(X(f,a,null)),p=X(f,u.dataKey,0),y;o.has(v)?y=o.get(v):y={},Object.assign(y,{[c]:p}),o.set(v,y)})}}),Array.from(o.values())}function Fa(e){return e.stackId!=null&&e.dataKey!=null}var Ka=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function qa(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function o_(e,t){if(e.length===t.length){for(var r=0;r{var t=q(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},Wr=e=>e.tooltip.settings.axisId;function Rv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Qi(e){for(var t=1;te.cartesianAxis.xAxis[t],Bt=(e,t)=>{var r=ug(e,t);return r??xe},Pe={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:wl,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:Cn},lg=(e,t)=>e.cartesianAxis.yAxis[t],Ft=(e,t)=>{var r=lg(e,t);return r??Pe},s_={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},Kc=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return r??s_},ue=(e,t,r)=>{switch(t){case"xAxis":return Bt(e,r);case"yAxis":return Ft(e,r);case"zAxis":return Kc(e,r);case"angleAxis":return Lc(e,r);case"radiusAxis":return zc(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},f_=(e,t,r)=>{switch(t){case"xAxis":return Bt(e,r);case"yAxis":return Ft(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},Kn=(e,t,r)=>{switch(t){case"xAxis":return Bt(e,r);case"yAxis":return Ft(e,r);case"angleAxis":return Lc(e,r);case"radiusAxis":return zc(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},cg=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function qc(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var Wa=e=>e.graphicalItems.cartesianItems,d_=A([oe,Fn],qc),Wc=(e,t,r)=>e.filter(r).filter(n=>t?.includeHidden===!0?!0:!n.hide),qn=A([Wa,ue,d_],Wc,{memoizeOptions:{resultEqualityCheck:qa}}),sg=A([qn],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(Fa)),fg=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),v_=A([qn],fg),Uc=e=>e.map(t=>t.data).filter(Boolean).flat(1),h_=A([qn],Uc,{memoizeOptions:{resultEqualityCheck:qa}}),Hc=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:i}=t;return e.length>0?e:r.slice(n,i+1)},Yc=A([h_,La],Hc),Gc=(e,t,r)=>t?.dataKey!=null?e.map(n=>({value:X(n,t.dataKey)})):r.length>0?r.map(n=>n.dataKey).flatMap(n=>e.map(i=>({value:X(i,n)}))):e.map(n=>({value:n})),Ua=A([Yc,ue,qn],Gc);function dg(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function gi(e){if(bt(e)||e instanceof Date){var t=Number(e);if(se(t))return t}}function Lv(e){if(Array.isArray(e)){var t=[gi(e[0]),gi(e[1])];return Yt(t)?t:void 0}var r=gi(e);if(r!=null)return[r,r]}function Nt(e){return e.map(gi).filter(lw)}function p_(e,t,r){return!r||typeof t!="number"||dt(t)?[]:r.length?Nt(r.flatMap(n=>{var i=X(e,n.dataKey),a,o;if(Array.isArray(i)?[a,o]=i:a=o=i,!(!se(a)||!se(o)))return[t-a,t+o]})):[]}var we=e=>{var t=be(e),r=Wr(e);return Kn(e,t,r)},Wn=A([we],e=>e?.dataKey),m_=A([sg,La,we],og),vg=(e,t,r,n)=>{var i={},a=t.reduce((o,u)=>(u.stackId==null||(o[u.stackId]==null&&(o[u.stackId]=[]),o[u.stackId].push(u)),o),i);return Object.fromEntries(Object.entries(a).map(o=>{var[u,l]=o,s=n?[...l].reverse():l,c=s.map(Fc);return[u,{stackedData:CP(e,c,r),graphicalItems:s}]}))},xl=A([m_,sg,Bn,Jy],vg),hg=(e,t,r,n)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(n==null&&r!=="zAxis"){var o=NP(e,i,a);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},y_=A([ue],e=>e.allowDataOverflow),Vc=e=>{var t;if(e==null||!("domain"in e))return wl;if(e.domain!=null)return e.domain;if(e.ticks!=null){if(e.type==="number"){var r=Nt(e.ticks);return[Math.min(...r),Math.max(...r)]}if(e.type==="category")return e.ticks.map(String)}return(t=e?.domain)!==null&&t!==void 0?t:wl},Xc=A([ue],Vc),Zc=A([Xc,y_],Ry),g_=A([xl,rr,oe,Zc],hg,{memoizeOptions:{resultEqualityCheck:Ka}}),Ha=e=>e.errorBars,b_=(e,t,r)=>e.flatMap(n=>t[n.id]).filter(Boolean).filter(n=>dg(r,n)),Ji=function(){for(var t=arguments.length,r=new Array(t),n=0;n{var a,o;if(r.length>0&&e.forEach(u=>{r.forEach(l=>{var s,c,f=(s=n[l.id])===null||s===void 0?void 0:s.filter(g=>dg(i,g)),d=X(u,(c=t.dataKey)!==null&&c!==void 0?c:l.dataKey),v=p_(u,d,f);if(v.length>=2){var p=Math.min(...v),y=Math.max(...v);(a==null||po)&&(o=y)}var m=Lv(d);m!=null&&(a=a==null?m[0]:Math.min(a,m[0]),o=o==null?m[1]:Math.max(o,m[1]))})}),t?.dataKey!=null&&e.forEach(u=>{var l=Lv(X(u,t.dataKey));l!=null&&(a=a==null?l[0]:Math.min(a,l[0]),o=o==null?l[1]:Math.max(o,l[1]))}),se(a)&&se(o))return[a,o]},w_=A([Yc,ue,v_,Ha,oe],Qc,{memoizeOptions:{resultEqualityCheck:Ka}});function x_(e){var{value:t}=e;if(bt(t)||t instanceof Date)return t}var P_=(e,t,r)=>{var n=e.map(x_).filter(i=>i!=null);return r&&(t.dataKey==null||t.allowDuplicatedCategory&&jp(n))?ey(0,e.length):t.allowDuplicatedCategory?n:Array.from(new Set(n))},pg=e=>e.referenceElements.dots,Ur=(e,t,r)=>e.filter(n=>n.ifOverflow==="extendDomain").filter(n=>t==="xAxis"?n.xAxisId===r:n.yAxisId===r),O_=A([pg,oe,Fn],Ur),mg=e=>e.referenceElements.areas,A_=A([mg,oe,Fn],Ur),yg=e=>e.referenceElements.lines,S_=A([yg,oe,Fn],Ur),gg=(e,t)=>{var r=Nt(e.map(n=>t==="xAxis"?n.x:n.y));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},E_=A(O_,oe,gg),bg=(e,t)=>{var r=Nt(e.flatMap(n=>[t==="xAxis"?n.x1:n.y1,t==="xAxis"?n.x2:n.y2]));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},__=A([A_,oe],bg);function k_(e){var t;if(e.x!=null)return Nt([e.x]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.x);return r==null||r.length===0?[]:Nt(r)}function j_(e){var t;if(e.y!=null)return Nt([e.y]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.y);return r==null||r.length===0?[]:Nt(r)}var wg=(e,t)=>{var r=e.flatMap(n=>t==="xAxis"?k_(n):j_(n));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},C_=A([S_,oe],wg),I_=A(E_,C_,__,(e,t,r)=>Ji(e,r,t)),Jc=(e,t,r,n,i,a,o,u)=>{if(r!=null)return r;var l=o==="vertical"&&u==="xAxis"||o==="horizontal"&&u==="yAxis",s=l?Ji(n,a,i):Ji(a,i);return KE(t,s,e.allowDataOverflow)},M_=A([ue,Xc,Zc,g_,w_,I_,q,oe],Jc,{memoizeOptions:{resultEqualityCheck:Ka}}),T_=[0,1],es=(e,t,r,n,i,a,o)=>{if(!((e==null||r==null||r.length===0)&&o===void 0)){var{dataKey:u,type:l}=e,s=Jt(t,a);if(s&&u==null){var c;return ey(0,(c=r?.length)!==null&&c!==void 0?c:0)}return l==="category"?P_(n,e,s):i==="expand"?T_:o}},ts=A([ue,q,Yc,Ua,Bn,oe,M_],es),xg=(e,t,r,n,i)=>{if(e!=null){var{scale:a,type:o}=e;if(a==="auto")return t==="radial"&&i==="radiusAxis"?"band":t==="radial"&&i==="angleAxis"?"linear":o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?"point":o==="category"?"band":"linear";if(typeof a=="string"){var u="scale".concat(An(a));return u in un?u:"point"}}},Hr=A([ue,q,cg,Nc,oe],xg);function D_(e){if(e!=null){if(e in un)return un[e]();var t="scale".concat(An(e));if(t in un)return un[t]()}}function rs(e,t,r,n){if(!(r==null||n==null)){if(typeof e.scale=="function")return e.scale.copy().domain(r).range(n);var i=D_(t);if(i!=null){var a=i.domain(r).range(n);return SP(a),a}}}var ns=(e,t,r)=>{var n=Vc(t);if(!(r!=="auto"&&r!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(n)&&(n[0]==="auto"||n[1]==="auto")&&Yt(e))return ZE(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Yt(e))return QE(e,t.tickCount,t.allowDecimals)}},is=A([ts,Kn,Hr],ns),as=(e,t,r,n)=>{if(n!=="angleAxis"&&e?.type==="number"&&Yt(t)&&Array.isArray(r)&&r.length>0){var i=t[0],a=r[0],o=t[1],u=r[r.length-1];return[Math.min(i,a),Math.max(o,u)]}return t},N_=A([ue,ts,is,oe],as),$_=A(Ua,ue,(e,t)=>{if(!(!t||t.type!=="number")){var r=1/0,n=Array.from(Nt(e.map(u=>u.value))).sort((u,l)=>u-l);if(n.length<2)return 1/0;var i=n[n.length-1]-n[0];if(i===0)return 1/0;for(var a=0;an,(e,t,r,n,i)=>{if(!se(e))return 0;var a=t==="vertical"?n.height:n.width;if(i==="gap")return e*a/2;if(i==="no-gap"){var o=Ie(r,e*a),u=e*a/2;return u-o-(u-o)/a*o}return 0}),R_=(e,t)=>{var r=Bt(e,t);return r==null||typeof r.padding!="string"?0:Pg(e,"xAxis",t,r.padding)},L_=(e,t)=>{var r=Ft(e,t);return r==null||typeof r.padding!="string"?0:Pg(e,"yAxis",t,r.padding)},z_=A(Bt,R_,(e,t)=>{var r,n;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((r=i.left)!==null&&r!==void 0?r:0)+t,right:((n=i.right)!==null&&n!==void 0?n:0)+t}}),B_=A(Ft,L_,(e,t)=>{var r,n;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((r=i.top)!==null&&r!==void 0?r:0)+t,bottom:((n=i.bottom)!==null&&n!==void 0?n:0)+t}}),F_=A([ye,z_,Ea,Sa,(e,t,r)=>r],(e,t,r,n,i)=>{var{padding:a}=n;return i?[a.left,r.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),K_=A([ye,q,B_,Ea,Sa,(e,t,r)=>r],(e,t,r,n,i,a)=>{var{padding:o}=i;return a?[n.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),Un=(e,t,r,n)=>{var i;switch(t){case"xAxis":return F_(e,r,n);case"yAxis":return K_(e,r,n);case"zAxis":return(i=Kc(e,r))===null||i===void 0?void 0:i.range;case"angleAxis":return ng(e);case"radiusAxis":return ig(e,r);default:return}},Og=A([ue,Un],za),Yr=A([ue,Hr,N_,Og],rs);A([qn,Ha,oe],b_);function Ag(e,t){return e.idt.id?1:0}var Ya=(e,t)=>t,Ga=(e,t,r)=>r,q_=A(Oa,Ya,Ga,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(Ag)),W_=A(Aa,Ya,Ga,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(Ag)),Sg=(e,t)=>({width:e.width,height:t.height}),U_=(e,t)=>{var r=typeof t.width=="number"?t.width:Cn;return{width:r,height:e.height}},Eg=A(ye,Bt,Sg),H_=(e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}},Y_=(e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}},G_=A(Lt,ye,q_,Ya,Ga,(e,t,r,n,i)=>{var a={},o;return r.forEach(u=>{var l=Sg(t,u);o==null&&(o=H_(t,n,e));var s=n==="top"&&!i||n==="bottom"&&i;a[u.id]=o-Number(s)*l.height,o+=(s?-1:1)*l.height}),a}),V_=A(Rt,ye,W_,Ya,Ga,(e,t,r,n,i)=>{var a={},o;return r.forEach(u=>{var l=U_(t,u);o==null&&(o=Y_(t,n,e));var s=n==="left"&&!i||n==="right"&&i;a[u.id]=o-Number(s)*l.width,o+=(s?-1:1)*l.width}),a}),X_=(e,t)=>{var r=Bt(e,t);if(r!=null)return G_(e,r.orientation,r.mirror)},Z_=A([ye,Bt,X_,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var i=r?.[n];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),Q_=(e,t)=>{var r=Ft(e,t);if(r!=null)return V_(e,r.orientation,r.mirror)},J_=A([ye,Ft,Q_,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var i=r?.[n];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),_g=A(ye,Ft,(e,t)=>{var r=typeof t.width=="number"?t.width:Cn;return{width:r,height:e.height}}),zv=(e,t,r)=>{switch(t){case"xAxis":return Eg(e,r).width;case"yAxis":return _g(e,r).height;default:return}},kg=(e,t,r,n)=>{if(r!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=r,u=Jt(e,n),l=t.map(s=>s.value);if(o&&u&&a==="category"&&i&&jp(l))return l}},os=A([q,Ua,ue,oe],kg),jg=(e,t,r,n)=>{if(!(r==null||r.dataKey==null)){var{type:i,scale:a}=r,o=Jt(e,n);if(o&&(i==="number"||a!=="auto"))return t.map(u=>u.value)}},us=A([q,Ua,Kn,oe],jg),Bv=A([q,f_,Hr,Yr,os,us,Un,is,oe],(e,t,r,n,i,a,o,u,l)=>{if(t!=null){var s=Jt(e,l);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:l,categoricalDomain:a,duplicateDomain:i,isCategorical:s,niceTicks:u,range:o,realScaleType:r,scale:n}}}),ek=(e,t,r,n,i,a,o,u,l)=>{if(!(t==null||n==null)){var s=Jt(e,l),{type:c,ticks:f,tickCount:d}=t,v=r==="scaleBand"&&typeof n.bandwidth=="function"?n.bandwidth()/2:2,p=c==="category"&&n.bandwidth?n.bandwidth()/v:0;p=l==="angleAxis"&&a!=null&&a.length>=2?Ae(a[0]-a[1])*2*p:p;var y=f||i;if(y){var m=y.map((g,x)=>{var w=o?o.indexOf(g):g;return{index:x,coordinate:n(w)+p,value:g,offset:p}});return m.filter(g=>se(g.coordinate))}return s&&u?u.map((g,x)=>({coordinate:n(g)+p,value:g,index:x,offset:p})).filter(g=>se(g.coordinate)):n.ticks?n.ticks(d).map(g=>({coordinate:n(g)+p,value:g,offset:p})):n.domain().map((g,x)=>({coordinate:n(g)+p,value:o?o[g]:g,index:x,offset:p}))}},Cg=A([q,Kn,Hr,Yr,is,Un,os,us,oe],ek),tk=(e,t,r,n,i,a,o)=>{if(!(t==null||r==null||n==null||n[0]===n[1])){var u=Jt(e,o),{tickCount:l}=t,s=0;return s=o==="angleAxis"&&n?.length>=2?Ae(n[0]-n[1])*2*s:s,u&&a?a.map((c,f)=>({coordinate:r(c)+s,value:c,index:f,offset:s})):r.ticks?r.ticks(l).map(c=>({coordinate:r(c)+s,value:c,offset:s})):r.domain().map((c,f)=>({coordinate:r(c)+s,value:i?i[c]:c,index:f,offset:s}))}},Gt=A([q,Kn,Yr,Un,os,us,oe],tk),Vt=A(ue,Yr,(e,t)=>{if(!(e==null||t==null))return Qi(Qi({},e),{},{scale:t})}),rk=A([ue,Hr,ts,Og],rs);A((e,t,r)=>Kc(e,r),rk,(e,t)=>{if(!(e==null||t==null))return Qi(Qi({},e),{},{scale:t})});var nk=A([q,Oa,Aa],(e,t,r)=>{switch(e){case"horizontal":return t.some(n=>n.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(n=>n.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),Ig=e=>e.options.defaultTooltipEventType,Mg=e=>e.options.validateTooltipEventTypes;function Tg(e,t,r){if(e==null)return t;var n=e?"axis":"item";return r==null?t:r.includes(n)?n:t}function ls(e,t){var r=Ig(e),n=Mg(e);return Tg(t,r,n)}function ik(e){return T(t=>ls(t,e))}var Dg=(e,t)=>{var r,n=Number(t);if(!(dt(n)||t==null))return n>=0?e==null||(r=e[n])===null||r===void 0?void 0:r.value:void 0},ak=e=>e.tooltip.settings,Ut={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},ok={itemInteraction:{click:Ut,hover:Ut},axisInteraction:{click:Ut,hover:Ut},keyboardInteraction:Ut,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},Ng=qe({name:"tooltip",initialState:ok,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:re()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:r,next:n}=t.payload,i=ft(e).tooltipItemPayloads.indexOf(r);i>-1&&(e.tooltipItemPayloads[i]=n)},prepare:re()},removeTooltipEntrySettings:{reducer(e,t){var r=ft(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:re()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate,e.keyboardInteraction.dataKey=t.payload.activeDataKey}}}),{addTooltipEntrySettings:uk,replaceTooltipEntrySettings:lk,removeTooltipEntrySettings:ck,setTooltipSettingsState:sk,setActiveMouseOverItemIndex:$g,mouseLeaveItem:fk,mouseLeaveChart:Rg,setActiveClickItemIndex:dk,setMouseOverAxisIndex:Lg,setMouseClickAxisIndex:vk,setSyncInteraction:Pl,setKeyboardInteraction:Ol}=Ng.actions,hk=Ng.reducer;function Fv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function fi(e){for(var t=1;t{if(t==null)return Ut;var i=gk(e,t,r);if(i==null)return Ut;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(bk(i)){if(a)return fi(fi({},i),{},{active:!0})}else if(n!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return fi(fi({},Ut),{},{coordinate:i.coordinate})};function wk(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var r=Number(e);return Number.isFinite(r)?r:void 0}function xk(e,t){var r=wk(e),n=t[0],i=t[1];if(r===void 0)return!1;var a=Math.min(n,i),o=Math.max(n,i);return r>=a&&r<=o}function Pk(e,t,r){if(r==null||t==null)return!0;var n=X(e,t);return n==null||!Yt(r)?!0:xk(n,r)}var cs=(e,t,r,n)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!se(a))return i;var o=0,u=1/0;t.length>0&&(u=t.length-1);var l=Math.max(o,Math.min(a,u)),s=t[l];return s==null||Pk(s,r,n)?String(l):null},Bg=(e,t,r,n,i,a,o,u)=>{if(!(a==null||u==null)){var l=o[0],s=l==null?void 0:u(l.positions,a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(r){case"horizontal":return{x:c.coordinate,y:(n.top+t)/2};default:return{x:(n.left+e)/2,y:c.coordinate}}}},Fg=(e,t,r,n)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;return r==="hover"?i=e.itemInteraction.hover.dataKey:i=e.itemInteraction.click.dataKey,i==null&&n!=null?[e.tooltipItemPayloads[0]]:e.tooltipItemPayloads.filter(a=>{var o;return((o=a.settings)===null||o===void 0?void 0:o.dataKey)===i})},Hn=e=>e.options.tooltipPayloadSearcher,Gr=e=>e.tooltip;function Kv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qv(e){for(var t=1;t{if(!(t==null||a==null)){var{chartData:u,computedData:l,dataStartIndex:s,dataEndIndex:c}=r,f=[];return e.reduce((d,v)=>{var p,{dataDefinedOnItem:y,settings:m}=v,g=Ek(y,u),x=Array.isArray(g)?Om(g,s,c):g,w=(p=m?.dataKey)!==null&&p!==void 0?p:n,P=m?.nameKey,b;if(n&&Array.isArray(x)&&!Array.isArray(x[0])&&o==="axis"?b=Cp(x,n,i):b=a(x,t,l,P),Array.isArray(b))b.forEach(S=>{var _=qv(qv({},m),{},{name:S.name,unit:S.unit,color:void 0,fill:void 0});d.push(ud({tooltipEntrySettings:_,dataKey:S.dataKey,payload:S.payload,value:X(S.payload,S.dataKey),name:S.name}))});else{var O;d.push(ud({tooltipEntrySettings:m,dataKey:w,payload:b,value:X(b,w),name:(O=X(b,P))!==null&&O!==void 0?O:m?.name}))}return d},f)}},ss=A([we,q,cg,Nc,be],xg),_k=A([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),kk=A([be,Wr],qc),Yn=A([_k,we,kk],Wc,{memoizeOptions:{resultEqualityCheck:qa}}),jk=A([Yn],e=>e.filter(Fa)),Ck=A([Yn],Uc,{memoizeOptions:{resultEqualityCheck:qa}}),Vr=A([Ck,rr],Hc),Ik=A([jk,rr,we],og),fs=A([Vr,we,Yn],Gc),qg=A([we],Vc),Mk=A([we],e=>e.allowDataOverflow),Wg=A([qg,Mk],Ry),Tk=A([Yn],e=>e.filter(Fa)),Dk=A([Ik,Tk,Bn,Jy],vg),Nk=A([Dk,rr,be,Wg],hg),$k=A([Yn],fg),Rk=A([Vr,we,$k,Ha,be],Qc,{memoizeOptions:{resultEqualityCheck:Ka}}),Lk=A([pg,be,Wr],Ur),zk=A([Lk,be],gg),Bk=A([mg,be,Wr],Ur),Fk=A([Bk,be],bg),Kk=A([yg,be,Wr],Ur),qk=A([Kk,be],wg),Wk=A([zk,qk,Fk],Ji),Uk=A([we,qg,Wg,Nk,Rk,Wk,q,be],Jc),Gn=A([we,q,Vr,fs,Bn,be,Uk],es),Hk=A([Gn,we,ss],ns),Yk=A([we,Gn,Hk,be],as),Ug=e=>{var t=be(e),r=Wr(e),n=!1;return Un(e,t,r,n)},Hg=A([we,Ug],za),Yg=A([we,ss,Yk,Hg],rs),Gk=A([q,fs,we,be],kg),Vk=A([q,fs,we,be],jg),Xk=(e,t,r,n,i,a,o,u)=>{if(t){var{type:l}=t,s=Jt(e,u);if(n){var c=r==="scaleBand"&&n.bandwidth?n.bandwidth()/2:2,f=l==="category"&&n.bandwidth?n.bandwidth()/c:0;return f=u==="angleAxis"&&i!=null&&i?.length>=2?Ae(i[0]-i[1])*2*f:f,s&&o?o.map((d,v)=>({coordinate:n(d)+f,value:d,index:v,offset:f})):n.domain().map((d,v)=>({coordinate:n(d)+f,value:a?a[d]:d,index:v,offset:f}))}}},Kt=A([q,we,ss,Yg,Ug,Gk,Vk,be],Xk),ds=A([Ig,Mg,ak],(e,t,r)=>Tg(r.shared,e,t)),Gg=e=>e.tooltip.settings.trigger,vs=e=>e.tooltip.settings.defaultIndex,Vn=A([Gr,ds,Gg,vs],zg),Xt=A([Vn,Vr,Wn,Gn],cs),Vg=A([Kt,Xt],Dg),hs=A([Vn],e=>{if(e)return e.dataKey}),Zk=A([Vn],e=>{if(e)return e.graphicalItemId}),Xg=A([Gr,ds,Gg,vs],Fg),Qk=A([Rt,Lt,q,ye,Kt,vs,Xg,Hn],Bg),Jk=A([Vn,Qk],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),ej=A([Vn],e=>e.active),tj=A([Xg,Xt,rr,Wn,Vg,Hn,ds],Kg),rj=A([tj],e=>{if(e!=null){var t=e.map(r=>r.payload).filter(r=>r!=null);return Array.from(new Set(t))}});function Wv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Uv(e){for(var t=1;tT(we),uj=()=>{var e=oj(),t=T(Kt),r=T(Yg);return Dr(!e||!r?void 0:Uv(Uv({},e),{},{scale:r}),t)};function Hv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ar(e){for(var t=1;t{var i=t.find(a=>a&&a.index===r);if(i){if(e==="horizontal")return{x:i.coordinate,y:n.chartY};if(e==="vertical")return{x:n.chartX,y:i.coordinate}}return{x:0,y:0}},dj=(e,t,r,n)=>{var i=t.find(s=>s&&s.index===r);if(i){if(e==="centric"){var a=i.coordinate,{radius:o}=n;return Ar(Ar(Ar({},n),de(n.cx,n.cy,o,a)),{},{angle:a,radius:o})}var u=i.coordinate,{angle:l}=n;return Ar(Ar(Ar({},n),de(n.cx,n.cy,u,l)),{},{angle:l,radius:u})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function vj(e,t){var{chartX:r,chartY:n}=e;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}var Zg=(e,t,r,n,i)=>{var a,o=-1,u=(a=t?.length)!==null&&a!==void 0?a:0;if(u<=1||e==null)return 0;if(n==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?r[l-1].coordinate:r[u-1].coordinate,c=r[l].coordinate,f=l>=u-1?r[0].coordinate:r[l+1].coordinate,d=void 0;if(Ae(c-s)!==Ae(f-c)){var v=[];if(Ae(f-c)===Ae(i[1]-i[0])){d=f;var p=c+i[1]-i[0];v[0]=Math.min(p,(p+s)/2),v[1]=Math.max(p,(p+s)/2)}else{d=s;var y=f+i[1]-i[0];v[0]=Math.min(c,(y+c)/2),v[1]=Math.max(c,(y+c)/2)}var m=[Math.min(c,(d+c)/2),Math.max(c,(d+c)/2)];if(e>m[0]&&e<=m[1]||e>=v[0]&&e<=v[1]){({index:o}=r[l]);break}}else{var g=Math.min(s,f),x=Math.max(s,f);if(e>(g+c)/2&&e<=(x+c)/2){({index:o}=r[l]);break}}}else if(t){for(var w=0;w0&&w(t[w].coordinate+t[w-1].coordinate)/2&&e<=(t[w].coordinate+t[w+1].coordinate)/2||w===u-1&&e>(t[w].coordinate+t[w-1].coordinate)/2){({index:o}=t[w]);break}}return o},hj=()=>T(Nc),ps=(e,t)=>t,Qg=(e,t,r)=>r,ms=(e,t,r,n)=>n,pj=A(Kt,e=>ha(e,t=>t.coordinate)),ys=A([Gr,ps,Qg,ms],zg),gs=A([ys,Vr,Wn,Gn],cs),mj=(e,t,r)=>{if(t!=null){var n=Gr(e);return t==="axis"?r==="hover"?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:r==="hover"?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}},Jg=A([Gr,ps,Qg,ms],Fg),ea=A([Rt,Lt,q,ye,Kt,ms,Jg,Hn],Bg),yj=A([ys,ea],(e,t)=>{var r;return(r=e.coordinate)!==null&&r!==void 0?r:t}),e0=A([Kt,gs],Dg),gj=A([Jg,gs,rr,Wn,e0,Hn,ps],Kg),bj=A([ys,gs],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),wj=(e,t,r,n,i,a,o)=>{if(!(!e||!r||!n||!i)&&vj(e,o)){var u=$P(e,t),l=Zg(u,a,i,r,n),s=fj(t,i,l,e);return{activeIndex:String(l),activeCoordinate:s}}},xj=(e,t,r,n,i,a,o)=>{if(!(!e||!n||!i||!a||!r)){var u=J1(e,r);if(u){var l=RP(u,t),s=Zg(l,o,a,n,i),c=dj(t,a,s,u);return{activeIndex:String(s),activeCoordinate:c}}}},Pj=(e,t,r,n,i,a,o,u)=>{if(!(!e||!t||!n||!i||!a))return t==="horizontal"||t==="vertical"?wj(e,t,n,i,a,o,u):xj(e,t,r,n,i,a,o)},Oj=A(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(t!=null){var n=e[t];if(n!=null)return r?n.panoramaElementId:n.elementId}}),Aj=A(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(n=>parseInt(n,10)).concat(Object.values(ve)),r=Array.from(new Set(t));return r.sort((n,i)=>n-i)},{memoizeOptions:{resultEqualityCheck:o_}});function Yv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Gv(e){for(var t=1;tGv(Gv({},e),{},{[t]:{elementId:void 0,panoramaElementId:void 0,consumers:0}}),kj)},Cj=new Set(Object.values(ve));function Ij(e){return Cj.has(e)}var t0=qe({name:"zIndex",initialState:jj,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,elementId:void 0,panoramaElementId:void 0}},prepare:re()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!Ij(r)&&delete e.zIndexMap[r])},prepare:re()},registerZIndexPortalId:{reducer:(e,t)=>{var{zIndex:r,elementId:n,isPanorama:i}=t.payload;e.zIndexMap[r]?i?e.zIndexMap[r].panoramaElementId=n:e.zIndexMap[r].elementId=n:e.zIndexMap[r]={consumers:0,elementId:i?void 0:n,panoramaElementId:i?n:void 0}},prepare:re()},unregisterZIndexPortalId:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElementId=void 0:e.zIndexMap[r].elementId=void 0)},prepare:re()}}}),{registerZIndexPortal:Mj,unregisterZIndexPortal:Tj,registerZIndexPortalId:Dj,unregisterZIndexPortalId:Nj}=t0.actions,$j=t0.reducer;function We(e){var{zIndex:t,children:r}=e,n=hO(),i=n&&t!==void 0&&t!==0,a=Me(),o=ee();h.useLayoutEffect(()=>i?(o(Mj({zIndex:t})),()=>{o(Tj({zIndex:t}))}):Sn,[o,t,i]);var u=T(s=>Oj(s,t,a));if(!i)return r;if(!u)return null;var l=document.getElementById(u);return l?Nl.createPortal(r,l):null}function Al(){return Al=Object.assign?Object.assign.bind():function(e){for(var t=1;th.useContext(r0),yu={exports:{}},Xv;function Wj(){return Xv||(Xv=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(l,s,c){this.fn=l,this.context=s,this.once=c||!1}function a(l,s,c,f,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,f||l,d),p=r?r+s:s;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],v]:l._events[p].push(v):(l._events[p]=v,l._eventsCount++),l}function o(l,s){--l._eventsCount===0?l._events=new n:delete l._events[s]}function u(){this._events=new n,this._eventsCount=0}u.prototype.eventNames=function(){var s=[],c,f;if(this._eventsCount===0)return s;for(f in c=this._events)t.call(c,f)&&s.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(c)):s},u.prototype.listeners=function(s){var c=r?r+s:s,f=this._events[c];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,v=f.length,p=new Array(v);d{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Gj=n0.reducer,{createEventEmitter:Vj}=n0.actions;function Xj(e){return e.tooltip.syncInteraction}var Zj={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},i0=qe({name:"chartData",initialState:Zj,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:r,endIndex:n}=t.payload;r!=null&&(e.dataStartIndex=r),n!=null&&(e.dataEndIndex=n)}}}),{setChartData:Qv,setDataStartEndIndexes:Qj,setComputedData:N$}=i0.actions,Jj=i0.reducer,eC=["x","y"];function Jv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Sr(e){for(var t=1;tl.rootProps.className);h.useEffect(()=>{if(e==null)return Sn;var l=(s,c,f)=>{if(t!==f&&e===s){if(n==="index"){var d;if(o&&c!==null&&c!==void 0&&(d=c.payload)!==null&&d!==void 0&&d.coordinate&&c.payload.sourceViewBox){var v=c.payload.coordinate,{x:p,y}=v,m=iC(v,eC),{x:g,y:x,width:w,height:P}=c.payload.sourceViewBox,b=Sr(Sr({},m),{},{x:o.x+(w?(p-g)/w:0)*o.width,y:o.y+(P?(y-x)/P:0)*o.height});r(Sr(Sr({},c),{},{payload:Sr(Sr({},c.payload),{},{coordinate:b})}))}else r(c);return}if(i!=null){var O;if(typeof n=="function"){var S={activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate},_=n(i,S);O=i[_]}else n==="value"&&(O=i.find(K=>String(K.value)===c.payload.label));var{coordinate:I}=c.payload;if(O==null||c.payload.active===!1||I==null||o==null){r(Pl({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:M,y:E}=I,j=Math.min(M,o.x+o.width),$=Math.min(E,o.y+o.height),L={x:a==="horizontal"?O.coordinate:j,y:a==="horizontal"?$:O.coordinate},z=Pl({active:c.payload.active,coordinate:L,dataKey:c.payload.dataKey,index:String(O.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId});r(z)}}};return Pn.on(Sl,l),()=>{Pn.off(Sl,l)}},[u,r,t,e,n,i,a,o])}function uC(){var e=T($c),t=T(Rc),r=ee();h.useEffect(()=>{if(e==null)return Sn;var n=(i,a,o)=>{t!==o&&e===i&&r(Qj(a))};return Pn.on(Zv,n),()=>{Pn.off(Zv,n)}},[r,t,e])}function lC(){var e=ee();h.useEffect(()=>{e(Vj())},[e]),oC(),uC()}function cC(e,t,r,n,i,a){var o=T(v=>mj(v,e,t)),u=T(Rc),l=T($c),s=T(eg),c=T(Xj),f=c?.active,d=_a();h.useEffect(()=>{if(!f&&l!=null&&u!=null){var v=Pl({active:a,coordinate:r,dataKey:o,index:i,label:typeof n=="number"?String(n):n,sourceViewBox:d,graphicalItemId:void 0});Pn.emit(Sl,l,v,u)}},[f,r,o,i,n,u,l,s,a,d])}function eh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function th(e){for(var t=1;t{S(sk({shared:x,trigger:w,axisId:O,active:i,defaultIndex:_}))},[S,x,w,O,i,_]);var I=_a(),M=Wm(),E=ik(x),{activeIndex:j,isActive:$}=(t=T(ze=>bj(ze,E,w,_)))!==null&&t!==void 0?t:{},L=T(ze=>gj(ze,E,w,_)),z=T(ze=>e0(ze,E,w,_)),K=T(ze=>yj(ze,E,w,_)),B=L,W=qj(),R=(r=i??$)!==null&&r!==void 0?r:!1,[ke,Te]=Yp([B,R]),Le=E==="axis"?z:void 0;cC(E,w,K,Le,j,R);var Pt=b??W;if(Pt==null||I==null||E==null)return null;var Je=B??rh;R||(Je=rh),s&&Je.length&&(Je=Kp(Je.filter(ze=>ze.value!=null&&(ze.hide!==!0||n.includeHidden)),d,vC));var nr=Je.length>0,Xr=h.createElement(e1,{allowEscapeViewBox:a,animationDuration:o,animationEasing:u,isAnimationActive:c,active:R,coordinate:K,hasPayload:nr,offset:f,position:v,reverseDirection:p,useTranslate3d:y,viewBox:I,wrapperStyle:m,lastBoundingBox:ke,innerRef:Te,hasPortalFromProps:!!b},hC(l,th(th({},n),{},{payload:Je,label:Le,active:R,activeIndex:j,coordinate:K,accessibilityLayer:M})));return h.createElement(h.Fragment,null,Nl.createPortal(Xr,Pt),R&&h.createElement(Kj,{cursor:g,tooltipEventType:E,coordinate:K,payload:Je,index:j}))}var Va=e=>null;Va.displayName="Cell";function mC(e,t,r){return(t=yC(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yC(e){var t=gC(e,"string");return typeof t=="symbol"?t:t+""}function gC(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class bC{constructor(t){mC(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return r!==void 0&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}function nh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function wC(e){for(var t=1;t{try{var r=document.getElementById(ah);r||(r=document.createElement("span"),r.setAttribute("id",ah),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,SC,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch{return{width:0,height:0}}},ln=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Tn.isSsr)return{width:0,height:0};if(!a0.enableCache)return oh(t,r);var n=EC(t,r),i=ih.get(n);if(i)return i;var a=oh(t,r);return ih.set(n,a),a},uh=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,lh=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,_C=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,kC=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,o0={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},jC=Object.keys(o0),kr="NaN";function CC(e,t){return e*o0[t]}class Fe{static parse(t){var r,[,n,i]=(r=kC.exec(t))!==null&&r!==void 0?r:[];return new Fe(parseFloat(n),i??"")}constructor(t,r){this.num=t,this.unit=r,this.num=t,this.unit=r,dt(t)&&(this.unit=""),r!==""&&!_C.test(r)&&(this.num=NaN,this.unit=""),jC.includes(r)&&(this.num=CC(t,r),this.unit="px")}add(t){return this.unit!==t.unit?new Fe(NaN,""):new Fe(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new Fe(NaN,""):new Fe(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Fe(NaN,""):new Fe(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Fe(NaN,""):new Fe(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return dt(this.num)}}function u0(e){if(e.includes(kr))return kr;for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,i,a]=(r=uh.exec(t))!==null&&r!==void 0?r:[],o=Fe.parse(n??""),u=Fe.parse(a??""),l=i==="*"?o.multiply(u):o.divide(u);if(l.isNaN())return kr;t=t.replace(uh,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var s,[,c,f,d]=(s=lh.exec(t))!==null&&s!==void 0?s:[],v=Fe.parse(c??""),p=Fe.parse(d??""),y=f==="+"?v.add(p):v.subtract(p);if(y.isNaN())return kr;t=t.replace(lh,y.toString())}return t}var ch=/\(([^()]*)\)/;function IC(e){for(var t=e,r;(r=ch.exec(t))!=null;){var[,n]=r;t=t.replace(ch,u0(n))}return t}function MC(e){var t=e.replace(/\s+/g,"");return t=IC(t),t=u0(t),t}function TC(e){try{return MC(e)}catch{return kr}}function gu(e){var t=TC(e.slice(5,-1));return t===kr?"":t}var DC=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],NC=["dx","dy","angle","className","breakAll"];function El(){return El=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:r,style:n}=e;try{var i=[];ae(t)||(r?i=t.toString().split(""):i=t.toString().split(l0));var a=i.map(u=>({word:u,width:ln(u,n).width})),o=r?0:ln(" ",n).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch{return null}};function RC(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var s0=(e,t,r,n)=>e.reduce((i,a)=>{var{word:o,width:u}=a,l=i[i.length-1];if(l&&u!=null&&(t==null||n||l.width+u+re.reduce((t,r)=>t.width>r.width?t:r),LC="…",fh=(e,t,r,n,i,a,o,u)=>{var l=e.slice(0,t),s=c0({breakAll:r,style:n,children:l+LC});if(!s)return[!1,[]];var c=s0(s.wordsWithComputedWidth,a,o,u),f=c.length>i||f0(c).width>Number(a);return[f,c]},zC=(e,t,r,n,i)=>{var{maxLines:a,children:o,style:u,breakAll:l}=e,s=N(a),c=String(o),f=s0(t,n,r,i);if(!s||i)return f;var d=f.length>a||f0(f).width>Number(n);if(!d)return f;for(var v=0,p=c.length-1,y=0,m;v<=p&&y<=c.length-1;){var g=Math.floor((v+p)/2),x=g-1,[w,P]=fh(c,x,l,u,a,n,r,i),[b]=fh(c,g,l,u,a,n,r,i);if(!w&&!b&&(v=g+1),w&&b&&(p=g-1),!w&&b){m=P;break}y++}return m||f},dh=e=>{var t=ae(e)?[]:e.toString().split(l0);return[{words:t,width:void 0}]},BC=e=>{var{width:t,scaleToFit:r,children:n,style:i,breakAll:a,maxLines:o}=e;if((t||r)&&!Tn.isSsr){var u,l,s=c0({breakAll:a,children:n,style:i});if(s){var{wordsWithComputedWidth:c,spaceWidth:f}=s;u=c,l=f}else return dh(n);return zC({breakAll:a,children:n,maxLines:o,style:i},u,l,t,!!r)}return dh(n)},d0="#808080",FC={angle:0,breakAll:!1,capHeight:"0.71em",fill:d0,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Xa=h.forwardRef((e,t)=>{var r=pe(e,FC),{x:n,y:i,lineHeight:a,capHeight:o,fill:u,scaleToFit:l,textAnchor:s,verticalAnchor:c}=r,f=sh(r,DC),d=h.useMemo(()=>BC({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),{dx:v,dy:p,angle:y,className:m,breakAll:g}=f,x=sh(f,NC);if(!bt(n)||!bt(i)||d.length===0)return null;var w=Number(n)+(N(v)?v:0),P=Number(i)+(N(p)?p:0);if(!se(w)||!se(P))return null;var b;switch(c){case"start":b=gu("calc(".concat(o,")"));break;case"middle":b=gu("calc(".concat((d.length-1)/2," * -").concat(a," + (").concat(o," / 2))"));break;default:b=gu("calc(".concat(d.length-1," * -").concat(a,")"));break}var O=[];if(l){var S=d[0].width,{width:_}=f;O.push("scale(".concat(N(_)&&N(S)?_/S:1,")"))}return y&&O.push("rotate(".concat(y,", ").concat(w,", ").concat(P,")")),O.length&&(x.transform=O.join(" ")),h.createElement("text",El({},$e(x),{ref:t,x:w,y:P,className:H("recharts-text",m),textAnchor:s,fill:u.includes("url")?d0:u}),d.map((I,M)=>{var E=I.words.join(g?"":" ");return h.createElement("tspan",{x:w,dy:M===0?b:a,key:"".concat(E,"-").concat(M)},E)}))});Xa.displayName="Text";var KC=["labelRef"];function qC(e,t){if(e==null)return{};var r,n,i=WC(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var{x:t,y:r,upperWidth:n,lowerWidth:i,width:a,height:o,children:u}=e,l=h.useMemo(()=>({x:t,y:r,upperWidth:n,lowerWidth:i,width:a,height:o}),[t,r,n,i,a,o]);return h.createElement(v0.Provider,{value:l},u)},h0=()=>{var e=h.useContext(v0),t=_a();return e||Mm(t)},VC=h.createContext(null),XC=()=>{var e=h.useContext(VC),t=T(ag);return e||t},ZC=e=>{var{value:t,formatter:r}=e,n=ae(e.children)?t:e.children;return typeof r=="function"?r(n):n},ws=e=>e!=null&&typeof e=="function",QC=(e,t)=>{var r=Ae(t-e),n=Math.min(Math.abs(t-e),360);return r*n},JC=(e,t,r,n,i)=>{var{offset:a,className:o}=e,{cx:u,cy:l,innerRadius:s,outerRadius:c,startAngle:f,endAngle:d,clockWise:v}=i,p=(s+c)/2,y=QC(f,d),m=y>=0?1:-1,g,x;switch(t){case"insideStart":g=f+m*a,x=v;break;case"insideEnd":g=d-m*a,x=!v;break;case"end":g=d+m*a,x=v;break;default:throw new Error("Unsupported position ".concat(t))}x=y<=0?x:!x;var w=de(u,l,p,g),P=de(u,l,p,g+(x?1:-1)*359),b="M".concat(w.x,",").concat(w.y,` + A`).concat(p,",").concat(p,",0,1,").concat(x?0:1,`, + `).concat(P.x,",").concat(P.y),O=ae(e.id)?cn("recharts-radial-line-"):e.id;return h.createElement("text",St({},n,{dominantBaseline:"central",className:H("recharts-radial-bar-label",o)}),h.createElement("defs",null,h.createElement("path",{id:O,d:b})),h.createElement("textPath",{xlinkHref:"#".concat(O)},r))},eI=(e,t,r)=>{var{cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:l}=e,s=(u+l)/2;if(r==="outside"){var{x:c,y:f}=de(n,i,o+t,s);return{x:c,y:f,textAnchor:c>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"end"};var d=(a+o)/2,{x:v,y:p}=de(n,i,d,s);return{x:v,y:p,textAnchor:"middle",verticalAnchor:"middle"}},_l=e=>"cx"in e&&N(e.cx),tI=(e,t)=>{var{parentViewBox:r,offset:n,position:i}=e,a;r!=null&&!_l(r)&&(a=r);var{x:o,y:u,upperWidth:l,lowerWidth:s,height:c}=t,f=o,d=o+(l-s)/2,v=(f+d)/2,p=(l+s)/2,y=f+l/2,m=c>=0?1:-1,g=m*n,x=m>0?"end":"start",w=m>0?"start":"end",P=l>=0?1:-1,b=P*n,O=P>0?"end":"start",S=P>0?"start":"end";if(i==="top"){var _={x:f+l/2,y:u-g,textAnchor:"middle",verticalAnchor:x};return ce(ce({},_),a?{height:Math.max(u-a.y,0),width:l}:{})}if(i==="bottom"){var I={x:d+s/2,y:u+c+g,textAnchor:"middle",verticalAnchor:w};return ce(ce({},I),a?{height:Math.max(a.y+a.height-(u+c),0),width:s}:{})}if(i==="left"){var M={x:v-b,y:u+c/2,textAnchor:O,verticalAnchor:"middle"};return ce(ce({},M),a?{width:Math.max(M.x-a.x,0),height:c}:{})}if(i==="right"){var E={x:v+p+b,y:u+c/2,textAnchor:S,verticalAnchor:"middle"};return ce(ce({},E),a?{width:Math.max(a.x+a.width-E.x,0),height:c}:{})}var j=a?{width:p,height:c}:{};return i==="insideLeft"?ce({x:v+b,y:u+c/2,textAnchor:S,verticalAnchor:"middle"},j):i==="insideRight"?ce({x:v+p-b,y:u+c/2,textAnchor:O,verticalAnchor:"middle"},j):i==="insideTop"?ce({x:f+l/2,y:u+g,textAnchor:"middle",verticalAnchor:w},j):i==="insideBottom"?ce({x:d+s/2,y:u+c-g,textAnchor:"middle",verticalAnchor:x},j):i==="insideTopLeft"?ce({x:f+b,y:u+g,textAnchor:S,verticalAnchor:w},j):i==="insideTopRight"?ce({x:f+l-b,y:u+g,textAnchor:O,verticalAnchor:w},j):i==="insideBottomLeft"?ce({x:d+b,y:u+c-g,textAnchor:S,verticalAnchor:x},j):i==="insideBottomRight"?ce({x:d+s-b,y:u+c-g,textAnchor:O,verticalAnchor:x},j):i&&typeof i=="object"&&(N(i.x)||Ct(i.x))&&(N(i.y)||Ct(i.y))?ce({x:o+Ie(i.x,p),y:u+Ie(i.y,c),textAnchor:"end",verticalAnchor:"end"},j):ce({x:y,y:u+c/2,textAnchor:"middle",verticalAnchor:"middle"},j)},rI={angle:0,offset:5,zIndex:ve.label,position:"middle",textBreakAll:!1};function Wt(e){var t=pe(e,rI),{viewBox:r,position:n,value:i,children:a,content:o,className:u="",textBreakAll:l,labelRef:s}=t,c=XC(),f=h0(),d=n==="center"?f:c??f,v,p,y;if(r==null?v=d:_l(r)?v=r:v=Mm(r),!v||ae(i)&&ae(a)&&!h.isValidElement(o)&&typeof o!="function")return null;var m=ce(ce({},t),{},{viewBox:v});if(h.isValidElement(o)){var{labelRef:g}=m,x=qC(m,KC);return h.cloneElement(o,x)}if(typeof o=="function"){if(p=h.createElement(o,m),h.isValidElement(p))return p}else p=ZC(t);var w=$e(t);if(_l(v)){if(n==="insideStart"||n==="insideEnd"||n==="end")return JC(t,n,p,w,v);y=eI(v,t.offset,t.position)}else y=tI(t,v);return h.createElement(We,{zIndex:t.zIndex},h.createElement(Xa,St({ref:s,className:H("recharts-label",u)},w,y,{textAnchor:RC(w.textAnchor)?w.textAnchor:y.textAnchor,breakAll:l}),p))}Wt.displayName="Label";var nI=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?h.createElement(Wt,St({key:"label-implicit"},n)):bt(e)?h.createElement(Wt,St({key:"label-implicit",value:e},n)):h.isValidElement(e)?e.type===Wt?h.cloneElement(e,ce({key:"label-implicit"},n)):h.createElement(Wt,St({key:"label-implicit",content:e},n)):ws(e)?h.createElement(Wt,St({key:"label-implicit",content:e},n)):e&&typeof e=="object"?h.createElement(Wt,St({},e,{key:"label-implicit"},n)):null};function iI(e){var{label:t,labelRef:r}=e,n=h0();return nI(t,n,r)||null}var bu={},wu={},hh;function aI(){return hh||(hh=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r[r.length-1]}e.last=t})(wu)),wu}var xu={},ph;function oI(){return ph||(ph=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Array.isArray(r)?r:Array.from(r)}e.toArray=t})(xu)),xu}var mh;function uI(){return mh||(mh=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=aI(),r=oI(),n=Hl();function i(a){if(n.isArrayLike(a))return t.last(r.toArray(a))}e.last=i})(bu)),bu}var Pu,yh;function lI(){return yh||(yh=1,Pu=uI().last),Pu}var cI=lI();const sI=Qt(cI);var fI=["valueAccessor"],dI=["dataKey","clockWise","id","textBreakAll","zIndex"];function ta(){return ta=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?sI(e.value):e.value,p0=h.createContext(void 0),m0=p0.Provider,y0=h.createContext(void 0),pI=y0.Provider;function mI(){return h.useContext(p0)}function yI(){return h.useContext(y0)}function bi(e){var{valueAccessor:t=hI}=e,r=gh(e,fI),{dataKey:n,clockWise:i,id:a,textBreakAll:o,zIndex:u}=r,l=gh(r,dI),s=mI(),c=yI(),f=s||c;return!f||!f.length?null:h.createElement(We,{zIndex:u??ve.label},h.createElement(Se,{className:"recharts-label-list"},f.map((d,v)=>{var p,y=ae(n)?t(d,v):X(d&&d.payload,n),m=ae(a)?{}:{id:"".concat(a,"-").concat(v)};return h.createElement(Wt,ta({key:"label-".concat(v)},$e(d),l,m,{fill:(p=r.fill)!==null&&p!==void 0?p:d.fill,parentViewBox:d.parentViewBox,value:y,textBreakAll:o,viewBox:d.viewBox,index:v,zIndex:0}))})))}bi.displayName="LabelList";function xs(e){var{label:t}=e;return t?t===!0?h.createElement(bi,{key:"labelList-implicit"}):h.isValidElement(t)||ws(t)?h.createElement(bi,{key:"labelList-implicit",content:t}):typeof t=="object"?h.createElement(bi,ta({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function kl(){return kl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:r,r:n,className:i}=e,a=H("recharts-dot",i);return N(t)&&N(r)&&N(n)?h.createElement("circle",kl({},Ze(e),Ul(e),{className:a,cx:t,cy:r,r:n})):null},b0=e=>e.graphicalItems.polarItems,gI=A([oe,Fn],qc),Za=A([b0,ue,gI],Wc),bI=A([Za],Uc),Qa=A([bI,Mc],Hc),wI=A([Qa,ue,Za],Gc);A([Qa,ue,Za],(e,t,r)=>r.length>0?e.flatMap(n=>r.flatMap(i=>{var a,o=X(n,(a=t.dataKey)!==null&&a!==void 0?a:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):t?.dataKey!=null?e.map(n=>({value:X(n,t.dataKey),errorDomain:[]})):e.map(n=>({value:n,errorDomain:[]})));var bh=()=>{},xI=A([Qa,ue,Za,Ha,oe],Qc),PI=A([ue,Xc,Zc,bh,xI,bh,q,oe],Jc),w0=A([ue,q,Qa,wI,Bn,oe,PI],es),OI=A([w0,ue,Hr],ns);A([ue,w0,OI,oe],as);var AI={radiusAxis:{},angleAxis:{}},x0=qe({name:"polarAxis",initialState:AI,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:R$,removeRadiusAxis:L$,addAngleAxis:z$,removeAngleAxis:B$}=x0.actions,SI=x0.reducer;function wh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xh(e){for(var t=1;tt,Ps=A([b0,jI],(e,t)=>e.filter(r=>r.type==="pie").find(r=>r.id===t)),CI=[],Os=(e,t,r)=>r?.length===0?CI:r,P0=A([Mc,Ps,Os],(e,t,r)=>{var{chartData:n}=e;if(t!=null){var i;if(t?.data!=null&&t.data.length>0?i=t.data:i=n,(!i||!i.length)&&r!=null&&(i=r.map(a=>xh(xh({},t.presentationProps),a.props))),i!=null)return i}}),II=A([P0,Ps,Os],(e,t,r)=>{if(!(e==null||t==null))return e.map((n,i)=>{var a,o=X(n,t.nameKey,t.name),u;return r!=null&&(a=r[i])!==null&&a!==void 0&&(a=a.props)!==null&&a!==void 0&&a.fill?u=r[i].props.fill:typeof n=="object"&&n!=null&&"fill"in n?u=n.fill:u=t.fill,{value:Br(o,t.dataKey),color:u,payload:n,type:t.legendType}})}),MI=A([P0,Ps,Os,ye],(e,t,r,n)=>{if(!(t==null||e==null))return TM({offset:n,pieSettings:t,displayedData:e,cells:r})}),Ou={exports:{}},G={};var Ph;function TI(){if(Ph)return G;Ph=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,o=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,s=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,p=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function w(b){if(typeof b=="object"&&b!==null){var O=b.$$typeof;switch(O){case t:switch(b=b.type,b){case l:case s:case n:case a:case i:case f:return b;default:switch(b=b&&b.$$typeof,b){case u:case c:case p:case v:case o:return b;default:return O}}case r:return O}}}function P(b){return w(b)===s}return G.AsyncMode=l,G.ConcurrentMode=s,G.ContextConsumer=u,G.ContextProvider=o,G.Element=t,G.ForwardRef=c,G.Fragment=n,G.Lazy=p,G.Memo=v,G.Portal=r,G.Profiler=a,G.StrictMode=i,G.Suspense=f,G.isAsyncMode=function(b){return P(b)||w(b)===l},G.isConcurrentMode=P,G.isContextConsumer=function(b){return w(b)===u},G.isContextProvider=function(b){return w(b)===o},G.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===t},G.isForwardRef=function(b){return w(b)===c},G.isFragment=function(b){return w(b)===n},G.isLazy=function(b){return w(b)===p},G.isMemo=function(b){return w(b)===v},G.isPortal=function(b){return w(b)===r},G.isProfiler=function(b){return w(b)===a},G.isStrictMode=function(b){return w(b)===i},G.isSuspense=function(b){return w(b)===f},G.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===n||b===s||b===a||b===i||b===f||b===d||typeof b=="object"&&b!==null&&(b.$$typeof===p||b.$$typeof===v||b.$$typeof===o||b.$$typeof===u||b.$$typeof===c||b.$$typeof===m||b.$$typeof===g||b.$$typeof===x||b.$$typeof===y)},G.typeOf=w,G}var Oh;function DI(){return Oh||(Oh=1,Ou.exports=TI()),Ou.exports}var NI=DI(),Ah=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",Sh=null,Au=null,O0=e=>{if(e===Sh&&Array.isArray(Au))return Au;var t=[];return h.Children.forEach(e,r=>{ae(r)||(NI.isFragment(r)?t=t.concat(O0(r.props.children)):t.push(r))}),Au=t,Sh=e,t};function As(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(i=>Ah(i)):n=[Ah(t)],O0(e).forEach(i=>{var a=pr(i,"type.displayName")||pr(i,"type.name");a&&n.indexOf(a)!==-1&&r.push(i)}),r}var A0=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,Su={},Eh;function $I(){return Eh||(Eh=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const i=r[Symbol.toStringTag];return i==null||!Object.getOwnPropertyDescriptor(r,Symbol.toStringTag)?.writable?!1:r.toString()===`[object ${i}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(Su)),Su}var Eu,_h;function RI(){return _h||(_h=1,Eu=$I().isPlainObject),Eu}var LI=RI();const zI=Qt(LI);function kh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function jh(e){for(var t=1;t{var a=r-n,o;return o="M ".concat(e,",").concat(t),o+="L ".concat(e+r,",").concat(t),o+="L ".concat(e+r-a/2,",").concat(t+i),o+="L ".concat(e+r-a/2-n,",").concat(t+i),o+="L ".concat(e,",").concat(t," Z"),o},qI={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},WI=e=>{var t=pe(e,qI),{x:r,y:n,upperWidth:i,lowerWidth:a,height:o,className:u}=t,{animationEasing:l,animationDuration:s,animationBegin:c,isUpdateAnimationActive:f}=t,d=h.useRef(null),[v,p]=h.useState(-1),y=h.useRef(i),m=h.useRef(a),g=h.useRef(o),x=h.useRef(r),w=h.useRef(n),P=Nn(e,"trapezoid-");if(h.useEffect(()=>{if(d.current&&d.current.getTotalLength)try{var L=d.current.getTotalLength();L&&p(L)}catch{}},[]),r!==+r||n!==+n||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var b=H("recharts-trapezoid",u);if(!f)return h.createElement("g",null,h.createElement("path",ra({},$e(t),{className:b,d:Ch(r,n,i,a,o)})));var O=y.current,S=m.current,_=g.current,I=x.current,M=w.current,E="0px ".concat(v===-1?1:v,"px"),j="".concat(v,"px 0px"),$=Um(["strokeDasharray"],s,l);return h.createElement(Dn,{animationId:P,key:P,canBegin:v>0,duration:s,easing:l,isActive:f,begin:c},L=>{var z=ne(O,i,L),K=ne(S,a,L),B=ne(_,o,L),W=ne(I,r,L),R=ne(M,n,L);d.current&&(y.current=z,m.current=K,g.current=B,x.current=W,w.current=R);var ke=L>0?{transition:$,strokeDasharray:j}:{strokeDasharray:E};return h.createElement("path",ra({},$e(t),{className:b,d:Ch(W,R,z,K,B),ref:d,style:jh(jh({},ke),t.style)}))})},UI=["option","shapeType","propTransformer","activeClassName"];function HI(e,t){if(e==null)return{};var r,n,i=YI(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var n=ee();return(i,a)=>o=>{e?.(i,a,o),n($g({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}},_s=e=>{var t=ee();return(r,n)=>i=>{e?.(r,n,i),t(fk())}},ks=(e,t,r)=>{var n=ee();return(i,a)=>o=>{e?.(i,a,o),n(dk({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}};function js(e){var{tooltipEntrySettings:t}=e,r=ee(),n=Me(),i=h.useRef(null);return h.useLayoutEffect(()=>{n||(i.current===null?r(uk(t)):i.current!==t&&r(lk({prev:i.current,next:t})),i.current=t)},[t,r,n]),h.useLayoutEffect(()=>()=>{i.current&&(r(ck(i.current)),i.current=null)},[r]),null}function S0(e){var{legendPayload:t}=e,r=ee(),n=Me(),i=h.useRef(null);return h.useLayoutEffect(()=>{n||(i.current===null?r(Fm(t)):i.current!==t&&r(Km({prev:i.current,next:t})),i.current=t)},[r,n,t]),h.useLayoutEffect(()=>()=>{i.current&&(r(qm(i.current)),i.current=null)},[r]),null}function eM(e){var{legendPayload:t}=e,r=ee(),n=T(q),i=h.useRef(null);return h.useLayoutEffect(()=>{n!=="centric"&&n!=="radial"||(i.current===null?r(Fm(t)):i.current!==t&&r(Km({prev:i.current,next:t})),i.current=t)},[r,n,t]),h.useLayoutEffect(()=>()=>{i.current&&(r(qm(i.current)),i.current=null)},[r]),null}var _u,tM=()=>{var[e]=h.useState(()=>cn("uid-"));return e},rM=(_u=sb.useId)!==null&&_u!==void 0?_u:tM;function E0(e,t){var r=rM();return t||(e?"".concat(e,"-").concat(r):r)}var nM=h.createContext(void 0),Cs=e=>{var{id:t,type:r,children:n}=e,i=E0("recharts-".concat(r),t);return h.createElement(nM.Provider,{value:i},n(i))},iM={cartesianItems:[],polarItems:[]},_0=qe({name:"graphicalItems",initialState:iM,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:re()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=ft(e).cartesianItems.indexOf(r);i>-1&&(e.cartesianItems[i]=n)},prepare:re()},removeCartesianGraphicalItem:{reducer(e,t){var r=ft(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:re()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:re()},removePolarGraphicalItem:{reducer(e,t){var r=ft(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:re()}}}),{addCartesianGraphicalItem:aM,replaceCartesianGraphicalItem:oM,removeCartesianGraphicalItem:uM,addPolarGraphicalItem:lM,removePolarGraphicalItem:cM}=_0.actions,sM=_0.reducer,fM=e=>{var t=ee(),r=h.useRef(null);return h.useLayoutEffect(()=>{r.current===null?t(aM(e)):r.current!==e&&t(oM({prev:r.current,next:e})),r.current=e},[t,e]),h.useLayoutEffect(()=>()=>{r.current&&(t(uM(r.current)),r.current=null)},[t]),null},k0=h.memo(fM);function dM(e){var t=ee();return h.useLayoutEffect(()=>(t(lM(e)),()=>{t(cM(e))}),[t,e]),null}var vM=["key"],hM=["onMouseEnter","onClick","onMouseLeave"],pM=["id"],mM=["id"];function Th(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function le(e){for(var t=1;tAs(e.children,Va),[e.children]),r=T(n=>II(n,e.id,t));return r==null?null:h.createElement(eM,{legendPayload:r})}var PM=h.memo(e=>{var{dataKey:t,nameKey:r,sectors:n,stroke:i,strokeWidth:a,fill:o,name:u,hide:l,tooltipType:s}=e,c={dataDefinedOnItem:n.map(f=>f.tooltipPayload),positions:n.map(f=>f.tooltipPosition),settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:r,name:Br(u,t),hide:l,type:s,color:o,unit:""}};return h.createElement(js,{tooltipEntrySettings:c})}),OM=(e,t)=>e>t?"start":eIe(typeof t=="function"?t(e):t,r,r*.8),SM=(e,t,r)=>{var{top:n,left:i,width:a,height:o}=t,u=Xm(a,o),l=i+Ie(e.cx,a,a/2),s=n+Ie(e.cy,o,o/2),c=Ie(e.innerRadius,u,0),f=AM(r,e.outerRadius,u),d=e.maxRadius||Math.sqrt(a*a+o*o)/2;return{cx:l,cy:s,innerRadius:c,outerRadius:f,maxRadius:d}},EM=(e,t)=>{var r=Ae(t-e),n=Math.min(Math.abs(t-e),360);return r*n};function _M(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var kM=(e,t)=>{if(h.isValidElement(e))return h.cloneElement(e,t);if(typeof e=="function")return e(t);var r=H("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:n}=t,i=Ja(t,vM);return h.createElement(lc,Zt({},i,{type:"linear",className:r}))},jM=(e,t,r)=>{if(h.isValidElement(e))return h.cloneElement(e,t);var n=r;if(typeof e=="function"&&(n=e(t),h.isValidElement(n)))return n;var i=H("recharts-pie-label-text",_M(e));return h.createElement(Xa,Zt({},t,{alignmentBaseline:"middle",className:i}),n)};function CM(e){var{sectors:t,props:r,showLabels:n}=e,{label:i,labelLine:a,dataKey:o}=r;if(!n||!i||!t)return null;var u=Ze(r),l=hr(i),s=hr(a),c=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((d,v)=>{var p=(d.startAngle+d.endAngle)/2,y=de(d.cx,d.cy,d.outerRadius+c,p),m=le(le(le(le({},u),d),{},{stroke:"none"},l),{},{index:v,textAnchor:OM(y.x,d.cx)},y),g=le(le(le(le({},u),d),{},{fill:"none",stroke:d.fill},s),{},{index:v,points:[de(d.cx,d.cy,d.outerRadius,p),y],key:"line"});return h.createElement(We,{zIndex:ve.label,key:"label-".concat(d.startAngle,"-").concat(d.endAngle,"-").concat(d.midAngle,"-").concat(v)},h.createElement(Se,null,a&&kM(a,g),jM(i,m,X(d,o))))});return h.createElement(Se,{className:"recharts-pie-labels"},f)}function IM(e){var{sectors:t,props:r,showLabels:n}=e,{label:i}=r;return typeof i=="object"&&i!=null&&"position"in i?h.createElement(xs,{label:i}):h.createElement(CM,{sectors:t,props:r,showLabels:n})}function MM(e){var{sectors:t,activeShape:r,inactiveShape:n,allOtherPieProps:i,shape:a,id:o}=e,u=T(Xt),l=T(hs),s=T(Zk),{onMouseEnter:c,onClick:f,onMouseLeave:d}=i,v=Ja(i,hM),p=Es(c,i.dataKey,o),y=_s(d),m=ks(f,i.dataKey,o);return t==null||t.length===0?null:h.createElement(h.Fragment,null,t.map((g,x)=>{if(g?.startAngle===0&&g?.endAngle===0&&t.length!==1)return null;var w=s==null||s===o,P=String(x)===u&&(l==null||i.dataKey===l)&&w,b=u?n:null,O=r&&P?r:b,S=le(le({},g),{},{stroke:g.stroke,tabIndex:-1,[_m]:x,[km]:i.dataKey});return h.createElement(Se,Zt({key:"sector-".concat(g?.startAngle,"-").concat(g?.endAngle,"-").concat(g.midAngle,"-").concat(x),tabIndex:-1,className:"recharts-pie-sector"},En(v,g,x),{onMouseEnter:p(g,x),onMouseLeave:y(g,x),onClick:m(g,x)}),h.createElement(Ss,Zt({option:a??O,index:x,shapeType:"sector",isActive:P},S)))}))}function TM(e){var t,{pieSettings:r,displayedData:n,cells:i,offset:a}=e,{cornerRadius:o,startAngle:u,endAngle:l,dataKey:s,nameKey:c,tooltipType:f}=r,d=Math.abs(r.minAngle),v=EM(u,l),p=Math.abs(v),y=n.length<=1?0:(t=r.paddingAngle)!==null&&t!==void 0?t:0,m=n.filter(O=>X(O,s,0)!==0).length,g=(p>=360?m:m-1)*y,x=p-m*d-g,w=n.reduce((O,S)=>{var _=X(S,s,0);return O+(N(_)?_:0)},0),P;if(w>0){var b;P=n.map((O,S)=>{var _=X(O,s,0),I=X(O,c,S),M=SM(r,a,O),E=(N(_)?_:0)/w,j,$=le(le({},O),i&&i[S]&&i[S].props);S?j=b.endAngle+Ae(v)*y*(_!==0?1:0):j=u;var L=j+Ae(v)*((_!==0?d:0)+E*x),z=(j+L)/2,K=(M.innerRadius+M.outerRadius)/2,B=[{name:I,value:_,payload:$,dataKey:s,type:f}],W=de(M.cx,M.cy,K,z);return b=le(le(le(le({},r.presentationProps),{},{percent:E,cornerRadius:typeof o=="string"?parseFloat(o):o,name:I,tooltipPayload:B,midAngle:z,middleRadius:K,tooltipPosition:W},$),M),{},{value:_,dataKey:s,startAngle:j,endAngle:L,payload:$,paddingAngle:Ae(v)*y}),b})}return P}function DM(e){var{showLabels:t,sectors:r,children:n}=e,i=h.useMemo(()=>!t||!r?[]:r.map(a=>({value:a.value,payload:a.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:a.cx,cy:a.cy,innerRadius:a.innerRadius,outerRadius:a.outerRadius,startAngle:a.startAngle,endAngle:a.endAngle,clockWise:!1},fill:a.fill})),[r,t]);return h.createElement(pI,{value:t?i:void 0},n)}function NM(e){var{props:t,previousSectorsRef:r,id:n}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:u,animationEasing:l,activeShape:s,inactiveShape:c,onAnimationStart:f,onAnimationEnd:d}=t,v=Nn(t,"recharts-pie-"),p=r.current,[y,m]=h.useState(!1),g=h.useCallback(()=>{typeof d=="function"&&d(),m(!1)},[d]),x=h.useCallback(()=>{typeof f=="function"&&f(),m(!0)},[f]);return h.createElement(DM,{showLabels:!y,sectors:i},h.createElement(Dn,{animationId:v,begin:o,duration:u,isActive:a,easing:l,onAnimationStart:x,onAnimationEnd:g,key:v},w=>{var P=[],b=i&&i[0],O=b?.startAngle;return i?.forEach((S,_)=>{var I=p&&p[_],M=_>0?pr(S,"paddingAngle",0):0;if(I){var E=ne(I.endAngle-I.startAngle,S.endAngle-S.startAngle,w),j=le(le({},S),{},{startAngle:O+M,endAngle:O+E+M});P.push(j),O=j.endAngle}else{var{endAngle:$,startAngle:L}=S,z=ne(0,$-L,w),K=le(le({},S),{},{startAngle:O+M,endAngle:O+z+M});P.push(K),O=K.endAngle}}),r.current=P,h.createElement(Se,null,h.createElement(MM,{sectors:P,activeShape:s,inactiveShape:c,allOtherPieProps:t,shape:t.shape,id:n}))}),h.createElement(IM,{showLabels:!y,sectors:i,props:t}),t.children)}var $M={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:ve.area};function RM(e){var{id:t}=e,r=Ja(e,pM),{hide:n,className:i,rootTabIndex:a}=e,o=h.useMemo(()=>As(e.children,Va),[e.children]),u=T(c=>MI(c,t,o)),l=h.useRef(null),s=H("recharts-pie",i);return n||u==null?(l.current=null,h.createElement(Se,{tabIndex:a,className:s})):h.createElement(We,{zIndex:e.zIndex},h.createElement(PM,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:u,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType}),h.createElement(Se,{tabIndex:a,className:s},h.createElement(NM,{props:le(le({},r),{},{sectors:u}),previousSectorsRef:l,id:t})))}function LM(e){var t=pe(e,$M),{id:r}=t,n=Ja(t,mM),i=Ze(n);return h.createElement(Cs,{id:r,type:"pie"},a=>h.createElement(h.Fragment,null,h.createElement(dM,{type:"pie",id:a,data:n.data,dataKey:n.dataKey,hide:n.hide,angleAxisId:0,radiusAxisId:0,name:n.name,nameKey:n.nameKey,tooltipType:n.tooltipType,legendType:n.legendType,fill:n.fill,cx:n.cx,cy:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,paddingAngle:n.paddingAngle,minAngle:n.minAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,cornerRadius:n.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),h.createElement(xM,Zt({},n,{id:a})),h.createElement(RM,Zt({},n,{id:a}))))}LM.displayName="Pie";var zM=["points"];function Dh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ku(e){for(var t=1;t{var m,g,x=ku(ku(ku({r:3},o),f),{},{index:y,cx:(m=p.x)!==null&&m!==void 0?m:void 0,cy:(g=p.y)!==null&&g!==void 0?g:void 0,dataKey:a,value:p.value,payload:p.payload,points:t});return h.createElement(UM,{key:"dot-".concat(y),option:r,dotProps:x,className:i})}),v={};return u&&l!=null&&(v.clipPath="url(#clipPath-".concat(c?"":"dots-").concat(l,")")),h.createElement(We,{zIndex:s},h.createElement(Se,ia({className:n},v),d))}function Nh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $h(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),uT=A([oT,Rt,Lt],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),Is=()=>T(uT),lT=()=>T(rj);function Rh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ju(e){for(var t=1;t{var{point:t,childIndex:r,mainColor:n,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var u={index:r,dataKey:a,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},l=ju(ju(ju({},u),hr(i)),Ul(i)),s;return h.isValidElement(i)?s=h.cloneElement(i,l):typeof i=="function"?s=i(l):s=h.createElement(g0,l),h.createElement(Se,{className:"recharts-active-dot",clipPath:o},s)};function vT(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:i,clipPath:a,zIndex:o=ve.activeDot}=e,u=T(Xt),l=lT();if(t==null||l==null)return null;var s=t.find(c=>l.includes(c.payload));return ae(s)?null:h.createElement(We,{zIndex:o},h.createElement(dT,{point:s,childIndex:Number(u),mainColor:r,dataKey:i,activeDot:n,clipPath:a}))}var hT=["x","y"];function jl(){return jl=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:0;return(n,i)=>{if(N(t))return t;var a=N(n)||ae(n);return a?t(n,i):(a||fb(!1),r)}},PT={},C0=qe({name:"errorBars",initialState:PT,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:i}=t.payload;e[r]&&(e[r]=e[r].map(a=>a.dataKey===n.dataKey&&a.direction===n.direction?i:a))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(i=>i.dataKey!==n.dataKey||i.direction!==n.direction))}}}),{addErrorBar:W$,replaceErrorBar:U$,removeErrorBar:H$}=C0.actions,OT=C0.reducer,AT=["children"];function ST(e,t){if(e==null)return{};var r,n,i=ET(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n({x:0,y:0,value:0}),errorBarOffset:0},kT=h.createContext(_T);function I0(e){var{children:t}=e,r=ST(e,AT);return h.createElement(kT.Provider,{value:r},t)}function Ms(e,t){var r,n,i=T(s=>Bt(s,e)),a=T(s=>Ft(s,t)),o=(r=i?.allowDataOverflow)!==null&&r!==void 0?r:xe.allowDataOverflow,u=(n=a?.allowDataOverflow)!==null&&n!==void 0?n:Pe.allowDataOverflow,l=o||u;return{needClip:l,needClipX:o,needClipY:u}}function M0(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,i=Is(),{needClipX:a,needClipY:o,needClip:u}=Ms(t,r);if(!u||!i)return null;var{x:l,y:s,width:c,height:f}=i;return h.createElement("clipPath",{id:"clipPath-".concat(n)},h.createElement("rect",{x:a?l:l-c/2,y:o?s:s-f/2,width:a?c:c*2,height:o?f:f*2}))}function jT(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&se(e.zIndex)?e.zIndex:t}var Cu={exports:{}},Iu={};var zh;function CT(){if(zh)return Iu;zh=1;var e=db();function t(l,s){return l===s&&(l!==0||1/l===1/s)||l!==l&&s!==s}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,u=e.useDebugValue;return Iu.useSyncExternalStoreWithSelector=function(l,s,c,f,d){var v=i(null);if(v.current===null){var p={hasValue:!1,value:null};v.current=p}else p=v.current;v=o(function(){function m(b){if(!g){if(g=!0,x=b,b=f(b),d!==void 0&&p.hasValue){var O=p.value;if(d(O,b))return w=O}return w=b}if(O=w,r(x,b))return O;var S=f(b);return d!==void 0&&d(O,S)?(x=b,O):(x=b,w=S)}var g=!1,x,w,P=c===void 0?null:c;return[function(){return m(s())},P===null?void 0:function(){return m(P())}]},[s,c,f,d]);var y=n(l,v[0],v[1]);return a(function(){p.hasValue=!0,p.value=y},[y]),u(y),y},Iu}var Bh;function IT(){return Bh||(Bh=1,Cu.exports=CT()),Cu.exports}IT();function MT(e){e()}function TT(){let e=null,t=null;return{clear(){e=null,t=null},notify(){MT(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!n||e===null||(n=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Fh={notify(){},get:()=>[]};function DT(e,t){let r,n=Fh,i=0,a=!1;function o(y){c();const m=n.subscribe(y);let g=!1;return()=>{g||(g=!0,m(),f())}}function u(){n.notify()}function l(){p.onStateChange&&p.onStateChange()}function s(){return a}function c(){i++,r||(r=e.subscribe(l),n=TT())}function f(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=Fh)}function d(){a||(a=!0,c())}function v(){a&&(a=!1,f())}const p={addNestedSub:o,notifyNestedSubs:u,handleChangeWrapper:l,isSubscribed:s,trySubscribe:d,tryUnsubscribe:v,getListeners:()=>n};return p}var NT=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$T=NT(),RT=()=>typeof navigator<"u"&&navigator.product==="ReactNative",LT=RT(),zT=()=>$T||LT?h.useLayoutEffect:h.useEffect,BT=zT();function Kh(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function FT(e,t){if(Kh(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i=0;i{const l=DT(i);return{store:i,subscription:l,getServerState:n?()=>n:void 0}},[i,n]),o=h.useMemo(()=>i.getState(),[i]);BT(()=>{const{subscription:l}=a;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[a,o]);const u=r||UT;return h.createElement(u.Provider,{value:a},t)}var YT=HT,GT=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle"]);function VT(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function eo(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var n of r)if(GT.has(n)){if(e[n]==null&&t[n]==null)continue;if(!FT(e[n],t[n]))return!1}else if(!VT(e[n],t[n]))return!1;return!0}var XT=["onMouseEnter","onMouseLeave","onClick"],ZT=["value","background","tooltipPosition"],QT=["id"],JT=["onMouseEnter","onClick","onMouseLeave"];function $t(){return $t=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,fill:n,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:n,value:Br(r,t),payload:e}]},aD=h.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:i,name:a,hide:o,unit:u,tooltipType:l}=e,s={dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:r,strokeWidth:n,fill:i,dataKey:t,nameKey:void 0,name:Br(a,t),hide:o,type:l,color:i,unit:u}};return h.createElement(js,{tooltipEntrySettings:s})});function oD(e){var t=T(Xt),{data:r,dataKey:n,background:i,allOtherBarProps:a}=e,{onMouseEnter:o,onMouseLeave:u,onClick:l}=a,s=oa(a,XT),c=Es(o,n),f=_s(u),d=ks(l,n);if(!i||r==null)return null;var v=hr(i);return h.createElement(We,{zIndex:jT(i,ve.barBackground)},r.map((p,y)=>{var{value:m,background:g,tooltipPosition:x}=p,w=oa(p,ZT);if(!g)return null;var P=c(p,y),b=f(p,y),O=d(p,y),S=De(De(De(De(De({option:i,isActive:String(y)===t},w),{},{fill:"#eee"},g),v),En(s,p,y)),{},{onMouseEnter:P,onMouseLeave:b,onClick:O,dataKey:n,index:y,className:"recharts-bar-background-rectangle"});return h.createElement(aa,$t({key:"background-bar-".concat(y)},S))}))}function uD(e){var{showLabels:t,children:r,rects:n}=e,i=n?.map(a=>{var o={x:a.x,y:a.y,width:a.width,lowerWidth:a.width,upperWidth:a.width,height:a.height};return De(De({},o),{},{value:a.value,payload:a.payload,parentViewBox:a.parentViewBox,viewBox:o,fill:a.fill})});return h.createElement(m0,{value:t?i:void 0},r)}function lD(e){var{shape:t,activeBar:r,baseProps:n,entry:i,index:a,dataKey:o}=e,u=T(Xt),l=T(hs),s=r&&String(a)===u&&(l==null||o===l),c=s?r:t;return s?h.createElement(We,{zIndex:ve.activeBar},h.createElement(aa,$t({},n,{name:String(n.name)},i,{isActive:s,option:c,index:a,dataKey:o}))):h.createElement(aa,$t({},n,{name:String(n.name)},i,{isActive:s,option:c,index:a,dataKey:o}))}function cD(e){var{shape:t,baseProps:r,entry:n,index:i,dataKey:a}=e;return h.createElement(aa,$t({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:i,dataKey:a}))}function sD(e){var t,{data:r,props:n}=e,i=(t=Ze(n))!==null&&t!==void 0?t:{},{id:a}=i,o=oa(i,QT),{shape:u,dataKey:l,activeBar:s}=n,{onMouseEnter:c,onClick:f,onMouseLeave:d}=n,v=oa(n,JT),p=Es(c,l),y=_s(d),m=ks(f,l);return r?h.createElement(h.Fragment,null,r.map((g,x)=>h.createElement(Se,$t({key:"rectangle-".concat(g?.x,"-").concat(g?.y,"-").concat(g?.value,"-").concat(x),className:"recharts-bar-rectangle"},En(v,g,x),{onMouseEnter:p(g,x),onMouseLeave:y(g,x),onClick:m(g,x)}),s?h.createElement(lD,{shape:u,activeBar:s,baseProps:o,entry:g,index:x,dataKey:l}):h.createElement(cD,{shape:u,baseProps:o,entry:g,index:x,dataKey:l})))):null}function fD(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:i,isAnimationActive:a,animationBegin:o,animationDuration:u,animationEasing:l,onAnimationEnd:s,onAnimationStart:c}=t,f=r.current,d=Nn(t,"recharts-bar-"),[v,p]=h.useState(!1),y=!v,m=h.useCallback(()=>{typeof s=="function"&&s(),p(!1)},[s]),g=h.useCallback(()=>{typeof c=="function"&&c(),p(!0)},[c]);return h.createElement(uD,{showLabels:y,rects:n},h.createElement(Dn,{animationId:d,begin:o,duration:u,isActive:a,easing:l,onAnimationEnd:m,onAnimationStart:g,key:d},x=>{var w=x===1?n:n?.map((P,b)=>{var O=f&&f[b];if(O)return De(De({},P),{},{x:ne(O.x,P.x,x),y:ne(O.y,P.y,x),width:ne(O.width,P.width,x),height:ne(O.height,P.height,x)});if(i==="horizontal"){var S=ne(0,P.height,x),_=ne(P.stackedBarStart,P.y,x);return De(De({},P),{},{y:_,height:S})}var I=ne(0,P.width,x),M=ne(P.stackedBarStart,P.x,x);return De(De({},P),{},{width:I,x:M})});return x>0&&(r.current=w??null),w==null?null:h.createElement(Se,null,h.createElement(sD,{props:t,data:w}))}),h.createElement(xs,{label:t.label}),t.children)}function dD(e){var t=h.useRef(null);return h.createElement(fD,{previousRectanglesRef:t,props:e})}var T0=0,vD=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:X(e,t)}};class hD extends h.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:i,xAxisId:a,yAxisId:o,needClip:u,background:l,id:s}=this.props;if(t||r==null)return null;var c=H("recharts-bar",i),f=s;return h.createElement(Se,{className:c,id:s},u&&h.createElement("defs",null,h.createElement(M0,{clipPathId:f,xAxisId:a,yAxisId:o})),h.createElement(Se,{className:"recharts-bar-rectangles",clipPath:u?"url(#clipPath-".concat(f,")"):void 0},h.createElement(oD,{data:r,dataKey:n,background:l,allOtherBarProps:this.props}),h.createElement(dD,this.props)))}}var pD={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:T0,xAxisId:0,yAxisId:0,zIndex:ve.bar};function mD(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:a,activeBar:o,animationBegin:u,animationDuration:l,animationEasing:s,isAnimationActive:c}=e,{needClip:f}=Ms(t,r),d=In(),v=Me(),p=As(e.children,Va),y=T(x=>UD(x,t,r,v,e.id,p));if(d!=="vertical"&&d!=="horizontal")return null;var m,g=y?.[0];return g==null||g.height==null||g.width==null?m=0:m=d==="vertical"?g.height/2:g.width/2,h.createElement(I0,{xAxisId:t,yAxisId:r,data:y,dataPointFormatter:vD,errorBarOffset:m},h.createElement(hD,$t({},e,{layout:d,needClip:f,data:y,xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:a,activeBar:o,animationBegin:u,animationDuration:l,animationEasing:s,isAnimationActive:c})))}function yD(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n},pos:i,bandSize:a,xAxis:o,yAxis:u,xAxisTicks:l,yAxisTicks:s,stackedData:c,displayedData:f,offset:d,cells:v,parentViewBox:p,dataStartIndex:y}=e,m=t==="horizontal"?u:o,g=c?m.scale.domain():null,x=MP({numericAxis:m}),w=m.scale(x);return f.map((P,b)=>{var O,S,_,I,M,E;c?O=EP(c[b+y],g):(O=X(P,r),Array.isArray(O)||(O=[x,O]));var j=xT(n,T0)(O[1],b);if(t==="horizontal"){var $,[L,z]=[u.scale(O[0]),u.scale(O[1])];S=id({axis:o,ticks:l,bandSize:a,offset:i.offset,entry:P,index:b}),_=($=z??L)!==null&&$!==void 0?$:void 0,I=i.size;var K=L-z;if(M=dt(K)?0:K,E={x:S,y:d.top,width:I,height:d.height},Math.abs(j)>0&&Math.abs(M)0&&Math.abs(I)h.createElement(h.Fragment,null,h.createElement(S0,{legendPayload:iD(t)}),h.createElement(aD,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),h.createElement(k0,{type:"bar",id:n,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:IP(t.stackId),hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r}),h.createElement(We,{zIndex:t.zIndex},h.createElement(mD,$t({},t,{id:n})))))}var bD=h.memo(gD,eo);bD.displayName="Bar";function Wh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vi(e){for(var t=1;tt,AD=(e,t,r)=>r,SD=(e,t,r,n)=>n,ED=(e,t,r,n,i)=>i,Xn=A([Wa,ED],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),_D=A([Xn],e=>e?.maxBarSize),kD=(e,t,r,n,i,a)=>a,Uh=(e,t,r)=>{var n=r??e;if(!ae(n))return Ie(n,t,0)},jD=A([q,Wa,OD,AD,SD],(e,t,r,n,i)=>t.filter(a=>e==="horizontal"?a.xAxisId===r:a.yAxisId===n).filter(a=>a.isPanorama===i).filter(a=>a.hide===!1).filter(a=>a.type==="bar")),CD=(e,t,r,n)=>{var i=q(e);return i==="horizontal"?xl(e,"yAxis",r,n):xl(e,"xAxis",t,n)},ID=(e,t,r)=>{var n=q(e);return n==="horizontal"?zv(e,"xAxis",t):zv(e,"yAxis",r)},MD=(e,t,r)=>{var n={},i=e.filter(Fa),a=e.filter(s=>s.stackId==null),o=i.reduce((s,c)=>(s[c.stackId]||(s[c.stackId]=[]),s[c.stackId].push(c),s),n),u=Object.entries(o).map(s=>{var[c,f]=s,d=f.map(p=>p.dataKey),v=Uh(t,r,f[0].barSize);return{stackId:c,dataKeys:d,barSize:v}}),l=a.map(s=>{var c=[s.dataKey].filter(d=>d!=null),f=Uh(t,r,s.barSize);return{stackId:void 0,dataKeys:c,barSize:f}});return[...u,...l]},TD=A([jD,e_,ID],MD),DD=(e,t,r,n,i)=>{var a,o,u=Xn(e,t,r,n,i);if(u!=null){var l=q(e),s=Zy(e),{maxBarSize:c}=u,f=ae(c)?s:c,d,v;return l==="horizontal"?(d=Vt(e,"xAxis",t,n),v=Gt(e,"xAxis",t,n)):(d=Vt(e,"yAxis",r,n),v=Gt(e,"yAxis",r,n)),(a=(o=Dr(d,v,!0))!==null&&o!==void 0?o:f)!==null&&a!==void 0?a:0}},D0=(e,t,r,n)=>{var i=q(e),a,o;return i==="horizontal"?(a=Vt(e,"xAxis",t,n),o=Gt(e,"xAxis",t,n)):(a=Vt(e,"yAxis",r,n),o=Gt(e,"yAxis",r,n)),Dr(a,o)};function ND(e,t,r,n,i){var a=n.length;if(!(a<1)){var o=Ie(e,r,0,!0),u,l=[];if(se(n[0].barSize)){var s=!1,c=r/a,f=n.reduce((g,x)=>g+(x.barSize||0),0);f+=(a-1)*o,f>=r&&(f-=(a-1)*o,o=0),f>=r&&c>0&&(s=!0,c*=.9,f=a*c);var d=(r-f)/2>>0,v={offset:d-o,size:0};u=n.reduce((g,x)=>{var w,P={stackId:x.stackId,dataKeys:x.dataKeys,position:{offset:v.offset+v.size+o,size:s?c:(w=x.barSize)!==null&&w!==void 0?w:0}},b=[...g,P];return v=b[b.length-1].position,b},l)}else{var p=Ie(t,r,0,!0);r-2*p-(a-1)*o<=0&&(o=0);var y=(r-2*p-(a-1)*o)/a;y>1&&(y>>=0);var m=se(i)?Math.min(y,i):y;u=n.reduce((g,x,w)=>[...g,{stackId:x.stackId,dataKeys:x.dataKeys,position:{offset:p+(y+o)*w+(y-m)/2,size:m}}],l)}return u}}var $D=(e,t,r,n,i,a,o)=>{var u=ae(o)?t:o,l=ND(r,n,i!==a?i:a,e,u);return i!==a&&l!=null&&(l=l.map(s=>vi(vi({},s),{},{position:vi(vi({},s.position),{},{offset:s.position.offset-i/2})}))),l},RD=A([TD,Zy,JE,Qy,DD,D0,_D],$D),LD=(e,t,r,n)=>Vt(e,"xAxis",t,n),zD=(e,t,r,n)=>Vt(e,"yAxis",r,n),BD=(e,t,r,n)=>Gt(e,"xAxis",t,n),FD=(e,t,r,n)=>Gt(e,"yAxis",r,n),KD=A([RD,Xn],(e,t)=>{if(!(e==null||t==null)){var r=e.find(n=>n.stackId===t.stackId&&t.dataKey!=null&&n.dataKeys.includes(t.dataKey));if(r!=null)return r.position}}),qD=(e,t)=>{var r=Fc(t);if(!(!e||r==null||t==null)){var{stackId:n}=t;if(n!=null){var i=e[n];if(i){var{stackedData:a}=i;if(a)return a.find(o=>o.key===r)}}}},WD=A([CD,Xn],qD),UD=A([ye,rc,LD,zD,BD,FD,KD,q,La,D0,WD,Xn,kD],(e,t,r,n,i,a,o,u,l,s,c,f,d)=>{var{chartData:v,dataStartIndex:p,dataEndIndex:y}=l;if(!(f==null||o==null||t==null||u!=="horizontal"&&u!=="vertical"||r==null||n==null||i==null||a==null||s==null)){var{data:m}=f,g;if(m!=null&&m.length>0?g=m:g=v?.slice(p,y+1),g!=null)return yD({layout:u,barSettings:f,pos:o,parentViewBox:t,bandSize:s,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:a,stackedData:c,displayedData:g,offset:e,cells:d,dataStartIndex:p})}}),N0=e=>{var{chartData:t}=e,r=ee(),n=Me();return h.useEffect(()=>n?()=>{}:(r(Qv(t)),()=>{r(Qv(void 0))}),[t,r,n]),null},Hh={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},$0=qe({name:"brush",initialState:Hh,reducers:{setBrushSettings(e,t){return t.payload==null?Hh:t.payload}}}),{setBrushSettings:Y$}=$0.actions,HD=$0.reducer;function YD(e,t,r){return(t=GD(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function GD(e){var t=VD(e,"string");return typeof t=="symbol"?t:t+""}function VD(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class Ts{static create(t){return new Ts(t)}constructor(t){this.scale=t}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(t){var{bandAware:r,position:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t!==void 0){if(n)switch(n){case"start":return this.scale(t);case"middle":{var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+i}case"end":{var a=this.bandwidth?this.bandwidth():0;return this.scale(t)+a}default:return this.scale(t)}if(r){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o}return this.scale(t)}}isInRange(t){var r=this.range(),n=r[0],i=r[r.length-1];return n<=i?t>=n&&t<=i:t>=i&&t<=n}}YD(Ts,"EPS",1e-4);function XD(e){return(e%180+180)%180}var ZD=function(t){var{width:r,height:n}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=XD(i),o=a*Math.PI/180,u=Math.atan(n/r),l=o>u&&o{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=ft(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=ft(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=ft(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:G$,removeDot:V$,addArea:X$,removeArea:Z$,addLine:Q$,removeLine:J$}=R0.actions,JD=R0.reducer,eN=h.createContext(void 0),tN=e=>{var{children:t}=e,[r]=h.useState("".concat(cn("recharts"),"-clip")),n=Is();if(n==null)return null;var{x:i,y:a,width:o,height:u}=n;return h.createElement(eN.Provider,{value:r},h.createElement("defs",null,h.createElement("clipPath",{id:r},h.createElement("rect",{x:i,y:a,height:u,width:o}))),t)};function L0(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;ne*i)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-i)<=0}function iN(e,t){return L0(e,t+1)}function aN(e,t,r,n,i){for(var a=(n||[]).slice(),{start:o,end:u}=t,l=0,s=1,c=o,f=function(){var p=n?.[l];if(p===void 0)return{v:L0(n,s)};var y=l,m,g=()=>(m===void 0&&(m=r(p,y)),m),x=p.coordinate,w=l===0||ua(e,x,g,c,u);w||(l=0,c=o,s+=1),w&&(c=x+e*(g()/2+i),l+=s)},d;s<=a.length;)if(d=f(),d)return d.v;return[]}function Yh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function je(e){for(var t=1;t(p===void 0&&(p=r(v,d)),p);if(d===o-1){var m=e*(v.coordinate+e*y()/2-l);a[d]=v=je(je({},v),{},{tickCoord:m>0?v.coordinate-m*e:v.coordinate})}else a[d]=v=je(je({},v),{},{tickCoord:v.coordinate});if(v.tickCoord!=null){var g=ua(e,v.tickCoord,y,u,l);g&&(l=v.tickCoord-e*(y()/2+i),a[d]=je(je({},v),{},{isShow:!0}))}},c=o-1;c>=0;c--)s(c);return a}function sN(e,t,r,n,i,a){var o=(n||[]).slice(),u=o.length,{start:l,end:s}=t;if(a){var c=n[u-1],f=r(c,u-1),d=e*(c.coordinate+e*f/2-s);if(o[u-1]=c=je(je({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate}),c.tickCoord!=null){var v=ua(e,c.tickCoord,()=>f,l,s);v&&(s=c.tickCoord-e*(f/2+i),o[u-1]=je(je({},c),{},{isShow:!0}))}}for(var p=a?u-1:u,y=function(x){var w=o[x],P,b=()=>(P===void 0&&(P=r(w,x)),P);if(x===0){var O=e*(w.coordinate-e*b()/2-l);o[x]=w=je(je({},w),{},{tickCoord:O<0?w.coordinate-O*e:w.coordinate})}else o[x]=w=je(je({},w),{},{tickCoord:w.coordinate});if(w.tickCoord!=null){var S=ua(e,w.tickCoord,b,l,s);S&&(l=w.tickCoord+e*(b()/2+i),o[x]=je(je({},w),{},{isShow:!0}))}},m=0;m{var b=typeof s=="function"?s(w.value,P):w.value;return p==="width"?rN(ln(b,{fontSize:t,letterSpacing:r}),y,f):ln(b,{fontSize:t,letterSpacing:r})[p]},g=i.length>=2?Ae(i[1].coordinate-i[0].coordinate):1,x=nN(a,g,p);return l==="equidistantPreserveStart"?aN(g,x,m,i,o):(l==="preserveStart"||l==="preserveStartEnd"?v=sN(g,x,m,i,o,l==="preserveStartEnd"):v=cN(g,x,m,i,o),v.filter(w=>w.isShow))}var fN=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(c=>{if(c){var f=c.getBoundingClientRect();f.width>o&&(o=f.width)}});var u=r?r.getBoundingClientRect().width:0,l=i+a,s=o+l+u+(r?n:0);return Math.round(s)}return 0},dN=["axisLine","width","height","className","hide","ticks","axisType"];function vN(e,t){if(e==null)return{};var r,n,i=hN(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var{ticks:r=[],tick:n,tickLine:i,stroke:a,tickFormatter:o,unit:u,padding:l,tickTextProps:s,orientation:c,mirror:f,x:d,y:v,width:p,height:y,tickSize:m,tickMargin:g,fontSize:x,letterSpacing:w,getTicksConfig:P,events:b,axisType:O}=e,S=Ds(fe(fe({},P),{},{ticks:r}),x,w),_=wN(c,f),I=xN(c,f),M=Ze(P),E=hr(n),j={};typeof i=="object"&&(j=i);var $=fe(fe({},M),{},{fill:"none"},j),L=S.map(B=>fe({entry:B},bN(B,d,v,p,y,c,m,f,g))),z=L.map(B=>{var{entry:W,line:R}=B;return h.createElement(Se,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(W.value,"-").concat(W.coordinate,"-").concat(W.tickCoord)},i&&h.createElement("line",br({},$,R,{className:H("recharts-cartesian-axis-tick-line",pr(i,"className"))})))}),K=L.map((B,W)=>{var{entry:R,tick:ke}=B,Te=fe(fe(fe(fe({textAnchor:_,verticalAnchor:I},M),{},{stroke:"none",fill:a},E),ke),{},{index:W,payload:R,visibleTicksCount:S.length,tickFormatter:o,padding:l},s);return h.createElement(Se,br({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(R.value,"-").concat(R.coordinate,"-").concat(R.tickCoord)},En(b,R,W)),n&&h.createElement(PN,{option:n,tickProps:Te,value:"".concat(typeof o=="function"?o(R.value,W):R.value).concat(u||"")}))});return h.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(O,"-ticks")},K.length>0&&h.createElement(We,{zIndex:ve.label},h.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(O,"-tick-labels"),ref:t},K)),z.length>0&&h.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(O,"-tick-lines")},z))}),AN=h.forwardRef((e,t)=>{var{axisLine:r,width:n,height:i,className:a,hide:o,ticks:u,axisType:l}=e,s=vN(e,dN),[c,f]=h.useState(""),[d,v]=h.useState(""),p=h.useRef(null);h.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var m;return fN({ticks:p.current,label:(m=e.labelRef)===null||m===void 0?void 0:m.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var y=h.useCallback(m=>{if(m){var g=m.getElementsByClassName("recharts-cartesian-axis-tick-value");p.current=g;var x=g[0];if(x){var w=window.getComputedStyle(x),P=w.fontSize,b=w.letterSpacing;(P!==c||b!==d)&&(f(P),v(b))}}},[c,d]);return o||n!=null&&n<=0||i!=null&&i<=0?null:h.createElement(We,{zIndex:e.zIndex},h.createElement(Se,{className:H("recharts-cartesian-axis",a)},h.createElement(gN,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:Ze(e)}),h.createElement(ON,{ref:y,axisType:l,events:s,fontSize:c,getTicksConfig:e,height:e.height,letterSpacing:d,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:u,unit:e.unit,width:e.width,x:e.x,y:e.y}),h.createElement(GC,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},h.createElement(iI,{label:e.label,labelRef:e.labelRef}),e.children)))}),Ns=h.forwardRef((e,t)=>{var r=pe(e,jt);return h.createElement(AN,br({},r,{ref:t}))});Ns.displayName="CartesianAxis";var SN=["x1","y1","x2","y2","key"],EN=["offset"],_N=["xAxisId","yAxisId"],kN=["xAxisId","yAxisId"];function Vh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ce(e){for(var t=1;t{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:i,width:a,height:o,ry:u}=e;return h.createElement("rect",{x:n,y:i,ry:u,width:a,height:o,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function z0(e){var{option:t,lineItemProps:r}=e,n;if(h.isValidElement(t))n=h.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var i,{x1:a,y1:o,x2:u,y2:l,key:s}=r,c=la(r,SN),f=(i=Ze(c))!==null&&i!==void 0?i:{},{offset:d}=f,v=la(f,EN);n=h.createElement("line",sr({},v,{x1:a,y1:o,x2:u,y2:l,fill:"none",key:s}))}return n}function DN(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,u=la(e,_N),l=i.map((s,c)=>{var f=Ce(Ce({},u),{},{x1:t,y1:s,x2:t+r,y2:s,key:"line-".concat(c),index:c});return h.createElement(z0,{key:"line-".concat(c),option:n,lineItemProps:f})});return h.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function NN(e){var{y:t,height:r,vertical:n=!0,verticalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,u=la(e,kN),l=i.map((s,c)=>{var f=Ce(Ce({},u),{},{x1:s,y1:t,x2:s,y2:t+r,key:"line-".concat(c),index:c});return h.createElement(z0,{option:n,lineItemProps:f,key:"line-".concat(c)})});return h.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function $N(e){var{horizontalFill:t,fillOpacity:r,x:n,y:i,width:a,height:o,horizontalPoints:u,horizontal:l=!0}=e;if(!l||!t||!t.length||u==null)return null;var s=u.map(f=>Math.round(f+i-i)).sort((f,d)=>f-d);i!==s[0]&&s.unshift(0);var c=s.map((f,d)=>{var v=!s[d+1],p=v?i+o-f:s[d+1]-f;if(p<=0)return null;var y=d%t.length;return h.createElement("rect",{key:"react-".concat(d),y:f,x:n,height:p,width:a,stroke:"none",fill:t[y],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},c)}function RN(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:i,y:a,width:o,height:u,verticalPoints:l}=e;if(!t||!r||!r.length)return null;var s=l.map(f=>Math.round(f+i-i)).sort((f,d)=>f-d);i!==s[0]&&s.unshift(0);var c=s.map((f,d)=>{var v=!s[d+1],p=v?i+o-f:s[d+1]-f;if(p<=0)return null;var y=d%r.length;return h.createElement("rect",{key:"react-".concat(d),x:f,y:a,width:p,height:u,stroke:"none",fill:r[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},c)}var LN=(e,t)=>{var{xAxis:r,width:n,height:i,offset:a}=e;return Am(Ds(Ce(Ce(Ce({},jt),r),{},{ticks:Sm(r),viewBox:{x:0,y:0,width:n,height:i}})),a.left,a.left+a.width,t)},zN=(e,t)=>{var{yAxis:r,width:n,height:i,offset:a}=e;return Am(Ds(Ce(Ce(Ce({},jt),r),{},{ticks:Sm(r),viewBox:{x:0,y:0,width:n,height:i}})),a.top,a.top+a.height,t)},BN={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:ve.grid};function FN(e){var t=ic(),r=ac(),n=Tm(),i=Ce(Ce({},pe(e,BN)),{},{x:N(e.x)?e.x:n.left,y:N(e.y)?e.y:n.top,width:N(e.width)?e.width:n.width,height:N(e.height)?e.height:n.height}),{xAxisId:a,yAxisId:o,x:u,y:l,width:s,height:c,syncWithTicks:f,horizontalValues:d,verticalValues:v}=i,p=Me(),y=T(I=>Bv(I,"xAxis",a,p)),m=T(I=>Bv(I,"yAxis",o,p));if(!wt(s)||!wt(c)||!N(u)||!N(l))return null;var g=i.verticalCoordinatesGenerator||LN,x=i.horizontalCoordinatesGenerator||zN,{horizontalPoints:w,verticalPoints:P}=i;if((!w||!w.length)&&typeof x=="function"){var b=d&&d.length,O=x({yAxis:m?Ce(Ce({},m),{},{ticks:b?d:m.ticks}):void 0,width:t??s,height:r??c,offset:n},b?!0:f);Di(Array.isArray(O),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof O,"]")),Array.isArray(O)&&(w=O)}if((!P||!P.length)&&typeof g=="function"){var S=v&&v.length,_=g({xAxis:y?Ce(Ce({},y),{},{ticks:S?v:y.ticks}):void 0,width:t??s,height:r??c,offset:n},S?!0:f);Di(Array.isArray(_),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof _,"]")),Array.isArray(_)&&(P=_)}return h.createElement(We,{zIndex:i.zIndex},h.createElement("g",{className:"recharts-cartesian-grid"},h.createElement(TN,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),h.createElement($N,sr({},i,{horizontalPoints:w})),h.createElement(RN,sr({},i,{verticalPoints:P})),h.createElement(DN,sr({},i,{offset:n,horizontalPoints:w,xAxis:y,yAxis:m})),h.createElement(NN,sr({},i,{offset:n,verticalPoints:P,xAxis:y,yAxis:m}))))}FN.displayName="CartesianGrid";var B0=(e,t,r,n)=>Vt(e,"xAxis",t,n),F0=(e,t,r,n)=>Gt(e,"xAxis",t,n),K0=(e,t,r,n)=>Vt(e,"yAxis",r,n),q0=(e,t,r,n)=>Gt(e,"yAxis",r,n),KN=A([q,B0,K0,F0,q0],(e,t,r,n,i)=>Jt(e,"xAxis")?Dr(t,n,!1):Dr(r,i,!1)),qN=(e,t,r,n,i)=>i;function WN(e){return e.type==="line"}var UN=A([Wa,qN],(e,t)=>e.filter(WN).find(r=>r.id===t)),HN=A([q,B0,K0,F0,q0,UN,KN,La],(e,t,r,n,i,a,o,u)=>{var{chartData:l,dataStartIndex:s,dataEndIndex:c}=u;if(!(a==null||t==null||r==null||n==null||i==null||n.length===0||i.length===0||o==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:f,data:d}=a,v;if(d!=null&&d.length>0?v=d:v=l?.slice(s,c+1),v!=null)return v2({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataKey:f,bandSize:o,displayedData:v})}});function YN(e){var t=hr(e),r=3,n=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),u=Number(a);return(Number.isNaN(o)||o<0)&&(o=r),(Number.isNaN(u)||u<0)&&(u=n),{r:o,strokeWidth:u}}return{r,strokeWidth:n}}var GN=["id"],VN=["type","layout","connectNulls","needClip","shape"],XN=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function On(){return On=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,stroke:n,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:n,value:Br(r,t),payload:e}]},r2=h.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:a,name:o,hide:u,unit:l,tooltipType:s}=e,c={dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Br(o,t),hide:u,type:s,color:n,unit:l}};return h.createElement(js,{tooltipEntrySettings:c})}),W0=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function n2(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],i=0;i{var n=r.reduce((f,d)=>f+d);if(!n)return W0(t,e);for(var i=Math.floor(e/n),a=e%n,o=t-e,u=[],l=0,s=0;la){u=[...r.slice(0,l),a-s];break}var c=u.length%2===0?[0,o]:[o];return[...n2(r,i),...u,...c].map(f=>"".concat(f,"px")).join(", ")};function a2(e){var{clipPathId:t,points:r,props:n}=e,{dot:i,dataKey:a,needClip:o}=n,{id:u}=n,l=$s(n,GN),s=Ze(l);return h.createElement(YM,{points:r,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:s,needClip:o,clipPathId:t})}function o2(e){var{showLabels:t,children:r,points:n}=e,i=h.useMemo(()=>n?.map(a=>{var o,u,l={x:(o=a.x)!==null&&o!==void 0?o:0,y:(u=a.y)!==null&&u!==void 0?u:0,width:0,lowerWidth:0,upperWidth:0,height:0};return mt(mt({},l),{},{value:a.value,payload:a.payload,viewBox:l,parentViewBox:void 0,fill:void 0})}),[n]);return h.createElement(m0,{value:t?i:void 0},r)}function Zh(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:i,props:a}=e,{type:o,layout:u,connectNulls:l,needClip:s,shape:c}=a,f=$s(a,VN),d=mt(mt({},$e(f)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(t,")"):void 0,points:n,type:o,layout:u,connectNulls:l,strokeDasharray:i??a.strokeDasharray});return h.createElement(h.Fragment,null,n?.length>1&&h.createElement(Ss,On({shapeType:"curve",option:c},d,{pathRef:r})),h.createElement(a2,{points:n,clipPathId:t,props:a}))}function u2(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function l2(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:u,isAnimationActive:l,animationBegin:s,animationDuration:c,animationEasing:f,animateNewValues:d,width:v,height:p,onAnimationEnd:y,onAnimationStart:m}=r,g=i.current,x=Nn(o,"recharts-line-"),w=h.useRef(x),[P,b]=h.useState(!1),O=!P,S=h.useCallback(()=>{typeof y=="function"&&y(),b(!1)},[y]),_=h.useCallback(()=>{typeof m=="function"&&m(),b(!0)},[m]),I=u2(n.current),M=h.useRef(0);w.current!==x&&(M.current=a.current,w.current=x);var E=M.current;return h.createElement(o2,{points:o,showLabels:O},r.children,h.createElement(Dn,{animationId:x,begin:s,duration:c,isActive:l,easing:f,onAnimationEnd:S,onAnimationStart:_,key:x},j=>{var $=ne(E,I+E,j),L=Math.min($,I),z;if(l)if(u){var K="".concat(u).split(/[,\s]+/gim).map(R=>parseFloat(R));z=i2(L,I,K)}else z=W0(I,L);else z=u==null?void 0:String(u);if(j>0&&I>0&&(i.current=o,a.current=Math.max(a.current,L)),g){var B=g.length/o.length,W=j===1?o:o.map((R,ke)=>{var Te=Math.floor(ke*B);if(g[Te]){var Le=g[Te];return mt(mt({},R),{},{x:ne(Le.x,R.x,j),y:ne(Le.y,R.y,j)})}return d?mt(mt({},R),{},{x:ne(v*2,R.x,j),y:ne(p/2,R.y,j)}):mt(mt({},R),{},{x:R.x,y:R.y})});return i.current=W,h.createElement(Zh,{props:r,points:W,clipPathId:t,pathRef:n,strokeDasharray:z})}return h.createElement(Zh,{props:r,points:o,clipPathId:t,pathRef:n,strokeDasharray:z})}),h.createElement(xs,{label:r.label}))}function c2(e){var{clipPathId:t,props:r}=e,n=h.useRef(null),i=h.useRef(0),a=h.useRef(null);return h.createElement(l2,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:i,pathRef:a})}var s2=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:X(e.payload,t)}};class f2 extends h.Component{render(){var{hide:t,dot:r,points:n,className:i,xAxisId:a,yAxisId:o,top:u,left:l,width:s,height:c,id:f,needClip:d,zIndex:v}=this.props;if(t)return null;var p=H("recharts-line",i),y=f,{r:m,strokeWidth:g}=YN(r),x=A0(r),w=m*2+g,P=d?"url(#clipPath-".concat(x?"":"dots-").concat(y,")"):void 0;return h.createElement(We,{zIndex:v},h.createElement(Se,{className:p},d&&h.createElement("defs",null,h.createElement(M0,{clipPathId:y,xAxisId:a,yAxisId:o}),!x&&h.createElement("clipPath",{id:"clipPath-dots-".concat(y)},h.createElement("rect",{x:l-w/2,y:u-w/2,width:s+w,height:c+w}))),h.createElement(I0,{xAxisId:a,yAxisId:o,data:n,dataPointFormatter:s2,errorBarOffset:0},h.createElement(c2,{props:this.props,clipPathId:y}))),h.createElement(vT,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:P}))}}var U0={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:ve.line,type:"linear"};function d2(e){var t=pe(e,U0),{activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:u,dot:l,hide:s,isAnimationActive:c,label:f,legendType:d,xAxisId:v,yAxisId:p,id:y}=t,m=$s(t,XN),{needClip:g}=Ms(v,p),x=Is(),w=In(),P=Me(),b=T(M=>HN(M,v,p,P,y));if(w!=="horizontal"&&w!=="vertical"||b==null||x==null)return null;var{height:O,width:S,x:_,y:I}=x;return h.createElement(f2,On({},m,{id:y,connectNulls:u,dot:l,activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:c,hide:s,label:f,legendType:d,xAxisId:v,yAxisId:p,points:b,layout:w,height:O,width:S,left:_,top:I,needClip:g}))}function v2(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:u,displayedData:l}=e;return l.map((s,c)=>{var f=X(s,o);if(t==="horizontal"){var d=nd({axis:r,ticks:i,bandSize:u,entry:s,index:c}),v=ae(f)?null:n.scale(f);return{x:d,y:v,value:f,payload:s}}var p=ae(f)?null:r.scale(f),y=nd({axis:n,ticks:a,bandSize:u,entry:s,index:c});return p==null||y==null?null:{x:p,y,value:f,payload:s}}).filter(Boolean)}function h2(e){var t=pe(e,U0),r=Me();return h.createElement(Cs,{id:t.id,type:"line"},n=>h.createElement(h.Fragment,null,h.createElement(S0,{legendPayload:t2(t)}),h.createElement(r2,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),h.createElement(k0,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),h.createElement(d2,On({},t,{id:n}))))}var p2=h.memo(h2,eo);p2.displayName="Line";var m2=["domain","range"],y2=["domain","range"];function Qh(e,t){if(e==null)return{};var r,n,i=g2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{r.current===null?t(QM(e)):r.current!==e&&t(JM({prev:r.current,next:e})),r.current=e},[e,t]),h.useLayoutEffect(()=>()=>{r.current&&(t(eT(r.current)),r.current=null)},[t]),null}var O2=e=>{var{xAxisId:t,className:r}=e,n=T(rc),i=Me(),a="xAxis",o=T(m=>Yr(m,a,t,i)),u=T(m=>Cg(m,a,t,i)),l=T(m=>Eg(m,t)),s=T(m=>Z_(m,t)),c=T(m=>ug(m,t));if(l==null||s==null||c==null)return null;var{dangerouslySetInnerHTML:f,ticks:d}=e,v=ep(e,b2),{id:p}=c,y=ep(c,w2);return h.createElement(Ns,Cl({},v,y,{scale:o,x:s.x,y:s.y,width:l.width,height:l.height,className:H("recharts-".concat(a," ").concat(a),r),viewBox:n,ticks:u,axisType:a}))},A2={allowDataOverflow:xe.allowDataOverflow,allowDecimals:xe.allowDecimals,allowDuplicatedCategory:xe.allowDuplicatedCategory,angle:xe.angle,axisLine:jt.axisLine,height:xe.height,hide:!1,includeHidden:xe.includeHidden,interval:xe.interval,minTickGap:xe.minTickGap,mirror:xe.mirror,orientation:xe.orientation,padding:xe.padding,reversed:xe.reversed,scale:xe.scale,tick:xe.tick,tickCount:xe.tickCount,tickLine:jt.tickLine,tickSize:jt.tickSize,type:xe.type,xAxisId:0},S2=e=>{var t=pe(e,A2);return h.createElement(h.Fragment,null,h.createElement(P2,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),h.createElement(O2,t))},E2=h.memo(S2,H0);E2.displayName="XAxis";var _2=["dangerouslySetInnerHTML","ticks"],k2=["id"];function Il(){return Il=Object.assign?Object.assign.bind():function(e){for(var t=1;t{r.current===null?t(tT(e)):r.current!==e&&t(rT({prev:r.current,next:e})),r.current=e},[e,t]),h.useLayoutEffect(()=>()=>{r.current&&(t(nT(r.current)),r.current=null)},[t]),null}var I2=e=>{var{yAxisId:t,className:r,width:n,label:i}=e,a=h.useRef(null),o=h.useRef(null),u=T(rc),l=Me(),s=ee(),c="yAxis",f=T(b=>Yr(b,c,t,l)),d=T(b=>_g(b,t)),v=T(b=>J_(b,t)),p=T(b=>Cg(b,c,t,l)),y=T(b=>lg(b,t));if(h.useLayoutEffect(()=>{if(!(n!=="auto"||!d||ws(i)||h.isValidElement(i)||y==null)){var b=a.current;if(b){var O=b.getCalculatedWidth();Math.round(d.width)!==Math.round(O)&&s(iT({id:t,width:O}))}}},[p,d,s,i,t,n,y]),d==null||v==null||y==null)return null;var{dangerouslySetInnerHTML:m,ticks:g}=e,x=tp(e,_2),{id:w}=y,P=tp(y,k2);return h.createElement(Ns,Il({},x,P,{ref:a,labelRef:o,scale:f,x:v.x,y:v.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:d.width,height:d.height,className:H("recharts-".concat(c," ").concat(c),r),viewBox:u,ticks:p,axisType:c}))},M2={allowDataOverflow:Pe.allowDataOverflow,allowDecimals:Pe.allowDecimals,allowDuplicatedCategory:Pe.allowDuplicatedCategory,angle:Pe.angle,axisLine:jt.axisLine,hide:!1,includeHidden:Pe.includeHidden,interval:Pe.interval,minTickGap:Pe.minTickGap,mirror:Pe.mirror,orientation:Pe.orientation,padding:Pe.padding,reversed:Pe.reversed,scale:Pe.scale,tick:Pe.tick,tickCount:Pe.tickCount,tickLine:jt.tickLine,tickSize:jt.tickSize,type:Pe.type,width:Pe.width,yAxisId:0},T2=e=>{var t=pe(e,M2);return h.createElement(h.Fragment,null,h.createElement(C2,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),h.createElement(I2,t))},D2=h.memo(T2,H0);D2.displayName="YAxis";var N2=(e,t)=>t,Rs=A([N2,q,ag,be,Hg,Kt,pj,ye],Pj),Ls=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,n=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/n)}},Y0=at("mouseClick"),G0=jn();G0.startListening({actionCreator:Y0,effect:(e,t)=>{var r=e.payload,n=Rs(t.getState(),Ls(r));n?.activeIndex!=null&&t.dispatch(vk({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Ml=at("mouseMove"),V0=jn(),hi=null;V0.startListening({actionCreator:Ml,effect:(e,t)=>{var r=e.payload;hi!==null&&cancelAnimationFrame(hi);var n=Ls(r);hi=requestAnimationFrame(()=>{var i=t.getState(),a=ls(i,i.tooltip.settings.shared);if(a==="axis"){var o=Rs(i,n);o?.activeIndex!=null?t.dispatch(Lg({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(Rg())}hi=null})}});var rp={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},X0=qe({name:"rootProps",initialState:rp,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:rp.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),$2=X0.reducer,{updateOptions:R2}=X0.actions,Z0=qe({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:L2}=Z0.actions,z2=Z0.reducer,Q0=at("keyDown"),J0=at("focus"),zs=jn();zs.startListening({actionCreator:Q0,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip,a=e.payload;if(!(a!=="ArrowRight"&&a!=="ArrowLeft"&&a!=="Enter")){var o=cs(i,Vr(r),Wn(r),Gn(r)),u=o==null?-1:Number(o);if(!(!Number.isFinite(u)||u<0)){var l=Kt(r);if(a==="Enter"){var s=ea(r,"axis","hover",String(i.index));t.dispatch(Ol({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:s}));return}var c=nk(r),f=c==="left-to-right"?1:-1,d=a==="ArrowRight"?1:-1,v=u+d*f;if(!(l==null||v>=l.length||v<0)){var p=ea(r,"axis","hover",String(v));t.dispatch(Ol({active:!0,activeIndex:v.toString(),activeDataKey:void 0,activeCoordinate:p}))}}}}}});zs.startListening({actionCreator:J0,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;if(!i.active&&i.index==null){var a="0",o=ea(r,"axis","hover",String(a));t.dispatch(Ol({activeDataKey:void 0,active:!0,activeIndex:a,activeCoordinate:o}))}}}});var rt=at("externalEvent"),eb=jn(),Mu=new Map;eb.startListening({actionCreator:rt,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){n.persist();var i=n.type,a=Mu.get(i);a!==void 0&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var u=t.getState(),l={activeCoordinate:Jk(u),activeDataKey:hs(u),activeIndex:Xt(u),activeLabel:Vg(u),activeTooltipIndex:Xt(u),isTooltipActive:ej(u)};r(l,n)}finally{Mu.delete(i)}});Mu.set(i,o)}}});var B2=A([Gr],e=>e.tooltipItemPayloads),F2=A([B2,Hn,(e,t,r)=>t,(e,t,r)=>r],(e,t,r,n)=>{var i=e.find(u=>u.settings.dataKey===n);if(i!=null){var{positions:a}=i;if(a!=null){var o=t(a,r);return o}}}),tb=at("touchMove"),rb=jn();rb.startListening({actionCreator:tb,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){var n=t.getState(),i=ls(n,n.tooltip.settings.shared);if(i==="axis"){var a=Rs(n,Ls({clientX:r.touches[0].clientX,clientY:r.touches[0].clientY,currentTarget:r.currentTarget}));a?.activeIndex!=null&&t.dispatch(Lg({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate}))}else if(i==="item"){var o,u=r.touches[0];if(document.elementFromPoint==null)return;var l=document.elementFromPoint(u.clientX,u.clientY);if(!l||!l.getAttribute)return;var s=l.getAttribute(_m),c=(o=l.getAttribute(km))!==null&&o!==void 0?o:void 0,f=F2(t.getState(),s,c);t.dispatch($g({activeDataKey:c,activeIndex:s,activeCoordinate:f}))}}}});var K2=Vp({brush:HD,cartesianAxis:aT,chartData:Jj,errorBars:OT,graphicalItems:sM,layout:wP,legend:kO,options:Gj,polarAxis:SI,polarOptions:z2,referenceElements:JD,rootProps:$2,tooltip:hk,zIndex:$j}),q2=function(t){return Ux({reducer:K2,preloadedState:t,middleware:r=>{var n;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((n="es6")!==null&&n!==void 0?n:"")}).concat([G0.middleware,V0.middleware,zs.middleware,eb.middleware,rb.middleware])},enhancers:r=>{var n=r;return typeof r=="function"&&(n=r()),n.concat(sm({type:"raf"}))},devTools:Tn.devToolsEnabled})};function nb(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=Me(),a=h.useRef(null);if(i)return r;a.current==null&&(a.current=q2(t));var o=Yl;return h.createElement(YT,{context:o,store:a.current},r)}function W2(e){var{layout:t,margin:r}=e,n=ee(),i=Me();return h.useEffect(()=>{i||(n(yP(t)),n(mP(r)))},[n,i,t,r]),null}var ib=h.memo(W2,eo);function ab(e){var t=ee();return h.useEffect(()=>{t(R2(e))},[t,e]),null}function np(e){var{zIndex:t,isPanorama:r}=e,n=r?"recharts-zindex-panorama-":"recharts-zindex-",i=E0("".concat(n).concat(t)),a=ee();return h.useLayoutEffect(()=>(a(Dj({zIndex:t,elementId:i,isPanorama:r})),()=>{a(Nj({zIndex:t,isPanorama:r}))}),[a,t,i,r]),h.createElement("g",{tabIndex:-1,id:i})}function ip(e){var{children:t,isPanorama:r}=e,n=T(Aj);if(!n||n.length===0)return t;var i=n.filter(o=>o<0),a=n.filter(o=>o>0);return h.createElement(h.Fragment,null,i.map(o=>h.createElement(np,{key:o,zIndex:o,isPanorama:r})),t,a.map(o=>h.createElement(np,{key:o,zIndex:o,isPanorama:r})))}var U2=["children"];function H2(e,t){if(e==null)return{};var r,n,i=Y2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var r=ic(),n=ac(),i=Wm();if(!wt(r)||!wt(n))return null;var{children:a,otherAttributes:o,title:u,desc:l}=e,s,c;return o!=null&&(typeof o.tabIndex=="number"?s=o.tabIndex:s=i?0:void 0,typeof o.role=="string"?c=o.role:c=i?"application":void 0),h.createElement(Rl,ca({},o,{title:u,desc:l,role:c,tabIndex:s,width:r,height:n,style:G2,ref:t}),a)}),X2=e=>{var{children:t}=e,r=T(Ea);if(!r)return null;var{width:n,height:i,y:a,x:o}=r;return h.createElement(Rl,{width:n,height:i,x:o,y:a},t)},ap=h.forwardRef((e,t)=>{var{children:r}=e,n=H2(e,U2),i=Me();return i?h.createElement(X2,null,h.createElement(ip,{isPanorama:!0},r)):h.createElement(V2,ca({ref:t},n),h.createElement(ip,{isPanorama:!1},r))});function Z2(){var e=ee(),[t,r]=h.useState(null),n=T(LP);return h.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),a=i.width/t.offsetWidth;se(a)&&a!==n&&e(bP(a))}},[t,e,n]),r}function op(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Q2(e){for(var t=1;t(lC(),null);function sa(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var n$=h.forwardRef((e,t)=>{var r,n,i=h.useRef(null),[a,o]=h.useState({containerWidth:sa((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:sa((n=e.style)===null||n===void 0?void 0:n.height)}),u=h.useCallback((s,c)=>{o(f=>{var d=Math.round(s),v=Math.round(c);return f.containerWidth===d&&f.containerHeight===v?f:{containerWidth:d,containerHeight:v}})},[]),l=h.useCallback(s=>{if(typeof t=="function"&&t(s),s!=null&&typeof ResizeObserver<"u"){var{width:c,height:f}=s.getBoundingClientRect();u(c,f);var d=p=>{var{width:y,height:m}=p[0].contentRect;u(y,m)},v=new ResizeObserver(d);v.observe(s),i.current=v}},[t,u]);return h.useEffect(()=>()=>{var s=i.current;s?.disconnect()},[u]),h.createElement(h.Fragment,null,h.createElement(ka,{width:a.containerWidth,height:a.containerHeight}),h.createElement("div",wr({ref:l},e)))}),i$=h.forwardRef((e,t)=>{var{width:r,height:n}=e,[i,a]=h.useState({containerWidth:sa(r),containerHeight:sa(n)}),o=h.useCallback((l,s)=>{a(c=>{var f=Math.round(l),d=Math.round(s);return c.containerWidth===f&&c.containerHeight===d?c:{containerWidth:f,containerHeight:d}})},[]),u=h.useCallback(l=>{if(typeof t=="function"&&t(l),l!=null){var{width:s,height:c}=l.getBoundingClientRect();o(s,c)}},[t,o]);return h.createElement(h.Fragment,null,h.createElement(ka,{width:i.containerWidth,height:i.containerHeight}),h.createElement("div",wr({ref:u},e)))}),a$=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return h.createElement(h.Fragment,null,h.createElement(ka,{width:r,height:n}),h.createElement("div",wr({ref:t},e)))}),o$=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return Ct(r)||Ct(n)?h.createElement(i$,wr({},e,{ref:t})):h.createElement(a$,wr({},e,{ref:t}))});function u$(e){return e===!0?n$:o$}var l$=h.forwardRef((e,t)=>{var{children:r,className:n,height:i,onClick:a,onContextMenu:o,onDoubleClick:u,onMouseDown:l,onMouseEnter:s,onMouseLeave:c,onMouseMove:f,onMouseUp:d,onTouchEnd:v,onTouchMove:p,onTouchStart:y,style:m,width:g,responsive:x,dispatchTouchEvents:w=!0}=e,P=h.useRef(null),b=ee(),[O,S]=h.useState(null),[_,I]=h.useState(null),M=Z2(),E=nc(),j=E?.width>0?E.width:g,$=E?.height>0?E.height:i,L=h.useCallback(k=>{M(k),typeof t=="function"&&t(k),S(k),I(k),k!=null&&(P.current=k)},[M,t,S,I]),z=h.useCallback(k=>{b(Y0(k)),b(rt({handler:a,reactEvent:k}))},[b,a]),K=h.useCallback(k=>{b(Ml(k)),b(rt({handler:s,reactEvent:k}))},[b,s]),B=h.useCallback(k=>{b(Rg()),b(rt({handler:c,reactEvent:k}))},[b,c]),W=h.useCallback(k=>{b(Ml(k)),b(rt({handler:f,reactEvent:k}))},[b,f]),R=h.useCallback(()=>{b(J0())},[b]),ke=h.useCallback(k=>{b(Q0(k.key))},[b]),Te=h.useCallback(k=>{b(rt({handler:o,reactEvent:k}))},[b,o]),Le=h.useCallback(k=>{b(rt({handler:u,reactEvent:k}))},[b,u]),Pt=h.useCallback(k=>{b(rt({handler:l,reactEvent:k}))},[b,l]),Je=h.useCallback(k=>{b(rt({handler:d,reactEvent:k}))},[b,d]),nr=h.useCallback(k=>{b(rt({handler:y,reactEvent:k}))},[b,y]),Xr=h.useCallback(k=>{w&&b(tb(k)),b(rt({handler:p,reactEvent:k}))},[b,w,p]),ze=h.useCallback(k=>{b(rt({handler:v,reactEvent:k}))},[b,v]),to=u$(x);return h.createElement(r0.Provider,{value:O},h.createElement(fp.Provider,{value:_},h.createElement(to,{width:j??m?.width,height:$??m?.height,className:H("recharts-wrapper",n),style:Q2({position:"relative",cursor:"default",width:j,height:$},m),onClick:z,onContextMenu:Te,onDoubleClick:Le,onFocus:R,onKeyDown:ke,onMouseDown:Pt,onMouseEnter:K,onMouseLeave:B,onMouseMove:W,onMouseUp:Je,onTouchEnd:ze,onTouchMove:Xr,onTouchStart:nr,ref:L},h.createElement(r$,null),r)))}),c$=["width","height","responsive","children","className","style","compact","title","desc"];function s$(e,t){if(e==null)return{};var r,n,i=f$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var{width:r,height:n,responsive:i,children:a,className:o,style:u,compact:l,title:s,desc:c}=e,f=s$(e,c$),d=Ze(f);return l?h.createElement(h.Fragment,null,h.createElement(ka,{width:r,height:n}),h.createElement(ap,{otherAttributes:d,title:s,desc:c},a)):h.createElement(l$,{className:o,style:u,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},h.createElement(ap,{otherAttributes:d,title:s,desc:c,ref:t},h.createElement(tN,null,a)))});function Tl(){return Tl=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(ub,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:h$,tooltipPayloadSearcher:bs,categoricalChartProps:e,ref:t})),p$=["axis","item"],tR=h.forwardRef((e,t)=>h.createElement(ub,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:p$,tooltipPayloadSearcher:bs,categoricalChartProps:e,ref:t}));function m$(e){var t=ee();return h.useEffect(()=>{t(L2(e))},[t,e]),null}var y$=["layout"];function Dl(){return Dl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=pe(e,E$);return h.createElement(x$,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:S$,tooltipPayloadSearcher:bs,categoricalChartProps:r,ref:t})});export{tR as B,FN as C,KO as L,rR as P,I$ as R,$$ as T,E2 as X,D2 as Y,ov as a,HA as b,bn as c,T$ as d,M$ as e,D$ as f,eR as g,p2 as h,pt as i,bD as j,LM as k,Va as l}; diff --git a/webui/dist/assets/charts-Dhri-zxi.js b/webui/dist/assets/charts-Dhri-zxi.js deleted file mode 100644 index 28ac978e..00000000 --- a/webui/dist/assets/charts-Dhri-zxi.js +++ /dev/null @@ -1,65 +0,0 @@ -import{c as te}from"./utils-CCeOswSm.js";import{r as N,R as S,i as or}from"./router-CWhjJi2n.js";import{c as Ai,g as ce}from"./react-vendor-Dtc2IqVY.js";var Po,zp;function Fe(){if(zp)return Po;zp=1;var e=Array.isArray;return Po=e,Po}var To,Kp;function wx(){if(Kp)return To;Kp=1;var e=typeof Ai=="object"&&Ai&&Ai.Object===Object&&Ai;return To=e,To}var Eo,Hp;function lt(){if(Hp)return Eo;Hp=1;var e=wx(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Eo=r,Eo}var jo,Gp;function nn(){if(Gp)return jo;Gp=1;var e=lt(),t=e.Symbol;return jo=t,jo}var Mo,Vp;function X_(){if(Vp)return Mo;Vp=1;var e=nn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),c=o[i];try{o[i]=void 0;var s=!0}catch{}var f=n.call(o);return s&&(u?o[i]=c:delete o[i]),f}return Mo=a,Mo}var $o,Xp;function Y_(){if(Xp)return $o;Xp=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return $o=r,$o}var Io,Yp;function kt(){if(Yp)return Io;Yp=1;var e=nn(),t=X_(),r=Y_(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return Io=o,Io}var Co,Zp;function ft(){if(Zp)return Co;Zp=1;function e(t){return t!=null&&typeof t=="object"}return Co=e,Co}var ko,Jp;function an(){if(Jp)return ko;Jp=1;var e=kt(),t=ft(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return ko=n,ko}var Ro,Qp;function Sh(){if(Qp)return Ro;Qp=1;var e=Fe(),t=an(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Ro=i,Ro}var Do,ed;function ht(){if(ed)return Do;ed=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Do=e,Do}var No,td;function Ph(){if(td)return No;td=1;var e=kt(),t=ht(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var c=e(u);return c==n||c==i||c==r||c==a}return No=o,No}var qo,rd;function Z_(){if(rd)return qo;rd=1;var e=lt(),t=e["__core-js_shared__"];return qo=t,qo}var Lo,nd;function J_(){if(nd)return Lo;nd=1;var e=Z_(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return Lo=r,Lo}var Bo,id;function Ox(){if(id)return Bo;id=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Bo=r,Bo}var Fo,ad;function Q_(){if(ad)return Fo;ad=1;var e=Ph(),t=J_(),r=ht(),n=Ox(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,c=o.toString,s=u.hasOwnProperty,f=RegExp("^"+c.call(s).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var p=e(h)?f:a;return p.test(n(h))}return Fo=l,Fo}var Uo,od;function e1(){if(od)return Uo;od=1;function e(t,r){return t?.[r]}return Uo=e,Uo}var Wo,ud;function hr(){if(ud)return Wo;ud=1;var e=Q_(),t=e1();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return Wo=r,Wo}var zo,cd;function Na(){if(cd)return zo;cd=1;var e=hr(),t=e(Object,"create");return zo=t,zo}var Ko,sd;function t1(){if(sd)return Ko;sd=1;var e=Na();function t(){this.__data__=e?e(null):{},this.size=0}return Ko=t,Ko}var Ho,ld;function r1(){if(ld)return Ho;ld=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Ho=e,Ho}var Go,fd;function n1(){if(fd)return Go;fd=1;var e=Na(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return Go=i,Go}var Vo,hd;function i1(){if(hd)return Vo;hd=1;var e=Na(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Vo=n,Vo}var Xo,pd;function a1(){if(pd)return Xo;pd=1;var e=Na(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return Xo=r,Xo}var Yo,dd;function o1(){if(dd)return Yo;dd=1;var e=t1(),t=r1(),r=n1(),n=i1(),i=a1();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u-1}return ru=t,ru}var nu,wd;function f1(){if(wd)return nu;wd=1;var e=La();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return nu=t,nu}var iu,Od;function Ba(){if(Od)return iu;Od=1;var e=u1(),t=c1(),r=s1(),n=l1(),i=f1();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u0?1:-1},er=function(t){return ur(t)&&t.indexOf("%")===t.length-1},q=function(t){return k1(t)&&!gi(t)},R1=function(t){return J(t)},Se=function(t){return q(t)||ur(t)},D1=0,un=function(t){var r=++D1;return"".concat(t||"").concat(r)},Le=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!q(t)&&!ur(t))return n;var a;if(er(t)){var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return gi(a)&&(a=n),i&&a>r&&(a=r),a},qt=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},N1=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function z1(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function nf(e){"@babel/helpers - typeof";return nf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nf(e)}var Yd={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Et=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},Zd=null,Mu=null,Ih=function e(t){if(t===Zd&&Array.isArray(Mu))return Mu;var r=[];return N.Children.forEach(t,function(n){J(n)||(M1.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),Mu=r,Zd=t,r};function Ye(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return Et(i)}):n=[Et(t)],Ih(e).forEach(function(i){var a=Xe(i,"type.displayName")||Xe(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function He(e,t){var r=Ye(e,t);return r&&r[0]}var Jd=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!q(n)||n<=0||!q(i)||i<=0)},K1=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],H1=function(t){return t&&t.type&&ur(t.type)&&K1.indexOf(t.type)>=0},G1=function(t){return t&&nf(t)==="object"&&"clipDot"in t},V1=function(t,r,n,i){var a,o=(a=ju?.[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!X(t)&&(i&&o.includes(r)||B1.includes(r))||n&&$h.includes(r)},K=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(N.isValidElement(t)&&(i=t.props),!on(i))return null;var a={};return Object.keys(i).forEach(function(o){var u;V1((u=i)===null||u===void 0?void 0:u[o],o,r,n)&&(a[o]=i[o])}),a},af=function e(t,r){if(t===r)return!0;var n=N.Children.count(t);if(n!==N.Children.count(r))return!1;if(n===0)return!0;if(n===1)return Qd(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Q1(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function uf(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,a=e.className,o=e.style,u=e.title,c=e.desc,s=J1(e,Z1),f=i||{width:r,height:n,x:0,y:0},l=te("recharts-surface",a);return S.createElement("svg",of({},K(s,!0,"svg"),{className:l,width:r,height:n,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),S.createElement("title",null,u),S.createElement("desc",null,c),t)}var eA=["children","className"];function cf(){return cf=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function rA(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var ne=S.forwardRef(function(e,t){var r=e.children,n=e.className,i=tA(e,eA),a=te("recharts-layer",n);return S.createElement("g",cf({className:a},K(i,!0),{ref:t}),r)}),st=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;aa?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i=a?r:e(r,n,i)}return Iu=t,Iu}var Cu,nv;function Ex(){if(nv)return Cu;nv=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",u=RegExp("["+o+e+i+a+"]");function c(s){return u.test(s)}return Cu=c,Cu}var ku,iv;function aA(){if(iv)return ku;iv=1;function e(t){return t.split("")}return ku=e,ku}var Ru,av;function oA(){if(av)return Ru;av=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",u="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",s="(?:"+u+"|"+c+")",f="[^"+e+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",y=s+"?",v="["+a+"]?",d="(?:"+p+"(?:"+[f,l,h].join("|")+")"+v+y+")*",m=v+y+d,x="(?:"+[f+u+"?",u,l,h,o].join("|")+")",w=RegExp(c+"(?="+c+")|"+x+m,"g");function O(g){return g.match(w)||[]}return Ru=O,Ru}var Du,ov;function uA(){if(ov)return Du;ov=1;var e=aA(),t=Ex(),r=oA();function n(i){return t(i)?r(i):e(i)}return Du=n,Du}var Nu,uv;function cA(){if(uv)return Nu;uv=1;var e=iA(),t=Ex(),r=uA(),n=Ax();function i(a){return function(o){o=n(o);var u=t(o)?r(o):void 0,c=u?u[0]:o.charAt(0),s=u?e(u,1).join(""):o.slice(1);return c[a]()+s}}return Nu=i,Nu}var qu,cv;function sA(){if(cv)return qu;cv=1;var e=cA(),t=e("toUpperCase");return qu=t,qu}var lA=sA();const Wa=ce(lA);function he(e){return function(){return e}}const jx=Math.cos,Ui=Math.sin,pt=Math.sqrt,Wi=Math.PI,za=2*Wi,sf=Math.PI,lf=2*sf,Zt=1e-6,fA=lf-Zt;function Mx(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Mx;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iZt)if(!(Math.abs(l*c-s*f)>Zt)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-o,y=i-u,v=c*c+s*s,d=p*p+y*y,m=Math.sqrt(v),x=Math.sqrt(h),w=a*Math.tan((sf-Math.acos((v+h-d)/(2*m*x)))/2),O=w/x,g=w/m;Math.abs(O-1)>Zt&&this._append`L${t+O*f},${r+O*l}`,this._append`A${a},${a},0,0,${+(l*p>f*y)},${this._x1=t+g*c},${this._y1=r+g*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),c=n*Math.sin(i),s=t+u,f=r+c,l=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${s},${f}`:(Math.abs(this._x1-s)>Zt||Math.abs(this._y1-f)>Zt)&&this._append`L${s},${f}`,n&&(h<0&&(h=h%lf+lf),h>fA?this._append`A${n},${n},0,1,${l},${t-u},${r-c}A${n},${n},0,1,${l},${this._x1=s},${this._y1=f}`:h>Zt&&this._append`A${n},${n},0,${+(h>=sf)},${l},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Ch(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new pA(t)}function kh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $x(e){this._context=e}$x.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Ka(e){return new $x(e)}function Ix(e){return e[0]}function Cx(e){return e[1]}function kx(e,t){var r=he(!0),n=null,i=Ka,a=null,o=Ch(u);e=typeof e=="function"?e:e===void 0?Ix:he(e),t=typeof t=="function"?t:t===void 0?Cx:he(t);function u(c){var s,f=(c=kh(c)).length,l,h=!1,p;for(n==null&&(a=i(p=o())),s=0;s<=f;++s)!(s=p;--y)u.point(w[y],O[y]);u.lineEnd(),u.areaEnd()}m&&(w[h]=+e(d,h,l),O[h]=+t(d,h,l),u.point(n?+n(d,h,l):w[h],r?+r(d,h,l):O[h]))}if(x)return u=null,x+""||null}function f(){return kx().defined(i).curve(o).context(a)}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:he(+l),n=null,s):e},s.x0=function(l){return arguments.length?(e=typeof l=="function"?l:he(+l),s):e},s.x1=function(l){return arguments.length?(n=l==null?null:typeof l=="function"?l:he(+l),s):n},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:he(+l),r=null,s):t},s.y0=function(l){return arguments.length?(t=typeof l=="function"?l:he(+l),s):t},s.y1=function(l){return arguments.length?(r=l==null?null:typeof l=="function"?l:he(+l),s):r},s.lineX0=s.lineY0=function(){return f().x(e).y(t)},s.lineY1=function(){return f().x(e).y(r)},s.lineX1=function(){return f().x(n).y(t)},s.defined=function(l){return arguments.length?(i=typeof l=="function"?l:he(!!l),s):i},s.curve=function(l){return arguments.length?(o=l,a!=null&&(u=o(a)),s):o},s.context=function(l){return arguments.length?(l==null?a=u=null:u=o(a=l),s):a},s}class Rx{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function dA(e){return new Rx(e,!0)}function vA(e){return new Rx(e,!1)}const Rh={draw(e,t){const r=pt(t/Wi);e.moveTo(r,0),e.arc(0,0,r,0,za)}},yA={draw(e,t){const r=pt(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},Dx=pt(1/3),gA=Dx*2,mA={draw(e,t){const r=pt(t/gA),n=r*Dx;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},bA={draw(e,t){const r=pt(t),n=-r/2;e.rect(n,n,r,r)}},xA=.8908130915292852,Nx=Ui(Wi/10)/Ui(7*Wi/10),wA=Ui(za/10)*Nx,OA=-jx(za/10)*Nx,_A={draw(e,t){const r=pt(t*xA),n=wA*r,i=OA*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=za*a/5,u=jx(o),c=Ui(o);e.lineTo(c*r,-u*r),e.lineTo(u*n-c*i,c*n+u*i)}e.closePath()}},Lu=pt(3),AA={draw(e,t){const r=-pt(t/(Lu*3));e.moveTo(0,r*2),e.lineTo(-Lu*r,-r),e.lineTo(Lu*r,-r),e.closePath()}},Je=-.5,Qe=pt(3)/2,ff=1/pt(12),SA=(ff/2+1)*3,PA={draw(e,t){const r=pt(t/SA),n=r/2,i=r*ff,a=n,o=r*ff+r,u=-a,c=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,c),e.lineTo(Je*n-Qe*i,Qe*n+Je*i),e.lineTo(Je*a-Qe*o,Qe*a+Je*o),e.lineTo(Je*u-Qe*c,Qe*u+Je*c),e.lineTo(Je*n+Qe*i,Je*i-Qe*n),e.lineTo(Je*a+Qe*o,Je*o-Qe*a),e.lineTo(Je*u+Qe*c,Je*c-Qe*u),e.closePath()}};function TA(e,t){let r=null,n=Ch(i);e=typeof e=="function"?e:he(e||Rh),t=typeof t=="function"?t:he(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:he(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:he(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function zi(){}function Ki(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function qx(e){this._context=e}qx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ki(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ki(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function EA(e){return new qx(e)}function Lx(e){this._context=e}Lx.prototype={areaStart:zi,areaEnd:zi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ki(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function jA(e){return new Lx(e)}function Bx(e){this._context=e}Bx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Ki(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function MA(e){return new Bx(e)}function Fx(e){this._context=e}Fx.prototype={areaStart:zi,areaEnd:zi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function $A(e){return new Fx(e)}function sv(e){return e<0?-1:1}function lv(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(sv(a)+sv(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function fv(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Bu(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Hi(e){this._context=e}Hi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Bu(this,this._t0,fv(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Bu(this,fv(this,r=lv(this,e,t)),r);break;default:Bu(this,this._t0,r=lv(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Ux(e){this._context=new Wx(e)}(Ux.prototype=Object.create(Hi.prototype)).point=function(e,t){Hi.prototype.point.call(this,t,e)};function Wx(e){this._context=e}Wx.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function IA(e){return new Hi(e)}function CA(e){return new Ux(e)}function zx(e){this._context=e}zx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=hv(e),i=hv(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function RA(e){return new Ha(e,.5)}function DA(e){return new Ha(e,0)}function NA(e){return new Ha(e,1)}function Ir(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function qA(e,t){return e[t]}function LA(e){const t=[];return t.key=e,t}function BA(){var e=he([]),t=hf,r=Ir,n=qA;function i(a){var o=Array.from(e.apply(this,arguments),LA),u,c=o.length,s=-1,f;for(const l of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function XA(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Kx={symbolCircle:Rh,symbolCross:yA,symbolDiamond:mA,symbolSquare:bA,symbolStar:_A,symbolTriangle:AA,symbolWye:PA},YA=Math.PI/180,ZA=function(t){var r="symbol".concat(Wa(t));return Kx[r]||Rh},JA=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*YA;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},QA=function(t,r){Kx["symbol".concat(Wa(t))]=r},Dh=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,a=i===void 0?64:i,o=t.sizeType,u=o===void 0?"area":o,c=VA(t,zA),s=dv(dv({},c),{},{type:n,size:a,sizeType:u}),f=function(){var d=ZA(n),m=TA().type(d).size(JA(a,u,n));return m()},l=s.className,h=s.cx,p=s.cy,y=K(s,!0);return h===+h&&p===+p&&a===+a?S.createElement("path",pf({},y,{className:te("recharts-symbols",l),transform:"translate(".concat(h,", ").concat(p,")"),d:f()})):null};Dh.registerSymbol=QA;function Cr(e){"@babel/helpers - typeof";return Cr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cr(e)}function df(){return df=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var x=p.inactive?s:p.color;return S.createElement("li",df({className:d,style:l,key:"legend-item-".concat(y)},cr(n.props,p,y)),S.createElement(uf,{width:o,height:o,viewBox:f,style:h},n.renderIcon(p)),S.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},v?v(m,p,y):m))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var u={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return S.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(N.PureComponent);Nn(Nh,"displayName","Legend");Nn(Nh,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Fu,yv;function sS(){if(yv)return Fu;yv=1;var e=Ba();function t(){this.__data__=new e,this.size=0}return Fu=t,Fu}var Uu,gv;function lS(){if(gv)return Uu;gv=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return Uu=e,Uu}var Wu,mv;function fS(){if(mv)return Wu;mv=1;function e(t){return this.__data__.get(t)}return Wu=e,Wu}var zu,bv;function hS(){if(bv)return zu;bv=1;function e(t){return this.__data__.has(t)}return zu=e,zu}var Ku,xv;function pS(){if(xv)return Ku;xv=1;var e=Ba(),t=Th(),r=Eh(),n=200;function i(a,o){var u=this.__data__;if(u instanceof e){var c=u.__data__;if(!t||c.lengthp))return!1;var v=l.get(o),d=l.get(u);if(v&&d)return v==u&&d==o;var m=-1,x=!0,w=c&i?new e:void 0;for(l.set(o,u),l.set(u,o);++m-1&&n%1==0&&n-1&&r%1==0&&r<=e}return pc=t,pc}var dc,zv;function OS(){if(zv)return dc;zv=1;var e=kt(),t=Kh(),r=ft(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",u="[object Error]",c="[object Function]",s="[object Map]",f="[object Number]",l="[object Object]",h="[object RegExp]",p="[object Set]",y="[object String]",v="[object WeakMap]",d="[object ArrayBuffer]",m="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",O="[object Int8Array]",g="[object Int16Array]",b="[object Int32Array]",_="[object Uint8Array]",A="[object Uint8ClampedArray]",P="[object Uint16Array]",j="[object Uint32Array]",T={};T[x]=T[w]=T[O]=T[g]=T[b]=T[_]=T[A]=T[P]=T[j]=!0,T[n]=T[i]=T[d]=T[a]=T[m]=T[o]=T[u]=T[c]=T[s]=T[f]=T[l]=T[h]=T[p]=T[y]=T[v]=!1;function E(M){return r(M)&&t(M.length)&&!!T[e(M)]}return dc=E,dc}var vc,Kv;function Ga(){if(Kv)return vc;Kv=1;function e(t){return function(r){return t(r)}}return vc=e,vc}var Pn={exports:{}};Pn.exports;var Hv;function Hh(){return Hv||(Hv=1,(function(e,t){var r=wx(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,u=(function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}})();e.exports=u})(Pn,Pn.exports)),Pn.exports}var yc,Gv;function tw(){if(Gv)return yc;Gv=1;var e=OS(),t=Ga(),r=Hh(),n=r&&r.isTypedArray,i=n?t(n):e;return yc=i,yc}var gc,Vv;function rw(){if(Vv)return gc;Vv=1;var e=bS(),t=Uh(),r=Fe(),n=Wh(),i=zh(),a=tw(),o=Object.prototype,u=o.hasOwnProperty;function c(s,f){var l=r(s),h=!l&&t(s),p=!l&&!h&&n(s),y=!l&&!h&&!p&&a(s),v=l||h||p||y,d=v?e(s.length,String):[],m=d.length;for(var x in s)(f||u.call(s,x))&&!(v&&(x=="length"||p&&(x=="offset"||x=="parent")||y&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||i(x,m)))&&d.push(x);return d}return gc=c,gc}var mc,Xv;function Gh(){if(Xv)return mc;Xv=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return mc=t,mc}var bc,Yv;function nw(){if(Yv)return bc;Yv=1;function e(t,r){return function(n){return t(r(n))}}return bc=e,bc}var xc,Zv;function _S(){if(Zv)return xc;Zv=1;var e=nw(),t=e(Object.keys,Object);return xc=t,xc}var wc,Jv;function AS(){if(Jv)return wc;Jv=1;var e=Gh(),t=_S(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var u in Object(a))n.call(a,u)&&u!="constructor"&&o.push(u);return o}return wc=i,wc}var Oc,Qv;function cn(){if(Qv)return Oc;Qv=1;var e=Ph(),t=Kh();function r(n){return n!=null&&t(n.length)&&!e(n)}return Oc=r,Oc}var _c,ey;function sn(){if(ey)return _c;ey=1;var e=rw(),t=AS(),r=cn();function n(i){return r(i)?e(i):t(i)}return _c=n,_c}var Ac,ty;function iw(){if(ty)return Ac;ty=1;var e=Qx(),t=Fh(),r=sn();function n(i){return e(i,r,t)}return Ac=n,Ac}var Sc,ry;function SS(){if(ry)return Sc;ry=1;var e=iw(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,u,c,s,f){var l=u&t,h=e(a),p=h.length,y=e(o),v=y.length;if(p!=v&&!l)return!1;for(var d=p;d--;){var m=h[d];if(!(l?m in o:n.call(o,m)))return!1}var x=f.get(a),w=f.get(o);if(x&&w)return x==o&&w==a;var O=!0;f.set(a,o),f.set(o,a);for(var g=l;++d-1}return Zc=t,Zc}var Jc,jy;function zS(){if(jy)return Jc;jy=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i=o){var m=s?null:i(c);if(m)return a(m);y=!1,h=n,d=new e}else d=s?[]:v;e:for(;++l=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function aP(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function oP(e){return e.value}function uP(e,t){if(S.isValidElement(e))return S.cloneElement(e,t);if(typeof e=="function")return S.createElement(e,t);t.ref;var r=iP(t,YS);return S.createElement(Nh,r)}var Ny=1,jr=(function(e){function t(){var r;ZS(this,t);for(var n=arguments.length,i=new Array(n),a=0;aNy||Math.abs(i.height-this.lastBoundingBox.height)>Ny)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Ot({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,a=i.layout,o=i.align,u=i.verticalAlign,c=i.margin,s=i.chartWidth,f=i.chartHeight,l,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&a==="vertical"){var p=this.getBBoxSnapshot();l={left:((s||0)-p.width)/2}}else l=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(u==="middle"){var y=this.getBBoxSnapshot();h={top:((f||0)-y.height)/2}}else h=u==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Ot(Ot({},l),h)}},{key:"render",value:function(){var n=this,i=this.props,a=i.content,o=i.width,u=i.height,c=i.wrapperStyle,s=i.payloadUniqBy,f=i.payload,l=Ot(Ot({position:"absolute",width:o||"auto",height:u||"auto"},this.getDefaultPosition(c)),c);return S.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(p){n.wrapperNode=p}},uP(a,Ot(Ot({},this.props),{},{payload:sw(f,s,oP)})))}}],[{key:"getWithHeight",value:function(n,i){var a=Ot(Ot({},this.defaultProps),n.props),o=a.layout;return o==="vertical"&&q(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(N.PureComponent);Xa(jr,"displayName","Legend");Xa(jr,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var ns,qy;function cP(){if(qy)return ns;qy=1;var e=nn(),t=Uh(),r=Fe(),n=e?e.isConcatSpreadable:void 0;function i(a){return r(a)||t(a)||!!(n&&a&&a[n])}return ns=i,ns}var is,Ly;function Xh(){if(Ly)return is;Ly=1;var e=Bh(),t=cP();function r(n,i,a,o,u){var c=-1,s=n.length;for(a||(a=t),u||(u=[]);++c0&&a(f)?i>1?r(f,i-1,a,o,u):e(u,f):o||(u[u.length]=f)}return u}return is=r,is}var as,By;function sP(){if(By)return as;By=1;function e(t){return function(r,n,i){for(var a=-1,o=Object(r),u=i(r),c=u.length;c--;){var s=u[t?c:++a];if(n(o[s],s,o)===!1)break}return r}}return as=e,as}var os,Fy;function lP(){if(Fy)return os;Fy=1;var e=sP(),t=e();return os=t,os}var us,Uy;function hw(){if(Uy)return us;Uy=1;var e=lP(),t=sn();function r(n,i){return n&&e(n,i,t)}return us=r,us}var cs,Wy;function fP(){if(Wy)return cs;Wy=1;var e=cn();function t(r,n){return function(i,a){if(i==null)return i;if(!e(i))return r(i,a);for(var o=i.length,u=n?o:-1,c=Object(i);(n?u--:++un||u&&c&&f&&!s&&!l||a&&c&&f||!i&&f||!o)return 1;if(!a&&!u&&!l&&r=s)return f;var l=i[a];return f*(l=="desc"?-1:1)}}return r.index-n.index}return ps=t,ps}var ds,Xy;function vP(){if(Xy)return ds;Xy=1;var e=jh(),t=Mh(),r=xt(),n=pw(),i=hP(),a=Ga(),o=dP(),u=ln(),c=Fe();function s(f,l,h){l.length?l=e(l,function(v){return c(v)?function(d){return t(d,v.length===1?v[0]:v)}:v}):l=[u];var p=-1;l=e(l,a(r));var y=n(f,function(v,d,m){var x=e(l,function(w){return w(v)});return{criteria:x,index:++p,value:v}});return i(y,function(v,d){return o(v,d,h)})}return ds=s,ds}var vs,Yy;function yP(){if(Yy)return vs;Yy=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return vs=e,vs}var ys,Zy;function dw(){if(Zy)return ys;Zy=1;var e=yP(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,u=-1,c=t(o.length-i,0),s=Array(c);++u0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return xs=n,xs}var ws,rg;function yw(){if(rg)return ws;rg=1;var e=mP(),t=bP(),r=t(e);return ws=r,ws}var Os,ng;function xP(){if(ng)return Os;ng=1;var e=ln(),t=dw(),r=yw();function n(i,a){return r(t(i,a,e),i+"")}return Os=n,Os}var _s,ig;function Ya(){if(ig)return _s;ig=1;var e=qa(),t=cn(),r=zh(),n=ht();function i(a,o,u){if(!n(u))return!1;var c=typeof o;return(c=="number"?t(u)&&r(o,u.length):c=="string"&&o in u)?e(u[o],a):!1}return _s=i,_s}var As,ag;function wP(){if(ag)return As;ag=1;var e=Xh(),t=vP(),r=xP(),n=Ya(),i=r(function(a,o){if(a==null)return[];var u=o.length;return u>1&&n(a,o[0],o[1])?o=[]:u>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return As=i,As}var OP=wP();const Zh=ce(OP);function qn(e){"@babel/helpers - typeof";return qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qn(e)}function gf(){return gf=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t.x),"".concat(yn,"-left"),q(r)&&t&&q(t.x)&&r=t.y),"".concat(yn,"-top"),q(n)&&t&&q(t.y)&&nv?Math.max(f,c[n]):Math.max(l,c[n])}function NP(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function qP(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,u=e.useTranslate3d,c=e.viewBox,s,f,l;return o.height>0&&o.width>0&&r?(f=cg({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),l=cg({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),s=NP({translateX:f,translateY:l,useTranslate3d:u})):s=RP,{cssProperties:s,cssClasses:DP({translateX:f,translateY:l,coordinate:r})}}function Rr(e){"@babel/helpers - typeof";return Rr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rr(e)}function sg(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function lg(e){for(var t=1;tfg||Math.abs(n.height-this.state.lastBoundingBox.height)>fg)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,u=i.animationDuration,c=i.animationEasing,s=i.children,f=i.coordinate,l=i.hasPayload,h=i.isAnimationActive,p=i.offset,y=i.position,v=i.reverseDirection,d=i.useTranslate3d,m=i.viewBox,x=i.wrapperStyle,w=qP({allowEscapeViewBox:o,coordinate:f,offsetTopLeft:p,position:y,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:d,viewBox:m}),O=w.cssClasses,g=w.cssProperties,b=lg(lg({transition:h&&a?"transform ".concat(u,"ms ").concat(c):void 0},g),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&l?"visible":"hidden",position:"absolute",top:0,left:0},x);return S.createElement("div",{tabIndex:-1,className:O,style:b,ref:function(A){n.wrapperNode=A}},s)}}])})(N.PureComponent),VP=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},pr={isSsr:VP()};function Dr(e){"@babel/helpers - typeof";return Dr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dr(e)}function hg(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function pg(e){for(var t=1;t0;return S.createElement(GP,{allowEscapeViewBox:o,animationDuration:u,animationEasing:c,isAnimationActive:h,active:a,coordinate:f,hasPayload:b,offset:p,position:d,reverseDirection:m,useTranslate3d:x,viewBox:w,wrapperStyle:O},iT(s,pg(pg({},this.props),{},{payload:g})))}}])})(N.PureComponent);Jh(_t,"displayName","Tooltip");Jh(_t,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!pr.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Ps,dg;function aT(){if(dg)return Ps;dg=1;var e=lt(),t=function(){return e.Date.now()};return Ps=t,Ps}var Ts,vg;function oT(){if(vg)return Ts;vg=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Ts=t,Ts}var Es,yg;function uT(){if(yg)return Es;yg=1;var e=oT(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Es=r,Es}var js,gg;function ww(){if(gg)return js;gg=1;var e=uT(),t=ht(),r=an(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt;function c(s){if(typeof s=="number")return s;if(r(s))return n;if(t(s)){var f=typeof s.valueOf=="function"?s.valueOf():s;s=t(f)?f+"":f}if(typeof s!="string")return s===0?s:+s;s=e(s);var l=a.test(s);return l||o.test(s)?u(s.slice(2),l?2:8):i.test(s)?n:+s}return js=c,js}var Ms,mg;function cT(){if(mg)return Ms;mg=1;var e=ht(),t=aT(),r=ww(),n="Expected a function",i=Math.max,a=Math.min;function o(u,c,s){var f,l,h,p,y,v,d=0,m=!1,x=!1,w=!0;if(typeof u!="function")throw new TypeError(n);c=r(c)||0,e(s)&&(m=!!s.leading,x="maxWait"in s,h=x?i(r(s.maxWait)||0,c):h,w="trailing"in s?!!s.trailing:w);function O(M){var I=f,$=l;return f=l=void 0,d=M,p=u.apply($,I),p}function g(M){return d=M,y=setTimeout(A,c),m?O(M):p}function b(M){var I=M-v,$=M-d,k=c-I;return x?a(k,h-$):k}function _(M){var I=M-v,$=M-d;return v===void 0||I>=c||I<0||x&&$>=h}function A(){var M=t();if(_(M))return P(M);y=setTimeout(A,b(M))}function P(M){return y=void 0,w&&f?O(M):(f=l=void 0,p)}function j(){y!==void 0&&clearTimeout(y),d=0,f=v=l=y=void 0}function T(){return y===void 0?p:P(t())}function E(){var M=t(),I=_(M);if(f=arguments,l=this,v=M,I){if(y===void 0)return g(v);if(x)return clearTimeout(y),y=setTimeout(A,c),O(v)}return y===void 0&&(y=setTimeout(A,c)),p}return E.cancel=j,E.flush=T,E}return Ms=o,Ms}var $s,bg;function sT(){if(bg)return $s;bg=1;var e=cT(),t=ht(),r="Expected a function";function n(i,a,o){var u=!0,c=!0;if(typeof i!="function")throw new TypeError(r);return t(o)&&(u="leading"in o?!!o.leading:u,c="trailing"in o?!!o.trailing:c),e(i,a,{leading:u,maxWait:a,trailing:c})}return $s=n,$s}var lT=sT();const Ow=ce(lT);function Bn(e){"@babel/helpers - typeof";return Bn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bn(e)}function xg(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ti(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(M=Ow(M,v,{trailing:!0,leading:!1}));var I=new ResizeObserver(M),$=g.current.getBoundingClientRect(),k=$.width,R=$.height;return T(k,R),I.observe(g.current),function(){I.disconnect()}},[T,v]);var E=N.useMemo(function(){var M=P.containerWidth,I=P.containerHeight;if(M<0||I<0)return null;st(er(o)||er(c),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,o,c),st(!r||r>0,"The aspect(%s) must be greater than zero.",r);var $=er(o)?M:o,k=er(c)?I:c;r&&r>0&&($?k=$/r:k&&($=k*r),h&&k>h&&(k=h)),st($>0||k>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,$,k,o,c,f,l,r);var R=!Array.isArray(p)&&Et(p.type).endsWith("Chart");return S.Children.map(p,function(L){return S.isValidElement(L)?N.cloneElement(L,Ti({width:$,height:k},R?{style:Ti({height:"100%",width:"100%",maxHeight:k,maxWidth:$},L.props.style)}:{})):L})},[r,p,c,h,l,f,P,o]);return S.createElement("div",{id:d?"".concat(d):void 0,className:te("recharts-responsive-container",m),style:Ti(Ti({},O),{},{width:o,height:c,minWidth:f,minHeight:l,maxHeight:h}),ref:g},E)}),Qh=function(t){return null};Qh.displayName="Cell";function Fn(e){"@babel/helpers - typeof";return Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fn(e)}function Og(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function wf(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||pr.isSsr)return{width:0,height:0};var n=AT(r),i=JSON.stringify({text:t,copyStyle:n});if(br.widthCache[i])return br.widthCache[i];try{var a=document.getElementById(_g);a||(a=document.createElement("span"),a.setAttribute("id",_g),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=wf(wf({},_T),n);Object.assign(a.style,o),a.textContent="".concat(t);var u=a.getBoundingClientRect(),c={width:u.width,height:u.height};return br.widthCache[i]=c,++br.cacheCount>OT&&(br.cacheCount=0,br.widthCache={}),c}catch{return{width:0,height:0}}},ST=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Un(e){"@babel/helpers - typeof";return Un=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(e)}function Zi(e,t){return jT(e)||ET(e,t)||TT(e,t)||PT()}function PT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TT(e,t){if(e){if(typeof e=="string")return Ag(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ag(e,t)}}function Ag(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function WT(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Mg(e,t){return GT(e)||HT(e,t)||KT(e,t)||zT()}function zT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KT(e,t){if(e){if(typeof e=="string")return $g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $g(e,t)}}function $g(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[];return $.reduce(function(k,R){var L=R.word,B=R.width,z=k[k.length-1];if(z&&(i==null||a||z.width+B+nR.width?k:R})};if(!f)return p;for(var v="…",d=function($){var k=l.slice(0,$),R=Pw({breakAll:s,style:c,children:k+v}).wordsWithComputedWidth,L=h(R),B=L.length>o||y(L).width>Number(i);return[B,L]},m=0,x=l.length-1,w=0,O;m<=x&&w<=l.length-1;){var g=Math.floor((m+x)/2),b=g-1,_=d(b),A=Mg(_,2),P=A[0],j=A[1],T=d(g),E=Mg(T,1),M=E[0];if(!P&&!M&&(m=g+1),P&&M&&(x=g-1),!P&&M){O=j;break}w++}return O||p},Ig=function(t){var r=J(t)?[]:t.toString().split(Sw);return[{words:r}]},XT=function(t){var r=t.width,n=t.scaleToFit,i=t.children,a=t.style,o=t.breakAll,u=t.maxLines;if((r||n)&&!pr.isSsr){var c,s,f=Pw({breakAll:o,children:i,style:a});if(f){var l=f.wordsWithComputedWidth,h=f.spaceWidth;c=l,s=h}else return Ig(i);return VT({breakAll:o,children:i,maxLines:u,style:a},c,s,r,n)}return Ig(i)},Cg="#808080",sr=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.lineHeight,u=o===void 0?"1em":o,c=t.capHeight,s=c===void 0?"0.71em":c,f=t.scaleToFit,l=f===void 0?!1:f,h=t.textAnchor,p=h===void 0?"start":h,y=t.verticalAnchor,v=y===void 0?"end":y,d=t.fill,m=d===void 0?Cg:d,x=jg(t,FT),w=N.useMemo(function(){return XT({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:l,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,l,x.style,x.width]),O=x.dx,g=x.dy,b=x.angle,_=x.className,A=x.breakAll,P=jg(x,UT);if(!Se(n)||!Se(a))return null;var j=n+(q(O)?O:0),T=a+(q(g)?g:0),E;switch(v){case"start":E=Is("calc(".concat(s,")"));break;case"middle":E=Is("calc(".concat((w.length-1)/2," * -").concat(u," + (").concat(s," / 2))"));break;default:E=Is("calc(".concat(w.length-1," * -").concat(u,")"));break}var M=[];if(l){var I=w[0].width,$=x.width;M.push("scale(".concat((q($)?$/I:1)/I,")"))}return b&&M.push("rotate(".concat(b,", ").concat(j,", ").concat(T,")")),M.length&&(P.transform=M.join(" ")),S.createElement("text",Of({},K(P,!0),{x:j,y:T,className:te("recharts-text",_),textAnchor:p,fill:m.includes("url")?Cg:m}),w.map(function(k,R){var L=k.words.join(A?"":" ");return S.createElement("tspan",{x:j,dy:R===0?E:u,key:"".concat(L,"-").concat(R)},L)}))};function Bt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function YT(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function ep(e){let t,r,n;e.length!==2?(t=Bt,r=(u,c)=>Bt(e(u),c),n=(u,c)=>e(u)-c):(t=e===Bt||e===YT?e:ZT,r=e,n=e);function i(u,c,s=0,f=u.length){if(s>>1;r(u[l],c)<0?s=l+1:f=l}while(s>>1;r(u[l],c)<=0?s=l+1:f=l}while(ss&&n(u[l-1],c)>-n(u[l],c)?l-1:l}return{left:i,center:o,right:a}}function ZT(){return 0}function Tw(e){return e===null?NaN:+e}function*JT(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const QT=ep(Bt),mi=QT.right;ep(Tw).center;class kg extends Map{constructor(t,r=rE){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(Rg(this,t))}has(t){return super.has(Rg(this,t))}set(t,r){return super.set(eE(this,t),r)}delete(t){return super.delete(tE(this,t))}}function Rg({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function eE({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function tE({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function rE(e){return e!==null&&typeof e=="object"?e.valueOf():e}function nE(e=Bt){if(e===Bt)return Ew;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function Ew(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const iE=Math.sqrt(50),aE=Math.sqrt(10),oE=Math.sqrt(2);function Ji(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=iE?10:a>=aE?5:a>=oE?2:1;let u,c,s;return i<0?(s=Math.pow(10,-i)/o,u=Math.round(e*s),c=Math.round(t*s),u/st&&--c,s=-s):(s=Math.pow(10,i)*o,u=Math.round(e/s),c=Math.round(t/s),u*st&&--c),c0))return[];if(e===t)return[e];const n=t=i))return[];const u=a-i+1,c=new Array(u);if(n)if(o<0)for(let s=0;s=n)&&(r=n);return r}function Ng(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function jw(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?Ew:nE(i);n>r;){if(n-r>600){const c=n-r+1,s=t-r+1,f=Math.log(c),l=.5*Math.exp(2*f/3),h=.5*Math.sqrt(f*l*(c-l)/c)*(s-c/2<0?-1:1),p=Math.max(r,Math.floor(t-s*l/c+h)),y=Math.min(n,Math.floor(t+(c-s)*l/c+h));jw(e,t,p,y,i)}const a=e[t];let o=r,u=n;for(gn(e,r,t),i(e[n],a)>0&&gn(e,r,n);o0;)--u}i(e[r],a)===0?gn(e,r,u):(++u,gn(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function gn(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function uE(e,t,r){if(e=Float64Array.from(JT(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Ng(e);if(t>=1)return Dg(e);var n,i=(n-1)*t,a=Math.floor(i),o=Dg(jw(e,a).subarray(0,a+1)),u=Ng(e.subarray(a+1));return o+(u-o)*(i-a)}}function cE(e,t,r=Tw){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,a=Math.floor(i),o=+r(e[a],a,e),u=+r(e[a+1],a+1,e);return o+(u-o)*(i-a)}}function sE(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?ji(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?ji(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=fE.exec(e))?new Ue(t[1],t[2],t[3],1):(t=hE.exec(e))?new Ue(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pE.exec(e))?ji(t[1],t[2],t[3],t[4]):(t=dE.exec(e))?ji(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=vE.exec(e))?zg(t[1],t[2]/100,t[3]/100,1):(t=yE.exec(e))?zg(t[1],t[2]/100,t[3]/100,t[4]):qg.hasOwnProperty(e)?Fg(qg[e]):e==="transparent"?new Ue(NaN,NaN,NaN,0):null}function Fg(e){return new Ue(e>>16&255,e>>8&255,e&255,1)}function ji(e,t,r,n){return n<=0&&(e=t=r=NaN),new Ue(e,t,r,n)}function bE(e){return e instanceof bi||(e=Hn(e)),e?(e=e.rgb(),new Ue(e.r,e.g,e.b,e.opacity)):new Ue}function Tf(e,t,r,n){return arguments.length===1?bE(e):new Ue(e,t,r,n??1)}function Ue(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}rp(Ue,Tf,$w(bi,{brighter(e){return e=e==null?Qi:Math.pow(Qi,e),new Ue(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?zn:Math.pow(zn,e),new Ue(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ue(ir(this.r),ir(this.g),ir(this.b),ea(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ug,formatHex:Ug,formatHex8:xE,formatRgb:Wg,toString:Wg}));function Ug(){return`#${tr(this.r)}${tr(this.g)}${tr(this.b)}`}function xE(){return`#${tr(this.r)}${tr(this.g)}${tr(this.b)}${tr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Wg(){const e=ea(this.opacity);return`${e===1?"rgb(":"rgba("}${ir(this.r)}, ${ir(this.g)}, ${ir(this.b)}${e===1?")":`, ${e})`}`}function ea(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ir(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tr(e){return e=ir(e),(e<16?"0":"")+e.toString(16)}function zg(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new ct(e,t,r,n)}function Iw(e){if(e instanceof ct)return new ct(e.h,e.s,e.l,e.opacity);if(e instanceof bi||(e=Hn(e)),!e)return new ct;if(e instanceof ct)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,u=a-i,c=(a+i)/2;return u?(t===a?o=(r-n)/u+(r0&&c<1?0:o,new ct(o,u,c,e.opacity)}function wE(e,t,r,n){return arguments.length===1?Iw(e):new ct(e,t,r,n??1)}function ct(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}rp(ct,wE,$w(bi,{brighter(e){return e=e==null?Qi:Math.pow(Qi,e),new ct(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zn:Math.pow(zn,e),new ct(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Ue(Cs(e>=240?e-240:e+120,i,n),Cs(e,i,n),Cs(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new ct(Kg(this.h),Mi(this.s),Mi(this.l),ea(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ea(this.opacity);return`${e===1?"hsl(":"hsla("}${Kg(this.h)}, ${Mi(this.s)*100}%, ${Mi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Kg(e){return e=(e||0)%360,e<0?e+360:e}function Mi(e){return Math.max(0,Math.min(1,e||0))}function Cs(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const np=e=>()=>e;function OE(e,t){return function(r){return e+r*t}}function _E(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function AE(e){return(e=+e)==1?Cw:function(t,r){return r-t?_E(t,r,e):np(isNaN(t)?r:t)}}function Cw(e,t){var r=t-e;return r?OE(e,r):np(isNaN(e)?t:e)}const Hg=(function e(t){var r=AE(t);function n(i,a){var o=r((i=Tf(i)).r,(a=Tf(a)).r),u=r(i.g,a.g),c=r(i.b,a.b),s=Cw(i.opacity,a.opacity);return function(f){return i.r=o(f),i.g=u(f),i.b=c(f),i.opacity=s(f),i+""}}return n.gamma=e,n})(1);function SE(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;ir&&(a=t.slice(r,a),u[o]?u[o]+=a:u[++o]=a),(n=n[0])===(i=i[0])?u[o]?u[o]+=i:u[++o]=i:(u[++o]=null,c.push({i:o,x:dt(n,i)})),r=ks.lastIndex;return r180?f+=360:f-s>180&&(s+=360),h.push({i:l.push(i(l)+"rotate(",null,n)-2,x:dt(s,f)})):f&&l.push(i(l)+"rotate("+f+n)}function u(s,f,l,h){s!==f?h.push({i:l.push(i(l)+"skewX(",null,n)-2,x:dt(s,f)}):f&&l.push(i(l)+"skewX("+f+n)}function c(s,f,l,h,p,y){if(s!==l||f!==h){var v=p.push(i(p)+"scale(",null,",",null,")");y.push({i:v-4,x:dt(s,l)},{i:v-2,x:dt(f,h)})}else(l!==1||h!==1)&&p.push(i(p)+"scale("+l+","+h+")")}return function(s,f){var l=[],h=[];return s=e(s),f=e(f),a(s.translateX,s.translateY,f.translateX,f.translateY,l,h),o(s.rotate,f.rotate,l,h),u(s.skewX,f.skewX,l,h),c(s.scaleX,s.scaleY,f.scaleX,f.scaleY,l,h),s=f=null,function(p){for(var y=-1,v=h.length,d;++yt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function FE(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i2?UE:FE,c=s=null,l}function l(h){return h==null||isNaN(h=+h)?a:(c||(c=u(e.map(n),t,r)))(n(o(h)))}return l.invert=function(h){return o(i((s||(s=u(t,e.map(n),dt)))(h)))},l.domain=function(h){return arguments.length?(e=Array.from(h,ta),f()):e.slice()},l.range=function(h){return arguments.length?(t=Array.from(h),f()):t.slice()},l.rangeRound=function(h){return t=Array.from(h),r=ip,f()},l.clamp=function(h){return arguments.length?(o=h?!0:Be,f()):o!==Be},l.interpolate=function(h){return arguments.length?(r=h,f()):r},l.unknown=function(h){return arguments.length?(a=h,l):a},function(h,p){return n=h,i=p,f()}}function ap(){return Za()(Be,Be)}function WE(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function ra(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Nr(e){return e=ra(Math.abs(e)),e?e[1]:NaN}function zE(e,t){return function(r,n){for(var i=r.length,a=[],o=0,u=e[0],c=0;i>0&&u>0&&(c+u+1>n&&(u=Math.max(1,n-c)),a.push(r.substring(i-=u,i+u)),!((c+=u+1)>n));)u=e[o=(o+1)%e.length];return a.reverse().join(t)}}function KE(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var HE=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Gn(e){if(!(t=HE.exec(e)))throw new Error("invalid format: "+e);var t;return new op({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Gn.prototype=op.prototype;function op(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}op.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function GE(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var Dw;function VE(e,t){var r=ra(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(Dw=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+ra(e,Math.max(0,t+a-1))[0]}function Yg(e,t){var r=ra(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const Zg={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:WE,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Yg(e*100,t),r:Yg,s:VE,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Jg(e){return e}var Qg=Array.prototype.map,em=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function XE(e){var t=e.grouping===void 0||e.thousands===void 0?Jg:zE(Qg.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?Jg:KE(Qg.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function s(l){l=Gn(l);var h=l.fill,p=l.align,y=l.sign,v=l.symbol,d=l.zero,m=l.width,x=l.comma,w=l.precision,O=l.trim,g=l.type;g==="n"?(x=!0,g="g"):Zg[g]||(w===void 0&&(w=12),O=!0,g="g"),(d||h==="0"&&p==="=")&&(d=!0,h="0",p="=");var b=v==="$"?r:v==="#"&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",_=v==="$"?n:/[%p]/.test(g)?o:"",A=Zg[g],P=/[defgprs%]/.test(g);w=w===void 0?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function j(T){var E=b,M=_,I,$,k;if(g==="c")M=A(T)+M,T="";else{T=+T;var R=T<0||1/T<0;if(T=isNaN(T)?c:A(Math.abs(T),w),O&&(T=GE(T)),R&&+T==0&&y!=="+"&&(R=!1),E=(R?y==="("?y:u:y==="-"||y==="("?"":y)+E,M=(g==="s"?em[8+Dw/3]:"")+M+(R&&y==="("?")":""),P){for(I=-1,$=T.length;++I<$;)if(k=T.charCodeAt(I),48>k||k>57){M=(k===46?i+T.slice(I+1):T.slice(I))+M,T=T.slice(0,I);break}}}x&&!d&&(T=t(T,1/0));var L=E.length+T.length+M.length,B=L>1)+E+T+M+B.slice(L);break;default:T=B+E+T+M;break}return a(T)}return j.toString=function(){return l+""},j}function f(l,h){var p=s((l=Gn(l),l.type="f",l)),y=Math.max(-8,Math.min(8,Math.floor(Nr(h)/3)))*3,v=Math.pow(10,-y),d=em[8+y/3];return function(m){return p(v*m)+d}}return{format:s,formatPrefix:f}}var Ii,up,Nw;YE({thousands:",",grouping:[3],currency:["$",""]});function YE(e){return Ii=XE(e),up=Ii.format,Nw=Ii.formatPrefix,Ii}function ZE(e){return Math.max(0,-Nr(Math.abs(e)))}function JE(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Nr(t)/3)))*3-Nr(Math.abs(e)))}function QE(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Nr(t)-Nr(e))+1}function qw(e,t,r,n){var i=Sf(e,t,r),a;switch(n=Gn(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=JE(i,o))&&(n.precision=a),Nw(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=QE(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=ZE(i))&&(n.precision=a-(n.type==="%")*2);break}}return up(n)}function Ft(e){var t=e.domain;return e.ticks=function(r){var n=t();return _f(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return qw(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,a=n.length-1,o=n[i],u=n[a],c,s,f=10;for(u0;){if(s=Af(o,u,r),s===c)return n[i]=o,n[a]=u,t(n);if(s>0)o=Math.floor(o/s)*s,u=Math.ceil(u/s)*s;else if(s<0)o=Math.ceil(o*s)/s,u=Math.floor(u*s)/s;else break;c=s}return e},e}function na(){var e=ap();return e.copy=function(){return xi(e,na())},it.apply(e,arguments),Ft(e)}function Lw(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,ta),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return Lw(e).unknown(t)},e=arguments.length?Array.from(e,ta):[0,1],Ft(r)}function Bw(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],a=e[n],o;return aMath.pow(e,t)}function ij(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function nm(e){return(t,r)=>-e(-t,r)}function cp(e){const t=e(tm,rm),r=t.domain;let n=10,i,a;function o(){return i=ij(n),a=nj(n),r()[0]<0?(i=nm(i),a=nm(a),e(ej,tj)):e(tm,rm),t}return t.base=function(u){return arguments.length?(n=+u,o()):n},t.domain=function(u){return arguments.length?(r(u),o()):r()},t.ticks=u=>{const c=r();let s=c[0],f=c[c.length-1];const l=f0){for(;h<=p;++h)for(y=1;yf)break;m.push(v)}}else for(;h<=p;++h)for(y=n-1;y>=1;--y)if(v=h>0?y/a(-h):y*a(h),!(vf)break;m.push(v)}m.length*2{if(u==null&&(u=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Gn(c)).precision==null&&(c.trim=!0),c=up(c)),u===1/0)return c;const s=Math.max(1,n*u/t.ticks().length);return f=>{let l=f/a(Math.round(i(f)));return l*nr(Bw(r(),{floor:u=>a(Math.floor(i(u))),ceil:u=>a(Math.ceil(i(u)))})),t}function Fw(){const e=cp(Za()).domain([1,10]);return e.copy=()=>xi(e,Fw()).base(e.base()),it.apply(e,arguments),e}function im(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function am(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function sp(e){var t=1,r=e(im(t),am(t));return r.constant=function(n){return arguments.length?e(im(t=+n),am(t)):t},Ft(r)}function Uw(){var e=sp(Za());return e.copy=function(){return xi(e,Uw()).constant(e.constant())},it.apply(e,arguments)}function om(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function aj(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function oj(e){return e<0?-e*e:e*e}function lp(e){var t=e(Be,Be),r=1;function n(){return r===1?e(Be,Be):r===.5?e(aj,oj):e(om(r),om(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},Ft(t)}function fp(){var e=lp(Za());return e.copy=function(){return xi(e,fp()).exponent(e.exponent())},it.apply(e,arguments),e}function uj(){return fp.apply(null,arguments).exponent(.5)}function um(e){return Math.sign(e)*e*e}function cj(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Ww(){var e=ap(),t=[0,1],r=!1,n;function i(a){var o=cj(e(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return e.invert(um(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,ta)).map(um)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return Ww(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},it.apply(i,arguments),Ft(i)}function zw(){var e=[],t=[],r=[],n;function i(){var o=0,u=Math.max(1,t.length);for(r=new Array(u-1);++o0?r[u-1]:e[0],u=r?[n[r-1],t]:[n[s-1],n[s]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return Kw().domain([e,t]).range(i).unknown(a)},it.apply(Ft(o),arguments)}function Hw(){var e=[.5],t=[0,1],r,n=1;function i(a){return a!=null&&a<=a?t[mi(e,a,0,n)]:r}return i.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return Hw().domain(e).range(t).unknown(r)},it.apply(i,arguments)}const Rs=new Date,Ds=new Date;function Pe(e,t,r,n){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),u=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,u)=>{const c=[];if(a=i.ceil(a),u=u==null?1:Math.floor(u),!(a0))return c;let s;do c.push(s=new Date(+a)),t(a,u),e(a);while(sPe(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,u)=>{if(o>=o)if(u<0)for(;++u<=0;)for(;t(o,-1),!a(o););else for(;--u>=0;)for(;t(o,1),!a(o););}),r&&(i.count=(a,o)=>(Rs.setTime(+a),Ds.setTime(+o),e(Rs),e(Ds),Math.floor(r(Rs,Ds))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const ia=Pe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ia.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Pe(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):ia);ia.range;const St=1e3,rt=St*60,Pt=rt*60,$t=Pt*24,hp=$t*7,cm=$t*30,Ns=$t*365,rr=Pe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*St)},(e,t)=>(t-e)/St,e=>e.getUTCSeconds());rr.range;const pp=Pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*St)},(e,t)=>{e.setTime(+e+t*rt)},(e,t)=>(t-e)/rt,e=>e.getMinutes());pp.range;const dp=Pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*rt)},(e,t)=>(t-e)/rt,e=>e.getUTCMinutes());dp.range;const vp=Pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*St-e.getMinutes()*rt)},(e,t)=>{e.setTime(+e+t*Pt)},(e,t)=>(t-e)/Pt,e=>e.getHours());vp.range;const yp=Pe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Pt)},(e,t)=>(t-e)/Pt,e=>e.getUTCHours());yp.range;const wi=Pe(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*rt)/$t,e=>e.getDate()-1);wi.range;const Ja=Pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/$t,e=>e.getUTCDate()-1);Ja.range;const Gw=Pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/$t,e=>Math.floor(e/$t));Gw.range;function dr(e){return Pe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*rt)/hp)}const Qa=dr(0),aa=dr(1),sj=dr(2),lj=dr(3),qr=dr(4),fj=dr(5),hj=dr(6);Qa.range;aa.range;sj.range;lj.range;qr.range;fj.range;hj.range;function vr(e){return Pe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/hp)}const eo=vr(0),oa=vr(1),pj=vr(2),dj=vr(3),Lr=vr(4),vj=vr(5),yj=vr(6);eo.range;oa.range;pj.range;dj.range;Lr.range;vj.range;yj.range;const gp=Pe(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());gp.range;const mp=Pe(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());mp.range;const It=Pe(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());It.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Pe(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});It.range;const Ct=Pe(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Ct.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Pe(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});Ct.range;function Vw(e,t,r,n,i,a){const o=[[rr,1,St],[rr,5,5*St],[rr,15,15*St],[rr,30,30*St],[a,1,rt],[a,5,5*rt],[a,15,15*rt],[a,30,30*rt],[i,1,Pt],[i,3,3*Pt],[i,6,6*Pt],[i,12,12*Pt],[n,1,$t],[n,2,2*$t],[r,1,hp],[t,1,cm],[t,3,3*cm],[e,1,Ns]];function u(s,f,l){const h=fd).right(o,h);if(p===o.length)return e.every(Sf(s/Ns,f/Ns,l));if(p===0)return ia.every(Math.max(Sf(s,f,l),1));const[y,v]=o[h/o[p-1][2]53)return null;"w"in D||(D.w=1),"Z"in D?(re=Ls(mn(D.y,0,1)),Y=re.getUTCDay(),re=Y>4||Y===0?oa.ceil(re):oa(re),re=Ja.offset(re,(D.V-1)*7),D.y=re.getUTCFullYear(),D.m=re.getUTCMonth(),D.d=re.getUTCDate()+(D.w+6)%7):(re=qs(mn(D.y,0,1)),Y=re.getDay(),re=Y>4||Y===0?aa.ceil(re):aa(re),re=wi.offset(re,(D.V-1)*7),D.y=re.getFullYear(),D.m=re.getMonth(),D.d=re.getDate()+(D.w+6)%7)}else("W"in D||"U"in D)&&("w"in D||(D.w="u"in D?D.u%7:"W"in D?1:0),Y="Z"in D?Ls(mn(D.y,0,1)).getUTCDay():qs(mn(D.y,0,1)).getDay(),D.m=0,D.d="W"in D?(D.w+6)%7+D.W*7-(Y+5)%7:D.w+D.U*7-(Y+6)%7);return"Z"in D?(D.H+=D.Z/100|0,D.M+=D.Z%100,Ls(D)):qs(D)}}function A(F,Q,ee,D){for(var ve=0,re=Q.length,Y=ee.length,ye,Z;ve=Y)return-1;if(ye=Q.charCodeAt(ve++),ye===37){if(ye=Q.charAt(ve++),Z=g[ye in sm?Q.charAt(ve++):ye],!Z||(D=Z(F,ee,D))<0)return-1}else if(ye!=ee.charCodeAt(D++))return-1}return D}function P(F,Q,ee){var D=s.exec(Q.slice(ee));return D?(F.p=f.get(D[0].toLowerCase()),ee+D[0].length):-1}function j(F,Q,ee){var D=p.exec(Q.slice(ee));return D?(F.w=y.get(D[0].toLowerCase()),ee+D[0].length):-1}function T(F,Q,ee){var D=l.exec(Q.slice(ee));return D?(F.w=h.get(D[0].toLowerCase()),ee+D[0].length):-1}function E(F,Q,ee){var D=m.exec(Q.slice(ee));return D?(F.m=x.get(D[0].toLowerCase()),ee+D[0].length):-1}function M(F,Q,ee){var D=v.exec(Q.slice(ee));return D?(F.m=d.get(D[0].toLowerCase()),ee+D[0].length):-1}function I(F,Q,ee){return A(F,t,Q,ee)}function $(F,Q,ee){return A(F,r,Q,ee)}function k(F,Q,ee){return A(F,n,Q,ee)}function R(F){return o[F.getDay()]}function L(F){return a[F.getDay()]}function B(F){return c[F.getMonth()]}function z(F){return u[F.getMonth()]}function H(F){return i[+(F.getHours()>=12)]}function U(F){return 1+~~(F.getMonth()/3)}function G(F){return o[F.getUTCDay()]}function se(F){return a[F.getUTCDay()]}function me(F){return c[F.getUTCMonth()]}function De(F){return u[F.getUTCMonth()]}function wt(F){return i[+(F.getUTCHours()>=12)]}function Ie(F){return 1+~~(F.getUTCMonth()/3)}return{format:function(F){var Q=b(F+="",w);return Q.toString=function(){return F},Q},parse:function(F){var Q=_(F+="",!1);return Q.toString=function(){return F},Q},utcFormat:function(F){var Q=b(F+="",O);return Q.toString=function(){return F},Q},utcParse:function(F){var Q=_(F+="",!0);return Q.toString=function(){return F},Q}}}var sm={"-":"",_:" ",0:"0"},Me=/^\s*\d+/,Oj=/^%/,_j=/[\\^$*+?|[\]().{}]/g;function ie(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a[t.toLowerCase(),r]))}function Sj(e,t,r){var n=Me.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Pj(e,t,r){var n=Me.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Tj(e,t,r){var n=Me.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Ej(e,t,r){var n=Me.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function jj(e,t,r){var n=Me.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function lm(e,t,r){var n=Me.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function fm(e,t,r){var n=Me.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Mj(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function $j(e,t,r){var n=Me.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Ij(e,t,r){var n=Me.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function hm(e,t,r){var n=Me.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Cj(e,t,r){var n=Me.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function pm(e,t,r){var n=Me.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function kj(e,t,r){var n=Me.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Rj(e,t,r){var n=Me.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Dj(e,t,r){var n=Me.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function Nj(e,t,r){var n=Me.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function qj(e,t,r){var n=Oj.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function Lj(e,t,r){var n=Me.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Bj(e,t,r){var n=Me.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function dm(e,t){return ie(e.getDate(),t,2)}function Fj(e,t){return ie(e.getHours(),t,2)}function Uj(e,t){return ie(e.getHours()%12||12,t,2)}function Wj(e,t){return ie(1+wi.count(It(e),e),t,3)}function Xw(e,t){return ie(e.getMilliseconds(),t,3)}function zj(e,t){return Xw(e,t)+"000"}function Kj(e,t){return ie(e.getMonth()+1,t,2)}function Hj(e,t){return ie(e.getMinutes(),t,2)}function Gj(e,t){return ie(e.getSeconds(),t,2)}function Vj(e){var t=e.getDay();return t===0?7:t}function Xj(e,t){return ie(Qa.count(It(e)-1,e),t,2)}function Yw(e){var t=e.getDay();return t>=4||t===0?qr(e):qr.ceil(e)}function Yj(e,t){return e=Yw(e),ie(qr.count(It(e),e)+(It(e).getDay()===4),t,2)}function Zj(e){return e.getDay()}function Jj(e,t){return ie(aa.count(It(e)-1,e),t,2)}function Qj(e,t){return ie(e.getFullYear()%100,t,2)}function eM(e,t){return e=Yw(e),ie(e.getFullYear()%100,t,2)}function tM(e,t){return ie(e.getFullYear()%1e4,t,4)}function rM(e,t){var r=e.getDay();return e=r>=4||r===0?qr(e):qr.ceil(e),ie(e.getFullYear()%1e4,t,4)}function nM(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ie(t/60|0,"0",2)+ie(t%60,"0",2)}function vm(e,t){return ie(e.getUTCDate(),t,2)}function iM(e,t){return ie(e.getUTCHours(),t,2)}function aM(e,t){return ie(e.getUTCHours()%12||12,t,2)}function oM(e,t){return ie(1+Ja.count(Ct(e),e),t,3)}function Zw(e,t){return ie(e.getUTCMilliseconds(),t,3)}function uM(e,t){return Zw(e,t)+"000"}function cM(e,t){return ie(e.getUTCMonth()+1,t,2)}function sM(e,t){return ie(e.getUTCMinutes(),t,2)}function lM(e,t){return ie(e.getUTCSeconds(),t,2)}function fM(e){var t=e.getUTCDay();return t===0?7:t}function hM(e,t){return ie(eo.count(Ct(e)-1,e),t,2)}function Jw(e){var t=e.getUTCDay();return t>=4||t===0?Lr(e):Lr.ceil(e)}function pM(e,t){return e=Jw(e),ie(Lr.count(Ct(e),e)+(Ct(e).getUTCDay()===4),t,2)}function dM(e){return e.getUTCDay()}function vM(e,t){return ie(oa.count(Ct(e)-1,e),t,2)}function yM(e,t){return ie(e.getUTCFullYear()%100,t,2)}function gM(e,t){return e=Jw(e),ie(e.getUTCFullYear()%100,t,2)}function mM(e,t){return ie(e.getUTCFullYear()%1e4,t,4)}function bM(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Lr(e):Lr.ceil(e),ie(e.getUTCFullYear()%1e4,t,4)}function xM(){return"+0000"}function ym(){return"%"}function gm(e){return+e}function mm(e){return Math.floor(+e/1e3)}var xr,Qw,eO;wM({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function wM(e){return xr=wj(e),Qw=xr.format,xr.parse,eO=xr.utcFormat,xr.utcParse,xr}function OM(e){return new Date(e)}function _M(e){return e instanceof Date?+e:+new Date(+e)}function bp(e,t,r,n,i,a,o,u,c,s){var f=ap(),l=f.invert,h=f.domain,p=s(".%L"),y=s(":%S"),v=s("%I:%M"),d=s("%I %p"),m=s("%a %d"),x=s("%b %d"),w=s("%B"),O=s("%Y");function g(b){return(c(b)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>uE(e,a/n))},r.copy=function(){return iO(t).domain(e)},Rt.apply(r,arguments)}function ro(){var e=0,t=.5,r=1,n=1,i,a,o,u,c,s=Be,f,l=!1,h;function p(v){return isNaN(v=+v)?h:(v=.5+((v=+f(v))-a)*(n*vr}return Fs=e,Fs}var Us,Om;function EM(){if(Om)return Us;Om=1;var e=no(),t=cO(),r=ln();function n(i){return i&&i.length?e(i,r,t):void 0}return Us=n,Us}var jM=EM();const io=ce(jM);var Ws,_m;function sO(){if(_m)return Ws;_m=1;function e(t,r){return te.e^a.s<0?1:-1;for(n=a.d.length,i=e.d.length,t=0,r=ne.d[t]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};W.decimalPlaces=W.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*de;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};W.dividedBy=W.div=function(e){return jt(this,new this.constructor(e))};W.dividedToIntegerBy=W.idiv=function(e){var t=this,r=t.constructor;return le(jt(t,new r(e),0,1),r.precision)};W.equals=W.eq=function(e){return!this.cmp(e)};W.exponent=function(){return we(this)};W.greaterThan=W.gt=function(e){return this.cmp(e)>0};W.greaterThanOrEqualTo=W.gte=function(e){return this.cmp(e)>=0};W.isInteger=W.isint=function(){return this.e>this.d.length-2};W.isNegative=W.isneg=function(){return this.s<0};W.isPositive=W.ispos=function(){return this.s>0};W.isZero=function(){return this.s===0};W.lessThan=W.lt=function(e){return this.cmp(e)<0};W.lessThanOrEqualTo=W.lte=function(e){return this.cmp(e)<1};W.logarithm=W.log=function(e){var t,r=this,n=r.constructor,i=n.precision,a=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Ve))throw Error(nt+"NaN");if(r.s<1)throw Error(nt+(r.s?"NaN":"-Infinity"));return r.eq(Ve)?new n(0):(ge=!1,t=jt(Vn(r,a),Vn(e,a),a),ge=!0,le(t,i))};W.minus=W.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?pO(t,e):fO(t,(e.s=-e.s,e))};W.modulo=W.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(nt+"NaN");return r.s?(ge=!1,t=jt(r,e,0,1).times(e),ge=!0,r.minus(t)):le(new n(r),i)};W.naturalExponential=W.exp=function(){return hO(this)};W.naturalLogarithm=W.ln=function(){return Vn(this)};W.negated=W.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};W.plus=W.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?fO(t,e):pO(t,(e.s=-e.s,e))};W.precision=W.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ar+e);if(t=we(i)+1,n=i.d.length-1,r=n*de+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};W.squareRoot=W.sqrt=function(){var e,t,r,n,i,a,o,u=this,c=u.constructor;if(u.s<1){if(!u.s)return new c(0);throw Error(nt+"NaN")}for(e=we(u),ge=!1,i=Math.sqrt(+u),i==0||i==1/0?(t=vt(u.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=pn((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(i.toString()),r=c.precision,i=o=r+3;;)if(a=n,n=a.plus(jt(u,a,o+2)).times(.5),vt(a.d).slice(0,o)===(t=vt(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(le(a,r+1,0),a.times(a).eq(u)){n=a;break}}else if(t!="9999")break;o+=4}return ge=!0,le(n,r)};W.times=W.mul=function(e){var t,r,n,i,a,o,u,c,s,f=this,l=f.constructor,h=f.d,p=(e=new l(e)).d;if(!f.s||!e.s)return new l(0);for(e.s*=f.s,r=f.e+e.e,c=h.length,s=p.length,c=0;){for(t=0,i=c+n;i>n;)u=a[i]+p[n]*h[i-n-1]+t,a[i--]=u%Ee|0,t=u/Ee|0;a[i]=(a[i]+t)%Ee|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,ge?le(e,l.precision):e};W.toDecimalPlaces=W.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(mt(e,0,hn),t===void 0?t=n.rounding:mt(t,0,8),le(r,e+we(r)+1,t))};W.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=lr(n,!0):(mt(e,0,hn),t===void 0?t=i.rounding:mt(t,0,8),n=le(new i(n),e+1,t),r=lr(n,!0,e+1)),r};W.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?lr(i):(mt(e,0,hn),t===void 0?t=a.rounding:mt(t,0,8),n=le(new a(i),e+we(i)+1,t),r=lr(n.abs(),!1,e+we(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};W.toInteger=W.toint=function(){var e=this,t=e.constructor;return le(new t(e),we(e)+1,t.rounding)};W.toNumber=function(){return+this};W.toPower=W.pow=function(e){var t,r,n,i,a,o,u=this,c=u.constructor,s=12,f=+(e=new c(e));if(!e.s)return new c(Ve);if(u=new c(u),!u.s){if(e.s<1)throw Error(nt+"Infinity");return u}if(u.eq(Ve))return u;if(n=c.precision,e.eq(Ve))return le(u,n);if(t=e.e,r=e.d.length-1,o=t>=r,a=u.s,o){if((r=f<0?-f:f)<=lO){for(i=new c(Ve),t=Math.ceil(n/de+4),ge=!1;r%2&&(i=i.times(u),jm(i.d,t)),r=pn(r/2),r!==0;)u=u.times(u),jm(u.d,t);return ge=!0,e.s<0?new c(Ve).div(i):le(i,n)}}else if(a<0)throw Error(nt+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,ge=!1,i=e.times(Vn(u,n+s)),ge=!0,i=hO(i),i.s=a,i};W.toPrecision=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?(r=we(i),n=lr(i,r<=a.toExpNeg||r>=a.toExpPos)):(mt(e,1,hn),t===void 0?t=a.rounding:mt(t,0,8),i=le(new a(i),e,t),r=we(i),n=lr(i,e<=r||r<=a.toExpNeg,e)),n};W.toSignificantDigits=W.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(mt(e,1,hn),t===void 0?t=n.rounding:mt(t,0,8)),le(new n(r),e,t)};W.toString=W.valueOf=W.val=W.toJSON=W[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=we(e),r=e.constructor;return lr(e,t<=r.toExpNeg||t>=r.toExpPos)};function fO(e,t){var r,n,i,a,o,u,c,s,f=e.constructor,l=f.precision;if(!e.s||!t.s)return t.s||(t=new f(e)),ge?le(t,l):t;if(c=e.d,s=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(n=c,a=-a,u=s.length):(n=s,i=o,u=c.length),o=Math.ceil(l/de),u=o>u?o+1:u+1,a>u&&(a=u,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(u=c.length,a=s.length,u-a<0&&(a=u,n=s,s=c,c=n),r=0;a;)r=(c[--a]=c[a]+s[a]+r)/Ee|0,c[a]%=Ee;for(r&&(c.unshift(r),++i),u=c.length;c[--u]==0;)c.pop();return t.d=c,t.e=i,ge?le(t,l):t}function mt(e,t,r){if(e!==~~e||er)throw Error(ar+e)}function vt(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(u=c=0;ui[u]?1:-1;break}return c}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]1;)n.shift()}return function(n,i,a,o){var u,c,s,f,l,h,p,y,v,d,m,x,w,O,g,b,_,A,P=n.constructor,j=n.s==i.s?1:-1,T=n.d,E=i.d;if(!n.s)return new P(n);if(!i.s)throw Error(nt+"Division by zero");for(c=n.e-i.e,_=E.length,g=T.length,p=new P(j),y=p.d=[],s=0;E[s]==(T[s]||0);)++s;if(E[s]>(T[s]||0)&&--c,a==null?x=a=P.precision:o?x=a+(we(n)-we(i))+1:x=a,x<0)return new P(0);if(x=x/de+2|0,s=0,_==1)for(f=0,E=E[0],x++;(s1&&(E=e(E,f),T=e(T,f),_=E.length,g=T.length),O=_,v=T.slice(0,_),d=v.length;d<_;)v[d++]=0;A=E.slice(),A.unshift(0),b=E[0],E[1]>=Ee/2&&++b;do f=0,u=t(E,v,_,d),u<0?(m=v[0],_!=d&&(m=m*Ee+(v[1]||0)),f=m/b|0,f>1?(f>=Ee&&(f=Ee-1),l=e(E,f),h=l.length,d=v.length,u=t(l,v,h,d),u==1&&(f--,r(l,_16)throw Error(Op+we(e));if(!e.s)return new f(Ve);for(ge=!1,u=l,o=new f(.03125);e.abs().gte(.1);)e=e.times(o),s+=5;for(n=Math.log(Jt(2,s))/Math.LN10*2+5|0,u+=n,r=i=a=new f(Ve),f.precision=u;;){if(i=le(i.times(e),u),r=r.times(++c),o=a.plus(jt(i,r,u)),vt(o.d).slice(0,u)===vt(a.d).slice(0,u)){for(;s--;)a=le(a.times(a),u);return f.precision=l,t==null?(ge=!0,le(a,l)):a}a=o}}function we(e){for(var t=e.e*de,r=e.d[0];r>=10;r/=10)t++;return t}function Vs(e,t,r){if(t>e.LN10.sd())throw ge=!0,r&&(e.precision=r),Error(nt+"LN10 precision limit exceeded");return le(new e(e.LN10),t)}function Nt(e){for(var t="";e--;)t+="0";return t}function Vn(e,t){var r,n,i,a,o,u,c,s,f,l=1,h=10,p=e,y=p.d,v=p.constructor,d=v.precision;if(p.s<1)throw Error(nt+(p.s?"NaN":"-Infinity"));if(p.eq(Ve))return new v(0);if(t==null?(ge=!1,s=d):s=t,p.eq(10))return t==null&&(ge=!0),Vs(v,s);if(s+=h,v.precision=s,r=vt(y),n=r.charAt(0),a=we(p),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(e),r=vt(p.d),n=r.charAt(0),l++;a=we(p),n>1?(p=new v("0."+r),a++):p=new v(n+"."+r.slice(1))}else return c=Vs(v,s+2,d).times(a+""),p=Vn(new v(n+"."+r.slice(1)),s-h).plus(c),v.precision=d,t==null?(ge=!0,le(p,d)):p;for(u=o=p=jt(p.minus(Ve),p.plus(Ve),s),f=le(p.times(p),s),i=3;;){if(o=le(o.times(f),s),c=u.plus(jt(o,new v(i),s)),vt(c.d).slice(0,s)===vt(u.d).slice(0,s))return u=u.times(2),a!==0&&(u=u.plus(Vs(v,s+2,d).times(a+""))),u=jt(u,new v(l),s),v.precision=d,t==null?(ge=!0,le(u,d)):u;u=c,i+=2}}function Em(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=pn(r/de),e.d=[],n=(r+1)%de,r<0&&(n+=de),nua||e.e<-ua))throw Error(Op+r)}else e.s=0,e.e=0,e.d=[0];return e}function le(e,t,r){var n,i,a,o,u,c,s,f,l=e.d;for(o=1,a=l[0];a>=10;a/=10)o++;if(n=t-o,n<0)n+=de,i=t,s=l[f=0];else{if(f=Math.ceil((n+1)/de),a=l.length,f>=a)return e;for(s=a=l[f],o=1;a>=10;a/=10)o++;n%=de,i=n-de+o}if(r!==void 0&&(a=Jt(10,o-i-1),u=s/a%10|0,c=t<0||l[f+1]!==void 0||s%a,c=r<4?(u||c)&&(r==0||r==(e.s<0?3:2)):u>5||u==5&&(r==4||c||r==6&&(n>0?i>0?s/Jt(10,o-i):0:l[f-1])%10&1||r==(e.s<0?8:7))),t<1||!l[0])return c?(a=we(e),l.length=1,t=t-a-1,l[0]=Jt(10,(de-t%de)%de),e.e=pn(-t/de)||0):(l.length=1,l[0]=e.e=e.s=0),e;if(n==0?(l.length=f,a=1,f--):(l.length=f+1,a=Jt(10,de-n),l[f]=i>0?(s/Jt(10,o-i)%Jt(10,i)|0)*a:0),c)for(;;)if(f==0){(l[0]+=a)==Ee&&(l[0]=1,++e.e);break}else{if(l[f]+=a,l[f]!=Ee)break;l[f--]=0,a=1}for(n=l.length;l[--n]===0;)l.pop();if(ge&&(e.e>ua||e.e<-ua))throw Error(Op+we(e));return e}function pO(e,t){var r,n,i,a,o,u,c,s,f,l,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),ge?le(t,p):t;if(c=e.d,l=t.d,n=t.e,s=e.e,c=c.slice(),o=s-n,o){for(f=o<0,f?(r=c,o=-o,u=l.length):(r=l,n=s,u=c.length),i=Math.max(Math.ceil(p/de),u)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=c.length,u=l.length,f=i0;--i)c[u++]=0;for(i=l.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+Nt(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+Nt(-i-1)+a,r&&(n=r-o)>0&&(a+=Nt(n))):i>=o?(a+=Nt(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+Nt(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=Nt(n))),e.s<0?"-"+a:a}function jm(e,t){if(e.length>t)return e.length=t,!0}function dO(e){var t,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(ar+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return Em(o,a.toString())}else if(typeof a!="string")throw Error(ar+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,LM.test(a))Em(o,a);else throw Error(ar+a)}if(i.prototype=W,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=dO,i.config=i.set=BM,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(ar+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(ar+r+": "+n);return this}var _p=dO(qM);Ve=new _p(1);const ue=_p;function FM(e){return KM(e)||zM(e)||WM(e)||UM()}function UM(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WM(e,t){if(e){if(typeof e=="string")return $f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $f(e,t)}}function zM(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function KM(e){if(Array.isArray(e))return $f(e)}function $f(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t?r.apply(void 0,i):e(t-o,Mm(function(){for(var u=arguments.length,c=new Array(u),s=0;se.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),u;!(n=(u=o.next()).done)&&(r.push(u.value),!(t&&r.length===t));n=!0);}catch(c){i=!0,a=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw a}}return r}}function o$(e){if(Array.isArray(e))return e}function bO(e){var t=Xn(e,2),r=t[0],n=t[1],i=r,a=n;return r>n&&(i=n,a=r),[i,a]}function xO(e,t,r){if(e.lte(0))return new ue(0);var n=uo.getDigitCount(e.toNumber()),i=new ue(10).pow(n),a=e.div(i),o=n!==1?.05:.1,u=new ue(Math.ceil(a.div(o).toNumber())).add(r).mul(o),c=u.mul(i);return t?c:new ue(Math.ceil(c))}function u$(e,t,r){var n=1,i=new ue(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new ue(10).pow(uo.getDigitCount(e)-1),i=new ue(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new ue(Math.floor(e)))}else e===0?i=new ue(Math.floor((t-1)/2)):r||(i=new ue(Math.floor(e)));var o=Math.floor((t-1)/2),u=XM(VM(function(c){return i.add(new ue(c-o).mul(n)).toNumber()}),If);return u(0,t)}function wO(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new ue(0),tickMin:new ue(0),tickMax:new ue(0)};var a=xO(new ue(t).sub(e).div(r-1),n,i),o;e<=0&&t>=0?o=new ue(0):(o=new ue(e).add(t).div(2),o=o.sub(new ue(o).mod(a)));var u=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new ue(t).sub(o).div(a).toNumber()),s=u+c+1;return s>r?wO(e,t,r,n,i+1):(s0?c+(r-s):c,u=t>0?u:u+(r-s)),{step:a,tickMin:o.sub(new ue(u).mul(a)),tickMax:o.add(new ue(c).mul(a))})}function c$(e){var t=Xn(e,2),r=t[0],n=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),u=bO([r,n]),c=Xn(u,2),s=c[0],f=c[1];if(s===-1/0||f===1/0){var l=f===1/0?[s].concat(kf(If(0,i-1).map(function(){return 1/0}))):[].concat(kf(If(0,i-1).map(function(){return-1/0})),[f]);return r>n?Cf(l):l}if(s===f)return u$(s,i,a);var h=wO(s,f,o,a),p=h.step,y=h.tickMin,v=h.tickMax,d=uo.rangeStep(y,v.add(new ue(.1).mul(p)),p);return r>n?Cf(d):d}function s$(e,t){var r=Xn(e,2),n=r[0],i=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=bO([n,i]),u=Xn(o,2),c=u[0],s=u[1];if(c===-1/0||s===1/0)return[n,i];if(c===s)return[c];var f=Math.max(t,2),l=xO(new ue(s).sub(c).div(f-1),a,0),h=[].concat(kf(uo.rangeStep(new ue(c),new ue(s).sub(new ue(.99).mul(l)),l)),[s]);return n>i?Cf(h):h}var l$=gO(c$),f$=gO(s$),h$=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Br(e){"@babel/helpers - typeof";return Br=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Br(e)}function ca(){return ca=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function b$(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function x$(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w$(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,u=(r=n?.length)!==null&&r!==void 0?r:0;if(u<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,s=0;s0?i[s-1].coordinate:i[u-1].coordinate,l=i[s].coordinate,h=s>=u-1?i[0].coordinate:i[s+1].coordinate,p=void 0;if(qe(l-f)!==qe(h-l)){var y=[];if(qe(h-l)===qe(c[1]-c[0])){p=h;var v=l+c[1]-c[0];y[0]=Math.min(v,(v+f)/2),y[1]=Math.max(v,(v+f)/2)}else{p=f;var d=h+c[1]-c[0];y[0]=Math.min(l,(d+l)/2),y[1]=Math.max(l,(d+l)/2)}var m=[Math.min(l,(p+l)/2),Math.max(l,(p+l)/2)];if(t>m[0]&&t<=m[1]||t>=y[0]&&t<=y[1]){o=i[s].index;break}}else{var x=Math.min(f,h),w=Math.max(f,h);if(t>(x+l)/2&&t<=(w+l)/2){o=i[s].index;break}}}else for(var O=0;O0&&O(n[O].coordinate+n[O-1].coordinate)/2&&t<=(n[O].coordinate+n[O+1].coordinate)/2||O===u-1&&t>(n[O].coordinate+n[O-1].coordinate)/2){o=n[O].index;break}return o},Ap=function(t){var r,n=t,i=n.type.displayName,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?be(be({},t.type.defaultProps),t.props):t.props,o=a.stroke,u=a.fill,c;switch(i){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:u;break;default:c=u;break}return c},q$=function(t){var r=t.barSize,n=t.totalSize,i=t.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},u=Object.keys(a),c=0,s=u.length;c=0});if(m&&m.length){var x=m[0].type.defaultProps,w=x!==void 0?be(be({},x),m[0].props):m[0].props,O=w.barSize,g=w[d];o[g]||(o[g]=[]);var b=J(O)?r:O;o[g].push({item:m[0],stackList:m.slice(1),barSize:J(b)?void 0:Le(b,n,0)})}}return o},L$=function(t){var r=t.barGap,n=t.barCategoryGap,i=t.bandSize,a=t.sizeList,o=a===void 0?[]:a,u=t.maxBarSize,c=o.length;if(c<1)return null;var s=Le(r,i,0,!0),f,l=[];if(o[0].barSize===+o[0].barSize){var h=!1,p=i/c,y=o.reduce(function(O,g){return O+g.barSize||0},0);y+=(c-1)*s,y>=i&&(y-=(c-1)*s,s=0),y>=i&&p>0&&(h=!0,p*=.9,y=c*p);var v=(i-y)/2>>0,d={offset:v-s,size:0};f=o.reduce(function(O,g){var b={item:g.item,position:{offset:d.offset+d.size+s,size:h?p:g.barSize}},_=[].concat(Cm(O),[b]);return d=_[_.length-1].position,g.stackList&&g.stackList.length&&g.stackList.forEach(function(A){_.push({item:A,position:d})}),_},l)}else{var m=Le(n,i,0,!0);i-2*m-(c-1)*s<=0&&(s=0);var x=(i-2*m-(c-1)*s)/c;x>1&&(x>>=0);var w=u===+u?Math.min(x,u):x;f=o.reduce(function(O,g,b){var _=[].concat(Cm(O),[{item:g.item,position:{offset:m+(x+s)*b+(x-w)/2,size:w}}]);return g.stackList&&g.stackList.length&&g.stackList.forEach(function(A){_.push({item:A,position:_[_.length-1].position})}),_},l)}return f},B$=function(t,r,n,i){var a=n.children,o=n.width,u=n.margin,c=o-(u.left||0)-(u.right||0),s=SO({children:a,legendWidth:c});if(s){var f=i||{},l=f.width,h=f.height,p=s.align,y=s.verticalAlign,v=s.layout;if((v==="vertical"||v==="horizontal"&&y==="middle")&&p!=="center"&&q(t[p]))return be(be({},t),{},$r({},p,t[p]+(l||0)));if((v==="horizontal"||v==="vertical"&&p==="center")&&y!=="middle"&&q(t[y]))return be(be({},t),{},$r({},y,t[y]+(h||0)))}return t},F$=function(t,r,n){return J(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},PO=function(t,r,n,i,a){var o=r.props.children,u=Ye(o,_i).filter(function(s){return F$(i,a,s.props.direction)});if(u&&u.length){var c=u.map(function(s){return s.props.dataKey});return t.reduce(function(s,f){var l=Ae(f,n);if(J(l))return s;var h=Array.isArray(l)?[ao(l),io(l)]:[l,l],p=c.reduce(function(y,v){var d=Ae(f,v,0),m=h[0]-Math.abs(Array.isArray(d)?d[0]:d),x=h[1]+Math.abs(Array.isArray(d)?d[1]:d);return[Math.min(m,y[0]),Math.max(x,y[1])]},[1/0,-1/0]);return[Math.min(p[0],s[0]),Math.max(p[1],s[1])]},[1/0,-1/0])}return null},U$=function(t,r,n,i,a){var o=r.map(function(u){return PO(t,u,n,a,i)}).filter(function(u){return!J(u)});return o&&o.length?o.reduce(function(u,c){return[Math.min(u[0],c[0]),Math.max(u[1],c[1])]},[1/0,-1/0]):null},TO=function(t,r,n,i,a){var o=r.map(function(c){var s=c.props.dataKey;return n==="number"&&s&&PO(t,c,s,i)||$n(t,s,n,a)});if(n==="number")return o.reduce(function(c,s){return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]);var u={};return o.reduce(function(c,s){for(var f=0,l=s.length;f=2?qe(u[0]-u[1])*2*s:s,r&&(t.ticks||t.niceTicks)){var f=(t.ticks||t.niceTicks).map(function(l){var h=a?a.indexOf(l):l;return{coordinate:i(h)+s,value:l,offset:s}});return f.filter(function(l){return!gi(l.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(l,h){return{coordinate:i(l)+s,value:l,index:h,offset:s}}):i.ticks&&!n?i.ticks(t.tickCount).map(function(l){return{coordinate:i(l)+s,value:l,offset:s}}):i.domain().map(function(l,h){return{coordinate:i(l)+s,value:a?a[l]:l,index:h,offset:s}})},Xs=new WeakMap,Ci=function(t,r){if(typeof r!="function")return t;Xs.has(t)||Xs.set(t,new WeakMap);var n=Xs.get(t);if(n.has(r))return n.get(r);var i=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},MO=function(t,r,n){var i=t.scale,a=t.type,o=t.layout,u=t.axisType;if(i==="auto")return o==="radial"&&u==="radiusAxis"?{scale:Wn(),realScaleType:"band"}:o==="radial"&&u==="angleAxis"?{scale:na(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:Mn(),realScaleType:"point"}:a==="category"?{scale:Wn(),realScaleType:"band"}:{scale:na(),realScaleType:"linear"};if(ur(i)){var c="scale".concat(Wa(i));return{scale:(bm[c]||Mn)(),realScaleType:bm[c]?c:"point"}}return X(i)?{scale:i}:{scale:Mn(),realScaleType:"point"}},Rm=1e-4,$O=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,i=t.range(),a=Math.min(i[0],i[1])-Rm,o=Math.max(i[0],i[1])+Rm,u=t(r[0]),c=t(r[n-1]);(uo||co)&&t.domain([r[0],r[n-1]])}},W$=function(t,r){if(!t)return null;for(var n=0,i=t.length;ni)&&(a[1]=i),a[0]>i&&(a[0]=i),a[1]=0?(t[u][n][0]=a,t[u][n][1]=a+c,a=t[u][n][1]):(t[u][n][0]=o,t[u][n][1]=o+c,o=t[u][n][1])}},H$=function(t){var r=t.length;if(!(r<=0))for(var n=0,i=t[0].length;n=0?(t[o][n][0]=a,t[o][n][1]=a+u,a=t[o][n][1]):(t[o][n][0]=0,t[o][n][1]=0)}},G$={sign:K$,expand:FA,none:Ir,silhouette:UA,wiggle:WA,positive:H$},V$=function(t,r,n){var i=r.map(function(u){return u.props.dataKey}),a=G$[n],o=BA().keys(i).value(function(u,c){return+Ae(u,c,0)}).order(hf).offset(a);return o(t)},X$=function(t,r,n,i,a,o){if(!t)return null;var u=o?r.reverse():r,c={},s=u.reduce(function(l,h){var p,y=(p=h.type)!==null&&p!==void 0&&p.defaultProps?be(be({},h.type.defaultProps),h.props):h.props,v=y.stackId,d=y.hide;if(d)return l;var m=y[n],x=l[m]||{hasStack:!1,stackGroups:{}};if(Se(v)){var w=x.stackGroups[v]||{numericAxisId:n,cateAxisId:i,items:[]};w.items.push(h),x.hasStack=!0,x.stackGroups[v]=w}else x.stackGroups[un("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[h]};return be(be({},l),{},$r({},m,x))},c),f={};return Object.keys(s).reduce(function(l,h){var p=s[h];if(p.hasStack){var y={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(v,d){var m=p.stackGroups[d];return be(be({},v),{},$r({},d,{numericAxisId:n,cateAxisId:i,items:m.items,stackedData:V$(t,m.items,a)}))},y)}return be(be({},l),{},$r({},h,p))},f)},IO=function(t,r){var n=r.realScaleType,i=r.type,a=r.tickCount,o=r.originalDomain,u=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var s=t.domain();if(!s.length)return null;var f=l$(s,a,u);return t.domain([ao(f),io(f)]),{niceTicks:f}}if(a&&i==="number"){var l=t.domain(),h=f$(l,a,u);return{niceTicks:h}}return null};function Dm(e){var t=e.axis,r=e.ticks,n=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!J(i[t.dataKey])){var u=Bi(r,"value",i[t.dataKey]);if(u)return u.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var c=Ae(i,J(o)?t.dataKey:o);return J(c)?null:t.scale(c)}var Nm=function(t){var r=t.axis,n=t.ticks,i=t.offset,a=t.bandSize,o=t.entry,u=t.index;if(r.type==="category")return n[u]?n[u].coordinate+i:null;var c=Ae(o,r.dataKey,r.domain[u]);return J(c)?null:r.scale(c)-a/2+i},Y$=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return i<=0&&a>=0?0:a<0?a:i}return n[0]},Z$=function(t,r){var n,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?be(be({},t.type.defaultProps),t.props):t.props,a=i.stackId;if(Se(a)){var o=r[a];if(o){var u=o.items.indexOf(t);return u>=0?o.stackedData[u]:null}}return null},J$=function(t){return t.reduce(function(r,n){return[ao(n.concat([r[0]]).filter(q)),io(n.concat([r[1]]).filter(q))]},[1/0,-1/0])},CO=function(t,r,n){return Object.keys(t).reduce(function(i,a){var o=t[a],u=o.stackedData,c=u.reduce(function(s,f){var l=J$(f.slice(r,n+1));return[Math.min(s[0],l[0]),Math.max(s[1],l[1])]},[1/0,-1/0]);return[Math.min(c[0],i[0]),Math.max(c[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},qm=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Lm=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,qf=function(t,r,n){if(X(t))return t(r,n);if(!Array.isArray(t))return r;var i=[];if(q(t[0]))i[0]=n?t[0]:Math.min(t[0],r[0]);else if(qm.test(t[0])){var a=+qm.exec(t[0])[1];i[0]=r[0]-a}else X(t[0])?i[0]=t[0](r[0]):i[0]=r[0];if(q(t[1]))i[1]=n?t[1]:Math.max(t[1],r[1]);else if(Lm.test(t[1])){var o=+Lm.exec(t[1])[1];i[1]=r[1]+o}else X(t[1])?i[1]=t[1](r[1]):i[1]=r[1];return i},la=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!n||i>0)return i}if(t&&r&&r.length>=2){for(var a=Zh(r,function(l){return l.coordinate}),o=1/0,u=1,c=a.length;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},uI=function(t,r,n,i,a){var o=t.width,u=t.height,c=t.startAngle,s=t.endAngle,f=Le(t.cx,o,o/2),l=Le(t.cy,u,u/2),h=DO(o,u,n),p=Le(t.innerRadius,h,0),y=Le(t.outerRadius,h,h*.8),v=Object.keys(r);return v.reduce(function(d,m){var x=r[m],w=x.domain,O=x.reversed,g;if(J(x.range))i==="angleAxis"?g=[c,s]:i==="radiusAxis"&&(g=[p,y]),O&&(g=[g[1],g[0]]);else{g=x.range;var b=g,_=tI(b,2);c=_[0],s=_[1]}var A=MO(x,a),P=A.realScaleType,j=A.scale;j.domain(w).range(g),$O(j);var T=IO(j,At(At({},x),{},{realScaleType:P})),E=At(At(At({},x),T),{},{range:g,radius:y,realScaleType:P,scale:j,cx:f,cy:l,innerRadius:p,outerRadius:y,startAngle:c,endAngle:s});return At(At({},d),{},RO({},m,E))},{})},cI=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(i-o,2))},sI=function(t,r){var n=t.x,i=t.y,a=r.cx,o=r.cy,u=cI({x:n,y:i},{x:a,y:o});if(u<=0)return{radius:u};var c=(n-a)/u,s=Math.acos(c);return i>o&&(s=2*Math.PI-s),{radius:u,angle:oI(s),angleInRadian:s}},lI=function(t){var r=t.startAngle,n=t.endAngle,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return{startAngle:r-o*360,endAngle:n-o*360}},fI=function(t,r){var n=r.startAngle,i=r.endAngle,a=Math.floor(n/360),o=Math.floor(i/360),u=Math.min(a,o);return t+u*360},Wm=function(t,r){var n=t.x,i=t.y,a=sI({x:n,y:i},r),o=a.radius,u=a.angle,c=r.innerRadius,s=r.outerRadius;if(os)return!1;if(o===0)return!0;var f=lI(r),l=f.startAngle,h=f.endAngle,p=u,y;if(l<=h){for(;p>h;)p-=360;for(;p=l&&p<=h}else{for(;p>l;)p-=360;for(;p=h&&p<=l}return y?At(At({},r),{},{radius:o,angle:fI(p,r)}):null},NO=function(t){return!N.isValidElement(t)&&!X(t)&&typeof t!="boolean"?t.className:""};function Qn(e){"@babel/helpers - typeof";return Qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qn(e)}var hI=["offset"];function pI(e){return gI(e)||yI(e)||vI(e)||dI()}function dI(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vI(e,t){if(e){if(typeof e=="string")return Lf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Lf(e,t)}}function yI(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function gI(e){if(Array.isArray(e))return Lf(e)}function Lf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function bI(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function zm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _e(e){for(var t=1;t=0?1:-1,w,O;i==="insideStart"?(w=p+x*o,O=v):i==="insideEnd"?(w=y-x*o,O=!v):i==="end"&&(w=y+x*o,O=v),O=m<=0?O:!O;var g=pe(s,f,d,w),b=pe(s,f,d,w+(O?1:-1)*359),_="M".concat(g.x,",").concat(g.y,` - A`).concat(d,",").concat(d,",0,1,").concat(O?0:1,`, - `).concat(b.x,",").concat(b.y),A=J(t.id)?un("recharts-radial-line-"):t.id;return S.createElement("text",ei({},n,{dominantBaseline:"central",className:te("recharts-radial-bar-label",u)}),S.createElement("defs",null,S.createElement("path",{id:A,d:_})),S.createElement("textPath",{xlinkHref:"#".concat(A)},r))},PI=function(t){var r=t.viewBox,n=t.offset,i=t.position,a=r,o=a.cx,u=a.cy,c=a.innerRadius,s=a.outerRadius,f=a.startAngle,l=a.endAngle,h=(f+l)/2;if(i==="outside"){var p=pe(o,u,s+n,h),y=p.x,v=p.y;return{x:y,y:v,textAnchor:y>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"end"};var d=(c+s)/2,m=pe(o,u,d,h),x=m.x,w=m.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},TI=function(t){var r=t.viewBox,n=t.parentViewBox,i=t.offset,a=t.position,o=r,u=o.x,c=o.y,s=o.width,f=o.height,l=f>=0?1:-1,h=l*i,p=l>0?"end":"start",y=l>0?"start":"end",v=s>=0?1:-1,d=v*i,m=v>0?"end":"start",x=v>0?"start":"end";if(a==="top"){var w={x:u+s/2,y:c-l*i,textAnchor:"middle",verticalAnchor:p};return _e(_e({},w),n?{height:Math.max(c-n.y,0),width:s}:{})}if(a==="bottom"){var O={x:u+s/2,y:c+f+h,textAnchor:"middle",verticalAnchor:y};return _e(_e({},O),n?{height:Math.max(n.y+n.height-(c+f),0),width:s}:{})}if(a==="left"){var g={x:u-d,y:c+f/2,textAnchor:m,verticalAnchor:"middle"};return _e(_e({},g),n?{width:Math.max(g.x-n.x,0),height:f}:{})}if(a==="right"){var b={x:u+s+d,y:c+f/2,textAnchor:x,verticalAnchor:"middle"};return _e(_e({},b),n?{width:Math.max(n.x+n.width-b.x,0),height:f}:{})}var _=n?{width:s,height:f}:{};return a==="insideLeft"?_e({x:u+d,y:c+f/2,textAnchor:x,verticalAnchor:"middle"},_):a==="insideRight"?_e({x:u+s-d,y:c+f/2,textAnchor:m,verticalAnchor:"middle"},_):a==="insideTop"?_e({x:u+s/2,y:c+h,textAnchor:"middle",verticalAnchor:y},_):a==="insideBottom"?_e({x:u+s/2,y:c+f-h,textAnchor:"middle",verticalAnchor:p},_):a==="insideTopLeft"?_e({x:u+d,y:c+h,textAnchor:x,verticalAnchor:y},_):a==="insideTopRight"?_e({x:u+s-d,y:c+h,textAnchor:m,verticalAnchor:y},_):a==="insideBottomLeft"?_e({x:u+d,y:c+f-h,textAnchor:x,verticalAnchor:p},_):a==="insideBottomRight"?_e({x:u+s-d,y:c+f-h,textAnchor:m,verticalAnchor:p},_):on(a)&&(q(a.x)||er(a.x))&&(q(a.y)||er(a.y))?_e({x:u+Le(a.x,s),y:c+Le(a.y,f),textAnchor:"end",verticalAnchor:"end"},_):_e({x:u+s/2,y:c+f/2,textAnchor:"middle",verticalAnchor:"middle"},_)},EI=function(t){return"cx"in t&&q(t.cx)};function je(e){var t=e.offset,r=t===void 0?5:t,n=mI(e,hI),i=_e({offset:r},n),a=i.viewBox,o=i.position,u=i.value,c=i.children,s=i.content,f=i.className,l=f===void 0?"":f,h=i.textBreakAll;if(!a||J(u)&&J(c)&&!N.isValidElement(s)&&!X(s))return null;if(N.isValidElement(s))return N.cloneElement(s,i);var p;if(X(s)){if(p=N.createElement(s,i),N.isValidElement(p))return p}else p=_I(i);var y=EI(a),v=K(i,!0);if(y&&(o==="insideStart"||o==="insideEnd"||o==="end"))return SI(i,p,v);var d=y?PI(i):TI(i);return S.createElement(sr,ei({className:te("recharts-label",l)},v,d,{breakAll:h}),p)}je.displayName="Label";var qO=function(t){var r=t.cx,n=t.cy,i=t.angle,a=t.startAngle,o=t.endAngle,u=t.r,c=t.radius,s=t.innerRadius,f=t.outerRadius,l=t.x,h=t.y,p=t.top,y=t.left,v=t.width,d=t.height,m=t.clockWise,x=t.labelViewBox;if(x)return x;if(q(v)&&q(d)){if(q(l)&&q(h))return{x:l,y:h,width:v,height:d};if(q(p)&&q(y))return{x:p,y,width:v,height:d}}return q(l)&&q(h)?{x:l,y:h,width:0,height:0}:q(r)&&q(n)?{cx:r,cy:n,startAngle:a||i||0,endAngle:o||i||0,innerRadius:s||0,outerRadius:f||c||u||0,clockWise:m}:t.viewBox?t.viewBox:{}},jI=function(t,r){return t?t===!0?S.createElement(je,{key:"label-implicit",viewBox:r}):Se(t)?S.createElement(je,{key:"label-implicit",viewBox:r,value:t}):N.isValidElement(t)?t.type===je?N.cloneElement(t,{key:"label-implicit",viewBox:r}):S.createElement(je,{key:"label-implicit",content:t,viewBox:r}):X(t)?S.createElement(je,{key:"label-implicit",content:t,viewBox:r}):on(t)?S.createElement(je,ei({viewBox:r},t,{key:"label-implicit"})):null:null},MI=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var i=t.children,a=qO(t),o=Ye(i,je).map(function(c,s){return N.cloneElement(c,{viewBox:r||a,key:"label-".concat(s)})});if(!n)return o;var u=jI(t.label,r||a);return[u].concat(pI(o))};je.parseViewBox=qO;je.renderCallByParent=MI;var Ys,Km;function $I(){if(Km)return Ys;Km=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Ys=e,Ys}var II=$I();const CI=ce(II);function ti(e){"@babel/helpers - typeof";return ti=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ti(e)}var kI=["valueAccessor"],RI=["data","dataKey","clockWise","id","textBreakAll"];function DI(e){return BI(e)||LI(e)||qI(e)||NI()}function NI(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qI(e,t){if(e){if(typeof e=="string")return Bf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Bf(e,t)}}function LI(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function BI(e){if(Array.isArray(e))return Bf(e)}function Bf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function zI(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var KI=function(t){return Array.isArray(t.value)?CI(t.value):t.value};function Mt(e){var t=e.valueAccessor,r=t===void 0?KI:t,n=Vm(e,kI),i=n.data,a=n.dataKey,o=n.clockWise,u=n.id,c=n.textBreakAll,s=Vm(n,RI);return!i||!i.length?null:S.createElement(ne,{className:"recharts-label-list"},i.map(function(f,l){var h=J(a)?r(f,l):Ae(f&&f.payload,a),p=J(u)?{}:{id:"".concat(u,"-").concat(l)};return S.createElement(je,ha({},K(f,!0),s,p,{parentViewBox:f.parentViewBox,value:h,textBreakAll:c,viewBox:je.parseViewBox(J(o)?f:Gm(Gm({},f),{},{clockWise:o})),key:"label-".concat(l),index:l}))}))}Mt.displayName="LabelList";function HI(e,t){return e?e===!0?S.createElement(Mt,{key:"labelList-implicit",data:t}):S.isValidElement(e)||X(e)?S.createElement(Mt,{key:"labelList-implicit",data:t,content:e}):on(e)?S.createElement(Mt,ha({data:t},e,{key:"labelList-implicit"})):null:null}function GI(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,i=Ye(n,Mt).map(function(o,u){return N.cloneElement(o,{data:t,key:"labelList-".concat(u)})});if(!r)return i;var a=HI(e.label,t);return[a].concat(DI(i))}Mt.renderCallByParent=GI;function ri(e){"@babel/helpers - typeof";return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ri(e)}function Ff(){return Ff=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>s),`, - `).concat(l.x,",").concat(l.y,` - `);if(i>0){var p=pe(r,n,i,o),y=pe(r,n,i,s);h+="L ".concat(y.x,",").concat(y.y,` - A `).concat(i,",").concat(i,`,0, - `).concat(+(Math.abs(c)>180),",").concat(+(o<=s),`, - `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},JI=function(t){var r=t.cx,n=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,u=t.forceCornerRadius,c=t.cornerIsExternal,s=t.startAngle,f=t.endAngle,l=qe(f-s),h=ki({cx:r,cy:n,radius:a,angle:s,sign:l,cornerRadius:o,cornerIsExternal:c}),p=h.circleTangency,y=h.lineTangency,v=h.theta,d=ki({cx:r,cy:n,radius:a,angle:f,sign:-l,cornerRadius:o,cornerIsExternal:c}),m=d.circleTangency,x=d.lineTangency,w=d.theta,O=c?Math.abs(s-f):Math.abs(s-f)-v-w;if(O<0)return u?"M ".concat(y.x,",").concat(y.y,` - a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 - a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 - `):LO({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:s,endAngle:f});var g="M ".concat(y.x,",").concat(y.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(p.x,",").concat(p.y,` - A`).concat(a,",").concat(a,",0,").concat(+(O>180),",").concat(+(l<0),",").concat(m.x,",").concat(m.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(x.x,",").concat(x.y,` - `);if(i>0){var b=ki({cx:r,cy:n,radius:i,angle:s,sign:l,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),_=b.circleTangency,A=b.lineTangency,P=b.theta,j=ki({cx:r,cy:n,radius:i,angle:f,sign:-l,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),T=j.circleTangency,E=j.lineTangency,M=j.theta,I=c?Math.abs(s-f):Math.abs(s-f)-P-M;if(I<0&&o===0)return"".concat(g,"L").concat(r,",").concat(n,"Z");g+="L".concat(E.x,",").concat(E.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(T.x,",").concat(T.y,` - A`).concat(i,",").concat(i,",0,").concat(+(I>180),",").concat(+(l>0),",").concat(_.x,",").concat(_.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(A.x,",").concat(A.y,"Z")}else g+="L".concat(r,",").concat(n,"Z");return g},QI={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},BO=function(t){var r=Ym(Ym({},QI),t),n=r.cx,i=r.cy,a=r.innerRadius,o=r.outerRadius,u=r.cornerRadius,c=r.forceCornerRadius,s=r.cornerIsExternal,f=r.startAngle,l=r.endAngle,h=r.className;if(o0&&Math.abs(f-l)<360?d=JI({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(v,y/2),forceCornerRadius:c,cornerIsExternal:s,startAngle:f,endAngle:l}):d=LO({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:f,endAngle:l}),S.createElement("path",Ff({},K(r,!0),{className:p,d,role:"img"}))};function ni(e){"@babel/helpers - typeof";return ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ni(e)}function Uf(){return Uf=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function mC(e,t){return yr(e.getTime(),t.getTime())}function bC(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function xC(e,t){return e===t}function ub(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var i=new Array(n),a=e.entries(),o,u,c=0;(o=a.next())&&!o.done;){for(var s=t.entries(),f=!1,l=0;(u=s.next())&&!u.done;){if(i[l]){l++;continue}var h=o.value,p=u.value;if(r.equals(h[0],p[0],c,l,e,t,r)&&r.equals(h[1],p[1],h[0],p[0],e,t,r)){f=i[l]=!0;break}l++}if(!f)return!1;c++}return!0}var wC=yr;function OC(e,t,r){var n=ob(e),i=n.length;if(ob(t).length!==i)return!1;for(;i-- >0;)if(!FO(e,t,r,n[i]))return!1;return!0}function _n(e,t,r){var n=ib(e),i=n.length;if(ib(t).length!==i)return!1;for(var a,o,u;i-- >0;)if(a=n[i],!FO(e,t,r,a)||(o=ab(e,a),u=ab(t,a),(o||u)&&(!o||!u||o.configurable!==u.configurable||o.enumerable!==u.enumerable||o.writable!==u.writable)))return!1;return!0}function _C(e,t){return yr(e.valueOf(),t.valueOf())}function AC(e,t){return e.source===t.source&&e.flags===t.flags}function cb(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var i=new Array(n),a=e.values(),o,u;(o=a.next())&&!o.done;){for(var c=t.values(),s=!1,f=0;(u=c.next())&&!u.done;){if(!i[f]&&r.equals(o.value,u.value,o.value,u.value,e,t,r)){s=i[f]=!0;break}f++}if(!s)return!1}return!0}function SC(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function PC(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function FO(e,t,r,n){return(n===yC||n===vC||n===dC)&&(e.$$typeof||t.$$typeof)?!0:pC(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var TC="[object Arguments]",EC="[object Boolean]",jC="[object Date]",MC="[object Error]",$C="[object Map]",IC="[object Number]",CC="[object Object]",kC="[object RegExp]",RC="[object Set]",DC="[object String]",NC="[object URL]",qC=Array.isArray,sb=typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView:null,lb=Object.assign,LC=Object.prototype.toString.call.bind(Object.prototype.toString);function BC(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areErrorsEqual,i=e.areFunctionsEqual,a=e.areMapsEqual,o=e.areNumbersEqual,u=e.areObjectsEqual,c=e.arePrimitiveWrappersEqual,s=e.areRegExpsEqual,f=e.areSetsEqual,l=e.areTypedArraysEqual,h=e.areUrlsEqual,p=e.unknownTagComparators;return function(v,d,m){if(v===d)return!0;if(v==null||d==null)return!1;var x=typeof v;if(x!==typeof d)return!1;if(x!=="object")return x==="number"?o(v,d,m):x==="function"?i(v,d,m):!1;var w=v.constructor;if(w!==d.constructor)return!1;if(w===Object)return u(v,d,m);if(qC(v))return t(v,d,m);if(sb!=null&&sb(v))return l(v,d,m);if(w===Date)return r(v,d,m);if(w===RegExp)return s(v,d,m);if(w===Map)return a(v,d,m);if(w===Set)return f(v,d,m);var O=LC(v);if(O===jC)return r(v,d,m);if(O===kC)return s(v,d,m);if(O===$C)return a(v,d,m);if(O===RC)return f(v,d,m);if(O===CC)return typeof v.then!="function"&&typeof d.then!="function"&&u(v,d,m);if(O===NC)return h(v,d,m);if(O===MC)return n(v,d,m);if(O===TC)return u(v,d,m);if(O===EC||O===IC||O===DC)return c(v,d,m);if(p){var g=p[O];if(!g){var b=hC(v);b&&(g=p[b])}if(g)return g(v,d,m)}return!1}}function FC(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,i={areArraysEqual:n?_n:gC,areDatesEqual:mC,areErrorsEqual:bC,areFunctionsEqual:xC,areMapsEqual:n?nb(ub,_n):ub,areNumbersEqual:wC,areObjectsEqual:n?_n:OC,arePrimitiveWrappersEqual:_C,areRegExpsEqual:AC,areSetsEqual:n?nb(cb,_n):cb,areTypedArraysEqual:n?_n:SC,areUrlsEqual:PC,unknownTagComparators:void 0};if(r&&(i=lb({},i,r(i))),t){var a=Di(i.areArraysEqual),o=Di(i.areMapsEqual),u=Di(i.areObjectsEqual),c=Di(i.areSetsEqual);i=lb({},i,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:u,areSetsEqual:c})}return i}function UC(e){return function(t,r,n,i,a,o,u){return e(t,r,u)}}function WC(e){var t=e.circular,r=e.comparator,n=e.createState,i=e.equals,a=e.strict;if(n)return function(c,s){var f=n(),l=f.cache,h=l===void 0?t?new WeakMap:void 0:l,p=f.meta;return r(c,s,{cache:h,equals:i,meta:p,strict:a})};if(t)return function(c,s){return r(c,s,{cache:new WeakMap,equals:i,meta:void 0,strict:a})};var o={cache:void 0,equals:i,meta:void 0,strict:a};return function(c,s){return r(c,s,o)}}var zC=Wt();Wt({strict:!0});Wt({circular:!0});Wt({circular:!0,strict:!0});Wt({createInternalComparator:function(){return yr}});Wt({strict:!0,createInternalComparator:function(){return yr}});Wt({circular:!0,createInternalComparator:function(){return yr}});Wt({circular:!0,createInternalComparator:function(){return yr},strict:!0});function Wt(e){e===void 0&&(e={});var t=e.circular,r=t===void 0?!1:t,n=e.createInternalComparator,i=e.createState,a=e.strict,o=a===void 0?!1:a,u=FC(e),c=BC(u),s=n?n(c):UC(c);return WC({circular:r,comparator:c,createState:i,equals:s,strict:o})}function KC(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function fb(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(a){r<0&&(r=a),a-r>t?(e(a),r=-1):KC(i)};requestAnimationFrame(n)}function Wf(e){"@babel/helpers - typeof";return Wf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wf(e)}function HC(e){return YC(e)||XC(e)||VC(e)||GC()}function GC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VC(e,t){if(e){if(typeof e=="string")return hb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hb(e,t)}}function hb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?1:m<0?0:m},v=function(m){for(var x=m>1?1:m,w=x,O=0;O<8;++O){var g=l(w)-x,b=p(w);if(Math.abs(g-x)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,i=t.damping,a=i===void 0?8:i,o=t.dt,u=o===void 0?17:o,c=function(f,l,h){var p=-(f-l)*n,y=h*a,v=h+(p-y)*u/1e3,d=h*u/1e3+f;return Math.abs(d-l)e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Tk(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a=0)&&(r[i]=e[i]);return r}function el(e){return $k(e)||Mk(e)||jk(e)||Ek()}function Ek(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jk(e,t){if(e){if(typeof e=="string")return Vf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vf(e,t)}}function Mk(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function $k(e){if(Array.isArray(e))return Vf(e)}function Vf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ya(e){return ya=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ya(e)}var bt=(function(e){Dk(r,e);var t=Nk(r);function r(n,i){var a;Ik(this,r),a=t.call(this,n,i);var o=a.props,u=o.isActive,c=o.attributeName,s=o.from,f=o.to,l=o.steps,h=o.children,p=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(Zf(a)),a.changeStyle=a.changeStyle.bind(Zf(a)),!u||p<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:f}),Yf(a);if(l&&l.length)a.state={style:l[0].style};else if(s){if(typeof h=="function")return a.state={style:s},Yf(a);a.state={style:c?Tn({},c,s):s}}else a.state={style:{}};return a}return kk(r,[{key:"componentDidMount",value:function(){var i=this.props,a=i.isActive,o=i.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var a=this.props,o=a.isActive,u=a.canBegin,c=a.attributeName,s=a.shouldReAnimate,f=a.to,l=a.from,h=this.state.style;if(u){if(!o){var p={style:c?Tn({},c,f):f};this.state&&h&&(c&&h[c]!==f||!c&&h!==f)&&this.setState(p);return}if(!(zC(i.to,f)&&i.canBegin&&i.isActive)){var y=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=y||s?l:i.to;if(this.state&&h){var d={style:c?Tn({},c,v):v};(c&&h[c]!==v||!c&&h!==v)&&this.setState(d)}this.runAnimation(at(at({},this.props),{},{from:v,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var a=this,o=i.from,u=i.to,c=i.duration,s=i.easing,f=i.begin,l=i.onAnimationEnd,h=i.onAnimationStart,p=Ak(o,u,pk(s),c,this.changeStyle),y=function(){a.stopJSAnimation=p()};this.manager.start([h,f,y,c,l])}},{key:"runStepAnimation",value:function(i){var a=this,o=i.steps,u=i.begin,c=i.onAnimationStart,s=o[0],f=s.style,l=s.duration,h=l===void 0?0:l,p=function(v,d,m){if(m===0)return v;var x=d.duration,w=d.easing,O=w===void 0?"ease":w,g=d.style,b=d.properties,_=d.onAnimationEnd,A=m>0?o[m-1]:d,P=b||Object.keys(g);if(typeof O=="function"||O==="spring")return[].concat(el(v),[a.runJSAnimation.bind(a,{from:A.style,to:g,duration:x,easing:O}),x]);var j=vb(P,x,O),T=at(at(at({},A.style),g),{},{transition:j});return[].concat(el(v),[T,x,_]).filter(tk)};return this.manager.start([c].concat(el(o.reduce(p,[f,Math.max(h,u)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=ZC());var a=i.begin,o=i.duration,u=i.attributeName,c=i.to,s=i.easing,f=i.onAnimationStart,l=i.onAnimationEnd,h=i.steps,p=i.children,y=this.manager;if(this.unSubscribe=y.subscribe(this.handleStyleChange),typeof s=="function"||typeof p=="function"||s==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var v=u?Tn({},u,c):c,d=vb(Object.keys(v),o,s);y.start([f,a,at(at({},v),{},{transition:d}),o,l])}},{key:"render",value:function(){var i=this.props,a=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var u=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var c=Pk(i,Sk),s=N.Children.count(a),f=this.state.style;if(typeof a=="function")return a(f);if(!u||s===0||o<=0)return a;var l=function(p){var y=p.props,v=y.style,d=v===void 0?{}:v,m=y.className,x=N.cloneElement(p,at(at({},c),{},{style:at(at({},d),f),className:m}));return x};return s===1?l(N.Children.only(a)):S.createElement("div",null,N.Children.map(a,function(h){return l(h)}))}}]),r})(N.PureComponent);bt.displayName="Animate";bt.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};bt.propTypes={from:oe.oneOfType([oe.object,oe.string]),to:oe.oneOfType([oe.object,oe.string]),attributeName:oe.string,duration:oe.number,begin:oe.number,easing:oe.oneOfType([oe.string,oe.func]),steps:oe.arrayOf(oe.shape({duration:oe.number.isRequired,style:oe.object.isRequired,easing:oe.oneOfType([oe.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),oe.func]),properties:oe.arrayOf("string"),onAnimationEnd:oe.func})),children:oe.oneOfType([oe.node,oe.func]),isActive:oe.bool,canBegin:oe.bool,onAnimationEnd:oe.func,shouldReAnimate:oe.bool,onAnimationStart:oe.func,onAnimationReStart:oe.func};function wb(){return wb=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0?1:-1,c=n>=0?1:-1,s=i>=0&&n>=0||i<0&&n<0?1:0,f;if(o>0&&a instanceof Array){for(var l=[0,0,0,0],h=0,p=4;ho?o:a[h];f="M".concat(t,",").concat(r+u*l[0]),l[0]>0&&(f+="A ".concat(l[0],",").concat(l[0],",0,0,").concat(s,",").concat(t+c*l[0],",").concat(r)),f+="L ".concat(t+n-c*l[1],",").concat(r),l[1]>0&&(f+="A ".concat(l[1],",").concat(l[1],",0,0,").concat(s,`, - `).concat(t+n,",").concat(r+u*l[1])),f+="L ".concat(t+n,",").concat(r+i-u*l[2]),l[2]>0&&(f+="A ".concat(l[2],",").concat(l[2],",0,0,").concat(s,`, - `).concat(t+n-c*l[2],",").concat(r+i)),f+="L ".concat(t+c*l[3],",").concat(r+i),l[3]>0&&(f+="A ".concat(l[3],",").concat(l[3],",0,0,").concat(s,`, - `).concat(t,",").concat(r+i-u*l[3])),f+="Z"}else if(o>0&&a===+a&&a>0){var y=Math.min(o,a);f="M ".concat(t,",").concat(r+u*y,` - A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t+c*y,",").concat(r,` - L `).concat(t+n-c*y,",").concat(r,` - A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t+n,",").concat(r+u*y,` - L `).concat(t+n,",").concat(r+i-u*y,` - A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t+n-c*y,",").concat(r+i,` - L `).concat(t+c*y,",").concat(r+i,` - A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t,",").concat(r+i-u*y," Z")}else f="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return f},Gk=function(t,r){if(!t||!r)return!1;var n=t.x,i=t.y,a=r.x,o=r.y,u=r.width,c=r.height;if(Math.abs(u)>0&&Math.abs(c)>0){var s=Math.min(a,a+u),f=Math.max(a,a+u),l=Math.min(o,o+c),h=Math.max(o,o+c);return n>=s&&n<=f&&i>=l&&i<=h}return!1},Vk={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Sp=function(t){var r=Ab(Ab({},Vk),t),n=N.useRef(),i=N.useState(-1),a=Lk(i,2),o=a[0],u=a[1];N.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var O=n.current.getTotalLength();O&&u(O)}catch{}},[]);var c=r.x,s=r.y,f=r.width,l=r.height,h=r.radius,p=r.className,y=r.animationEasing,v=r.animationDuration,d=r.animationBegin,m=r.isAnimationActive,x=r.isUpdateAnimationActive;if(c!==+c||s!==+s||f!==+f||l!==+l||f===0||l===0)return null;var w=te("recharts-rectangle",p);return x?S.createElement(bt,{canBegin:o>0,from:{width:f,height:l,x:c,y:s},to:{width:f,height:l,x:c,y:s},duration:v,animationEasing:y,isActive:x},function(O){var g=O.width,b=O.height,_=O.x,A=O.y;return S.createElement(bt,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:d,duration:v,isActive:m,easing:y},S.createElement("path",ga({},K(r,!0),{className:w,d:Sb(_,A,g,b,h),ref:n})))}):S.createElement("path",ga({},K(r,!0),{className:w,d:Sb(c,s,f,l,h)}))},Xk=["points","className","baseLinePoints","connectNulls"];function Ar(){return Ar=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Zk(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Pb(e){return tR(e)||eR(e)||Qk(e)||Jk()}function Jk(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qk(e,t){if(e){if(typeof e=="string")return Jf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Jf(e,t)}}function eR(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tR(e){if(Array.isArray(e))return Jf(e)}function Jf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){Tb(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),Tb(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},Cn=function(t,r){var n=rR(t);r&&(n=[n.reduce(function(a,o){return[].concat(Pb(a),Pb(o))},[])]);var i=n.map(function(a){return a.reduce(function(o,u,c){return"".concat(o).concat(c===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return n.length===1?"".concat(i,"Z"):i},nR=function(t,r,n){var i=Cn(t,n);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(Cn(r.reverse(),n).slice(1))},iR=function(t){var r=t.points,n=t.className,i=t.baseLinePoints,a=t.connectNulls,o=Yk(t,Xk);if(!r||!r.length)return null;var u=te("recharts-polygon",n);if(i&&i.length){var c=o.stroke&&o.stroke!=="none",s=nR(r,i,a);return S.createElement("g",{className:u},S.createElement("path",Ar({},K(o,!0),{fill:s.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:s})),c?S.createElement("path",Ar({},K(o,!0),{fill:"none",d:Cn(r,a)})):null,c?S.createElement("path",Ar({},K(o,!0),{fill:"none",d:Cn(i,a)})):null)}var f=Cn(r,a);return S.createElement("path",Ar({},K(o,!0),{fill:f.slice(-1)==="Z"?o.fill:"none",className:u,d:f}))};function Qf(){return Qf=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function fR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var hR=function(t,r,n,i,a,o){return"M".concat(t,",").concat(a,"v").concat(i,"M").concat(o,",").concat(r,"h").concat(n)},pR=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.top,u=o===void 0?0:o,c=t.left,s=c===void 0?0:c,f=t.width,l=f===void 0?0:f,h=t.height,p=h===void 0?0:h,y=t.className,v=lR(t,aR),d=oR({x:n,y:a,top:u,left:s,width:l,height:p},v);return!q(n)||!q(a)||!q(l)||!q(p)||!q(u)||!q(s)?null:S.createElement("path",eh({},K(d,!0),{className:te("recharts-cross",y),d:hR(n,a,l,p,u,s)}))},tl,jb;function dR(){if(jb)return tl;jb=1;var e=no(),t=cO(),r=xt();function n(i,a){return i&&i.length?e(i,r(a,2),t):void 0}return tl=n,tl}var vR=dR();const yR=ce(vR);var rl,Mb;function gR(){if(Mb)return rl;Mb=1;var e=no(),t=xt(),r=sO();function n(i,a){return i&&i.length?e(i,t(a,2),r):void 0}return rl=n,rl}var mR=gR();const bR=ce(mR);var xR=["cx","cy","angle","ticks","axisLine"],wR=["ticks","tick","angle","tickFormatter","stroke"];function Ur(e){"@babel/helpers - typeof";return Ur=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ur(e)}function kn(){return kn=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function OR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function _R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cb(e,t){for(var r=0;rDb?o=i==="outer"?"start":"end":a<-Db?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.cx,a=n.cy,o=n.radius,u=n.axisLine,c=n.axisLineType,s=Yt(Yt({},K(this.props,!1)),{},{fill:"none"},K(u,!1));if(c==="circle")return S.createElement(co,Qt({className:"recharts-polar-angle-axis-line"},s,{cx:i,cy:a,r:o}));var f=this.props.ticks,l=f.map(function(h){return pe(i,a,o,h.coordinate)});return S.createElement(iR,Qt({className:"recharts-polar-angle-axis-line"},s,{points:l}))}},{key:"renderTicks",value:function(){var n=this,i=this.props,a=i.ticks,o=i.tick,u=i.tickLine,c=i.tickFormatter,s=i.stroke,f=K(this.props,!1),l=K(o,!1),h=Yt(Yt({},f),{},{fill:"none"},K(u,!1)),p=a.map(function(y,v){var d=n.getTickLineCoord(y),m=n.getTickTextAnchor(y),x=Yt(Yt(Yt({textAnchor:m},f),{},{stroke:"none",fill:s},l),{},{index:v,payload:y,x:d.x2,y:d.y2});return S.createElement(ne,Qt({className:te("recharts-polar-angle-axis-tick",NO(o)),key:"tick-".concat(y.coordinate)},cr(n.props,y,v)),u&&S.createElement("line",Qt({className:"recharts-polar-angle-axis-tick-line"},h,d)),o&&t.renderTickItem(o,x,c?c(y.value,v):y.value))});return S.createElement(ne,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var n=this.props,i=n.ticks,a=n.radius,o=n.axisLine;return a<=0||!i||!i.length?null:S.createElement(ne,{className:te("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,i,a){var o;return S.isValidElement(n)?o=S.cloneElement(n,i):X(n)?o=n(i):o=S.createElement(sr,Qt({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])})(N.PureComponent);fo(ho,"displayName","PolarAngleAxis");fo(ho,"axisType","angleAxis");fo(ho,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var nl,Nb;function Pp(){if(Nb)return nl;Nb=1;var e=nw(),t=e(Object.getPrototypeOf,Object);return nl=t,nl}var il,qb;function qR(){if(qb)return il;qb=1;var e=kt(),t=Pp(),r=ft(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,u=a.hasOwnProperty,c=o.call(Object);function s(f){if(!r(f)||e(f)!=n)return!1;var l=t(f);if(l===null)return!0;var h=u.call(l,"constructor")&&l.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==c}return il=s,il}var LR=qR();const BR=ce(LR);var al,Lb;function FR(){if(Lb)return al;Lb=1;var e=kt(),t=ft(),r="[object Boolean]";function n(i){return i===!0||i===!1||t(i)&&e(i)==r}return al=n,al}var UR=FR();const WR=ce(UR);function ci(e){"@babel/helpers - typeof";return ci=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ci(e)}function xa(){return xa=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:s},to:{upperWidth:f,lowerWidth:l,height:h,x:c,y:s},duration:v,animationEasing:y,isActive:m},function(w){var O=w.upperWidth,g=w.lowerWidth,b=w.height,_=w.x,A=w.y;return S.createElement(bt,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:d,duration:v,easing:y},S.createElement("path",xa({},K(r,!0),{className:x,d:Wb(_,A,O,g,b),ref:n})))}):S.createElement("g",null,S.createElement("path",xa({},K(r,!0),{className:x,d:Wb(c,s,f,l,h)})))},eD=["option","shapeType","propTransformer","activeClassName","isActive"];function si(e){"@babel/helpers - typeof";return si=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},si(e)}function tD(e,t){if(e==null)return{};var r=rD(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function rD(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function zb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function wa(e){for(var t=1;t0?Xe(w,"paddingAngle",0):0;if(g){var _=Ge(g.endAngle-g.startAngle,w.endAngle-w.startAngle),A=fe(fe({},w),{},{startAngle:x+b,endAngle:x+_(v)+b});d.push(A),x=A.endAngle}else{var P=w.endAngle,j=w.startAngle,T=Ge(0,P-j),E=T(v),M=fe(fe({},w),{},{startAngle:x+b,endAngle:x+E+b});d.push(M),x=M.endAngle}}),S.createElement(ne,null,n.renderSectorsStatically(d))})}},{key:"attachKeyboardHandlers",value:function(n){var i=this;n.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var u=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[u].focus(),i.setState({sectorToFocus:u});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,i=n.sectors,a=n.isAnimationActive,o=this.state.prevSectors;return a&&i&&i.length&&(!o||!Oi(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,i=this.props,a=i.hide,o=i.sectors,u=i.className,c=i.label,s=i.cx,f=i.cy,l=i.innerRadius,h=i.outerRadius,p=i.isAnimationActive,y=this.state.isAnimationFinished;if(a||!o||!o.length||!q(s)||!q(f)||!q(l)||!q(h))return null;var v=te("recharts-pie",u);return S.createElement(ne,{tabIndex:this.props.rootTabIndex,className:v,ref:function(m){n.pieRef=m}},this.renderSectors(),c&&this.renderLabels(o),je.renderCallByParent(this.props,null,!1),(!p||y)&&Mt.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return i.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:n.sectors!==i.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,i){return n>i?"start":n=360?x:x-1)*c,O=d-x*p-w,g=i.reduce(function(A,P){var j=Ae(P,m,0);return A+(q(j)?j:0)},0),b;if(g>0){var _;b=i.map(function(A,P){var j=Ae(A,m,0),T=Ae(A,f,P),E=(q(j)?j:0)/g,M;P?M=_.endAngle+qe(v)*c*(j!==0?1:0):M=o;var I=M+qe(v)*((j!==0?p:0)+E*O),$=(M+I)/2,k=(y.innerRadius+y.outerRadius)/2,R=[{name:T,value:j,payload:A,dataKey:m,type:h}],L=pe(y.cx,y.cy,k,$);return _=fe(fe(fe({percent:E,cornerRadius:a,name:T,tooltipPayload:R,midAngle:$,middleRadius:k,tooltipPosition:L},A),y),{},{value:Ae(A,m),startAngle:M,endAngle:I,payload:A,paddingAngle:qe(v)*c}),_})}return fe(fe({},y),{},{sectors:b,data:i})});var ol,Vb;function _D(){if(Vb)return ol;Vb=1;var e=Math.ceil,t=Math.max;function r(n,i,a,o){for(var u=-1,c=t(e((i-n)/(a||1)),0),s=Array(c);c--;)s[o?c:++u]=n,n+=a;return s}return ol=r,ol}var ul,Xb;function t_(){if(Xb)return ul;Xb=1;var e=ww(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*r}return i===i?i:0}return ul=n,ul}var cl,Yb;function AD(){if(Yb)return cl;Yb=1;var e=_D(),t=Ya(),r=t_();function n(i){return function(a,o,u){return u&&typeof u!="number"&&t(a,o,u)&&(o=u=void 0),a=r(a),o===void 0?(o=a,a=0):o=r(o),u=u===void 0?a0&&n.handleDrag(i.changedTouches[0])}),Ke(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,a=i.endIndex,o=i.onDragEnd,u=i.startIndex;o?.({endIndex:a,startIndex:u})}),n.detachDragEndListener()}),Ke(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Ke(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Ke(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Ke(n,"handleSlideDragStart",function(i){var a=r0(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return DD(t,e),ID(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,a=n.endX,o=this.state.scaleValues,u=this.props,c=u.gap,s=u.data,f=s.length-1,l=Math.min(i,a),h=Math.max(i,a),p=t.getIndexInRange(o,l),y=t.getIndexInRange(o,h);return{startIndex:p-p%c,endIndex:y===f?f:y-y%c}}},{key:"getTextOfTick",value:function(n){var i=this.props,a=i.data,o=i.tickFormatter,u=i.dataKey,c=Ae(a[n],u,n);return X(o)?o(c,n):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var i=this.state,a=i.slideMoveStartX,o=i.startX,u=i.endX,c=this.props,s=c.x,f=c.width,l=c.travellerWidth,h=c.startIndex,p=c.endIndex,y=c.onChange,v=n.pageX-a;v>0?v=Math.min(v,s+f-l-u,s+f-l-o):v<0&&(v=Math.max(v,s-o,s-u));var d=this.getIndex({startX:o+v,endX:u+v});(d.startIndex!==h||d.endIndex!==p)&&y&&y(d),this.setState({startX:o+v,endX:u+v,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var a=r0(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,u=i.endX,c=i.startX,s=this.state[o],f=this.props,l=f.x,h=f.width,p=f.travellerWidth,y=f.onChange,v=f.gap,d=f.data,m={startX:this.state.startX,endX:this.state.endX},x=n.pageX-a;x>0?x=Math.min(x,l+h-p-s):x<0&&(x=Math.max(x,l-s)),m[o]=s+x;var w=this.getIndex(m),O=w.startIndex,g=w.endIndex,b=function(){var A=d.length-1;return o==="startX"&&(u>c?O%v===0:g%v===0)||uc?g%v===0:O%v===0)||u>c&&g===A};this.setState(Ke(Ke({},o,s+x),"brushMoveStartX",n.pageX),function(){y&&b()&&y(w)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var a=this,o=this.state,u=o.scaleValues,c=o.startX,s=o.endX,f=this.state[i],l=u.indexOf(f);if(l!==-1){var h=l+n;if(!(h===-1||h>=u.length)){var p=u[h];i==="startX"&&p>=s||i==="endX"&&p<=c||this.setState(Ke({},i,p),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,u=n.height,c=n.fill,s=n.stroke;return S.createElement("rect",{stroke:s,fill:c,x:i,y:a,width:o,height:u})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,u=n.height,c=n.data,s=n.children,f=n.padding,l=N.Children.only(s);return l?S.cloneElement(l,{x:i,y:a,width:o,height:u,margin:f,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,i){var a,o,u=this,c=this.props,s=c.y,f=c.travellerWidth,l=c.height,h=c.traveller,p=c.ariaLabel,y=c.data,v=c.startIndex,d=c.endIndex,m=Math.max(n,this.props.x),x=ll(ll({},K(this.props,!1)),{},{x:m,y:s,width:f,height:l}),w=p||"Min value: ".concat((a=y[v])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=y[d])===null||o===void 0?void 0:o.name);return S.createElement(ne,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(g){["ArrowLeft","ArrowRight"].includes(g.key)&&(g.preventDefault(),g.stopPropagation(),u.handleTravellerMoveKeyboard(g.key==="ArrowRight"?1:-1,i))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,x))}},{key:"renderSlide",value:function(n,i){var a=this.props,o=a.y,u=a.height,c=a.stroke,s=a.travellerWidth,f=Math.min(n,i)+s,l=Math.max(Math.abs(i-n)-s,0);return S.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:f,y:o,width:l,height:u})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,a=n.endIndex,o=n.y,u=n.height,c=n.travellerWidth,s=n.stroke,f=this.state,l=f.startX,h=f.endX,p=5,y={pointerEvents:"none",fill:s};return S.createElement(ne,{className:"recharts-brush-texts"},S.createElement(sr,Aa({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,h)-p,y:o+u/2},y),this.getTextOfTick(i)),S.createElement(sr,Aa({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,h)+c+p,y:o+u/2},y),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,i=n.data,a=n.className,o=n.children,u=n.x,c=n.y,s=n.width,f=n.height,l=n.alwaysShowText,h=this.state,p=h.startX,y=h.endX,v=h.isTextActive,d=h.isSlideMoving,m=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!q(u)||!q(c)||!q(s)||!q(f)||s<=0||f<=0)return null;var w=te("recharts-brush",a),O=S.Children.count(o)===1,g=MD("userSelect","none");return S.createElement(ne,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:g},this.renderBackground(),O&&this.renderPanorama(),this.renderSlide(p,y),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(y,"endX"),(v||d||m||x||l)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,a=n.y,o=n.width,u=n.height,c=n.stroke,s=Math.floor(a+u/2)-1;return S.createElement(S.Fragment,null,S.createElement("rect",{x:i,y:a,width:o,height:u,fill:c,stroke:"none"}),S.createElement("line",{x1:i+1,y1:s,x2:i+o-1,y2:s,fill:"none",stroke:"#fff"}),S.createElement("line",{x1:i+1,y1:s+2,x2:i+o-1,y2:s+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var a;return S.isValidElement(n)?a=S.cloneElement(n,i):X(n)?a=n(i):a=t.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(n,i){var a=n.data,o=n.width,u=n.x,c=n.travellerWidth,s=n.updateId,f=n.startIndex,l=n.endIndex;if(a!==i.prevData||s!==i.prevUpdateId)return ll({prevData:a,prevTravellerWidth:c,prevUpdateId:s,prevX:u,prevWidth:o},a&&a.length?qD({data:a,width:o,x:u,travellerWidth:c,startIndex:f,endIndex:l}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||u!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([u,u+o-c]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:s,prevX:u,prevWidth:o,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(n,i){for(var a=n.length,o=0,u=a-1;u-o>1;){var c=Math.floor((o+u)/2);n[c]>i?u=c:o=c}return i>=n[u]?u:o}}])})(N.PureComponent);Ke(Hr,"displayName","Brush");Ke(Hr,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var fl,n0;function LD(){if(n0)return fl;n0=1;var e=Yh();function t(r,n){var i;return e(r,function(a,o,u){return i=n(a,o,u),!i}),!!i}return fl=t,fl}var hl,i0;function BD(){if(i0)return hl;i0=1;var e=Xx(),t=xt(),r=LD(),n=Fe(),i=Ya();function a(o,u,c){var s=n(o)?e:r;return c&&i(o,u,c)&&(u=void 0),s(o,t(u,3))}return hl=a,hl}var FD=BD();const UD=ce(FD);var gt=function(t,r){var n=t.alwaysShow,i=t.ifOverflow;return n&&(i="extendDomain"),i===r},pl,a0;function Tp(){if(a0)return pl;a0=1;var e=vw();function t(r,n,i){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return pl=t,pl}var dl,o0;function WD(){if(o0)return dl;o0=1;var e=Tp(),t=hw(),r=xt();function n(i,a){var o={};return a=r(a,3),t(i,function(u,c,s){e(o,c,a(u,c,s))}),o}return dl=n,dl}var zD=WD();const KD=ce(zD);var vl,u0;function HD(){if(u0)return vl;u0=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function tN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function rN(e,t){var r=e.x,n=e.y,i=eN(e,YD),a="".concat(r),o=parseInt(a,10),u="".concat(n),c=parseInt(u,10),s="".concat(t.height||i.height),f=parseInt(s,10),l="".concat(t.width||i.width),h=parseInt(l,10);return An(An(An(An(An({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:f,width:h,name:t.name,radius:t.radius})}function f0(e){return S.createElement(JO,ah({shapeType:"rectangle",propTransformer:rN,activeClassName:"recharts-active-bar"},e))}var nN=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof t=="number")return t;var a=q(n)||R1(n);return a?t(n,i):(a||or(!1),r)}},iN=["value","background"],o_;function Gr(e){"@babel/helpers - typeof";return Gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gr(e)}function aN(e,t){if(e==null)return{};var r=oN(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function oN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Pa(){return Pa=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs($)0&&Math.abs(I)0&&(M=Math.min((se||0)-(I[me-1]||0),M))}),Number.isFinite(M)){var $=M/E,k=v.layout==="vertical"?n.height:n.width;if(v.padding==="gap"&&(_=$*k/2),v.padding==="no-gap"){var R=Le(t.barCategoryGap,$*k),L=$*k/2;_=L-R-(L-R)/k*R}}}i==="xAxis"?A=[n.left+(w.left||0)+(_||0),n.left+n.width-(w.right||0)-(_||0)]:i==="yAxis"?A=c==="horizontal"?[n.top+n.height-(w.bottom||0),n.top+(w.top||0)]:[n.top+(w.top||0)+(_||0),n.top+n.height-(w.bottom||0)-(_||0)]:A=v.range,g&&(A=[A[1],A[0]]);var B=MO(v,a,h),z=B.scale,H=B.realScaleType;z.domain(m).range(A),$O(z);var U=IO(z,ot(ot({},v),{},{realScaleType:H}));i==="xAxis"?(T=d==="top"&&!O||d==="bottom"&&O,P=n.left,j=l[b]-T*v.height):i==="yAxis"&&(T=d==="left"&&!O||d==="right"&&O,P=l[b]-T*v.width,j=n.top);var G=ot(ot(ot({},v),U),{},{realScaleType:H,x:P,y:j,scale:z,width:i==="xAxis"?n.width:v.width,height:i==="yAxis"?n.height:v.height});return G.bandSize=la(G,U),!v.hide&&i==="xAxis"?l[b]+=(T?-1:1)*G.height:v.hide||(l[b]+=(T?-1:1)*G.width),ot(ot({},p),{},yo({},y,G))},{})},f_=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return{x:Math.min(n,a),y:Math.min(i,o),width:Math.abs(a-n),height:Math.abs(o-i)}},gN=function(t){var r=t.x1,n=t.y1,i=t.x2,a=t.y2;return f_({x:r,y:n},{x:i,y:a})},h_=(function(){function e(t){dN(this,e),this.scale=t}return vN(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var u=this.bandwidth?this.bandwidth():0;return this.scale(r)+u}default:return this.scale(r)}if(i){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],a=n[n.length-1];return i<=a?r>=i&&r<=a:r>=a&&r<=i}}],[{key:"create",value:function(r){return new e(r)}}])})();yo(h_,"EPS",1e-4);var Ep=function(t){var r=Object.keys(t).reduce(function(n,i){return ot(ot({},n),{},yo({},i,h_.create(t[i])))},{});return ot(ot({},r),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,u=a.position;return KD(i,function(c,s){return r[s].apply(c,{bandAware:o,position:u})})},isInRange:function(i){return a_(i,function(a,o){return r[o].isInRange(a)})}})};function mN(e){return(e%180+180)%180}var bN=function(t){var r=t.width,n=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=mN(i),o=a*Math.PI/180,u=Math.atan(n/r),c=o>u&&o-1?c[s?a[f]:f]:void 0}}return ml=n,ml}var bl,g0;function wN(){if(g0)return bl;g0=1;var e=t_();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return bl=t,bl}var xl,m0;function ON(){if(m0)return xl;m0=1;var e=cw(),t=xt(),r=wN(),n=Math.max;function i(a,o,u){var c=a==null?0:a.length;if(!c)return-1;var s=u==null?0:r(u);return s<0&&(s=n(c+s,0)),e(a,t(o,3),s)}return xl=i,xl}var wl,b0;function _N(){if(b0)return wl;b0=1;var e=xN(),t=ON(),r=e(t);return wl=r,wl}var AN=_N();const SN=ce(AN);var PN=_x();const TN=ce(PN);var EN=TN(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),jp=N.createContext(void 0),Mp=N.createContext(void 0),p_=N.createContext(void 0),d_=N.createContext({}),v_=N.createContext(void 0),y_=N.createContext(0),g_=N.createContext(0),x0=function(t){var r=t.state,n=r.xAxisMap,i=r.yAxisMap,a=r.offset,o=t.clipPathId,u=t.children,c=t.width,s=t.height,f=EN(a);return S.createElement(jp.Provider,{value:n},S.createElement(Mp.Provider,{value:i},S.createElement(d_.Provider,{value:a},S.createElement(p_.Provider,{value:f},S.createElement(v_.Provider,{value:o},S.createElement(y_.Provider,{value:s},S.createElement(g_.Provider,{value:c},u)))))))},jN=function(){return N.useContext(v_)},m_=function(t){var r=N.useContext(jp);r==null&&or(!1);var n=r[t];return n==null&&or(!1),n},MN=function(){var t=N.useContext(jp);return qt(t)},$N=function(){var t=N.useContext(Mp),r=SN(t,function(n){return a_(n.domain,Number.isFinite)});return r||qt(t)},b_=function(t){var r=N.useContext(Mp);r==null&&or(!1);var n=r[t];return n==null&&or(!1),n},IN=function(){var t=N.useContext(p_);return t},CN=function(){return N.useContext(d_)},$p=function(){return N.useContext(g_)},Ip=function(){return N.useContext(y_)};function Vr(e){"@babel/helpers - typeof";return Vr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vr(e)}function kN(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RN(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*i)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-i)<=0}function yq(e,t){return P_(e,t+1)}function gq(e,t,r,n,i){for(var a=(n||[]).slice(),o=t.start,u=t.end,c=0,s=1,f=o,l=function(){var y=n?.[c];if(y===void 0)return{v:P_(n,s)};var v=c,d,m=function(){return d===void 0&&(d=r(y,v)),d},x=y.coordinate,w=c===0||$a(e,x,m,f,u);w||(c=0,f=o,s+=1),w&&(f=x+e*(m()/2+i),c+=s)},h;s<=a.length;)if(h=l(),h)return h.v;return[]}function di(e){"@babel/helpers - typeof";return di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},di(e)}function E0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ke(e){for(var t=1;t0?p.coordinate-d*e:p.coordinate})}else a[h]=p=ke(ke({},p),{},{tickCoord:p.coordinate});var m=$a(e,p.tickCoord,v,u,c);m&&(c=p.tickCoord-e*(v()/2+i),a[h]=ke(ke({},p),{},{isShow:!0}))},f=o-1;f>=0;f--)s(f);return a}function Oq(e,t,r,n,i,a){var o=(n||[]).slice(),u=o.length,c=t.start,s=t.end;if(a){var f=n[u-1],l=r(f,u-1),h=e*(f.coordinate+e*l/2-s);o[u-1]=f=ke(ke({},f),{},{tickCoord:h>0?f.coordinate-h*e:f.coordinate});var p=$a(e,f.tickCoord,function(){return l},c,s);p&&(s=f.tickCoord-e*(l/2+i),o[u-1]=ke(ke({},f),{},{isShow:!0}))}for(var y=a?u-1:u,v=function(x){var w=o[x],O,g=function(){return O===void 0&&(O=r(w,x)),O};if(x===0){var b=e*(w.coordinate-e*g()/2-c);o[x]=w=ke(ke({},w),{},{tickCoord:b<0?w.coordinate-b*e:w.coordinate})}else o[x]=w=ke(ke({},w),{},{tickCoord:w.coordinate});var _=$a(e,w.tickCoord,g,c,s);_&&(c=w.tickCoord+e*(g()/2+i),o[x]=ke(ke({},w),{},{isShow:!0}))},d=0;d=2?qe(i[1].coordinate-i[0].coordinate):1,m=vq(a,d,p);return c==="equidistantPreserveStart"?gq(d,m,v,i,o):(c==="preserveStart"||c==="preserveStartEnd"?h=Oq(d,m,v,i,o,c==="preserveStartEnd"):h=wq(d,m,v,i,o),h.filter(function(x){return x.isShow}))}var _q=["viewBox"],Aq=["viewBox"],Sq=["ticks"];function Zr(e){"@babel/helpers - typeof";return Zr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zr(e)}function Pr(){return Pr=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Pq(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Tq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M0(e,t){for(var r=0;r0?c(this.props):c(p)),o<=0||u<=0||!y||!y.length?null:S.createElement(ne,{className:te("recharts-cartesian-axis",s),ref:function(d){n.layerReference=d}},a&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),je.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,a){var o,u=te(i.className,"recharts-cartesian-axis-tick-value");return S.isValidElement(n)?o=S.cloneElement(n,Oe(Oe({},i),{},{className:u})):X(n)?o=n(Oe(Oe({},i),{},{className:u})):o=S.createElement(sr,Pr({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])})(N.Component);Dp(vn,"displayName","CartesianAxis");Dp(vn,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var kq=["x1","y1","x2","y2","key"],Rq=["offset"];function fr(e){"@babel/helpers - typeof";return fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fr(e)}function $0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Re(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Lq(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Bq=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,i=t.x,a=t.y,o=t.width,u=t.height,c=t.ry;return S.createElement("rect",{x:i,y:a,ry:c,width:o,height:u,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function j_(e,t){var r;if(S.isValidElement(e))r=S.cloneElement(e,t);else if(X(e))r=e(t);else{var n=t.x1,i=t.y1,a=t.x2,o=t.y2,u=t.key,c=I0(t,kq),s=K(c,!1);s.offset;var f=I0(s,Rq);r=S.createElement("line",nr({},f,{x1:n,y1:i,x2:a,y2:o,fill:"none",key:u}))}return r}function Fq(e){var t=e.x,r=e.width,n=e.horizontal,i=n===void 0?!0:n,a=e.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(u,c){var s=Re(Re({},e),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(c),index:c});return j_(i,s)});return S.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Uq(e){var t=e.y,r=e.height,n=e.vertical,i=n===void 0?!0:n,a=e.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(u,c){var s=Re(Re({},e),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(c),index:c});return j_(i,s)});return S.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Wq(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,i=e.y,a=e.width,o=e.height,u=e.horizontalPoints,c=e.horizontal,s=c===void 0?!0:c;if(!s||!t||!t.length)return null;var f=u.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==f[0]&&f.unshift(0);var l=f.map(function(h,p){var y=!f[p+1],v=y?i+o-h:f[p+1]-h;if(v<=0)return null;var d=p%t.length;return S.createElement("rect",{key:"react-".concat(p),y:h,x:n,height:v,width:a,stroke:"none",fill:t[d],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},l)}function zq(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,u=e.width,c=e.height,s=e.verticalPoints;if(!r||!n||!n.length)return null;var f=s.map(function(h){return Math.round(h+a-a)}).sort(function(h,p){return h-p});a!==f[0]&&f.unshift(0);var l=f.map(function(h,p){var y=!f[p+1],v=y?a+u-h:f[p+1]-h;if(v<=0)return null;var d=p%n.length;return S.createElement("rect",{key:"react-".concat(p),x:h,y:o,width:v,height:c,stroke:"none",fill:n[d],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},l)}var Kq=function(t,r){var n=t.xAxis,i=t.width,a=t.height,o=t.offset;return jO(Rp(Re(Re(Re({},vn.defaultProps),n),{},{ticks:Tt(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,r)},Hq=function(t,r){var n=t.yAxis,i=t.width,a=t.height,o=t.offset;return jO(Rp(Re(Re(Re({},vn.defaultProps),n),{},{ticks:Tt(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,r)},wr={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Gq(e){var t,r,n,i,a,o,u=$p(),c=Ip(),s=CN(),f=Re(Re({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:wr.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:wr.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:wr.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:wr.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:wr.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:wr.verticalFill,x:q(e.x)?e.x:s.left,y:q(e.y)?e.y:s.top,width:q(e.width)?e.width:s.width,height:q(e.height)?e.height:s.height}),l=f.x,h=f.y,p=f.width,y=f.height,v=f.syncWithTicks,d=f.horizontalValues,m=f.verticalValues,x=MN(),w=$N();if(!q(p)||p<=0||!q(y)||y<=0||!q(l)||l!==+l||!q(h)||h!==+h)return null;var O=f.verticalCoordinatesGenerator||Kq,g=f.horizontalCoordinatesGenerator||Hq,b=f.horizontalPoints,_=f.verticalPoints;if((!b||!b.length)&&X(g)){var A=d&&d.length,P=g({yAxis:w?Re(Re({},w),{},{ticks:A?d:w.ticks}):void 0,width:u,height:c,offset:s},A?!0:v);st(Array.isArray(P),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(fr(P),"]")),Array.isArray(P)&&(b=P)}if((!_||!_.length)&&X(O)){var j=m&&m.length,T=O({xAxis:x?Re(Re({},x),{},{ticks:j?m:x.ticks}):void 0,width:u,height:c,offset:s},j?!0:v);st(Array.isArray(T),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(fr(T),"]")),Array.isArray(T)&&(_=T)}return S.createElement("g",{className:"recharts-cartesian-grid"},S.createElement(Bq,{fill:f.fill,fillOpacity:f.fillOpacity,x:f.x,y:f.y,width:f.width,height:f.height,ry:f.ry}),S.createElement(Fq,nr({},f,{offset:s,horizontalPoints:b,xAxis:x,yAxis:w})),S.createElement(Uq,nr({},f,{offset:s,verticalPoints:_,xAxis:x,yAxis:w})),S.createElement(Wq,nr({},f,{horizontalPoints:b})),S.createElement(zq,nr({},f,{verticalPoints:_})))}Gq.displayName="CartesianGrid";var Vq=["type","layout","connectNulls","ref"],Xq=["key"];function Jr(e){"@babel/helpers - typeof";return Jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jr(e)}function C0(e,t){if(e==null)return{};var r=Yq(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Yq(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Rn(){return Rn=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);rl){p=[].concat(Or(c.slice(0,y)),[l-v]);break}var d=p.length%2===0?[0,h]:[h];return[].concat(Or(t.repeat(c,f)),Or(p),d).map(function(m){return"".concat(m,"px")}).join(", ")}),ut(r,"id",un("recharts-line-")),ut(r,"pathRef",function(o){r.mainCurve=o}),ut(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),ut(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return o2(t,e),r2(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,u=a.xAxis,c=a.yAxis,s=a.layout,f=a.children,l=Ye(f,_i);if(!l)return null;var h=function(v,d){return{x:v.x,y:v.y,value:v.value,errorVal:Ae(v.payload,d)}},p={clipPath:n?"url(#clipPath-".concat(i,")"):null};return S.createElement(ne,p,l.map(function(y){return S.cloneElement(y,{key:"bar-".concat(y.props.dataKey),data:o,xAxis:u,yAxis:c,layout:s,dataPointFormatter:h})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var u=this.props,c=u.dot,s=u.points,f=u.dataKey,l=K(this.props,!1),h=K(c,!0),p=s.map(function(v,d){var m=ze(ze(ze({key:"dot-".concat(d),r:3},l),h),{},{index:d,cx:v.x,cy:v.y,value:v.value,dataKey:f,payload:v.payload,points:s});return t.renderDotItem(c,m)}),y={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return S.createElement(ne,Rn({className:"recharts-line-dots",key:"dots"},y),p)}},{key:"renderCurveStatically",value:function(n,i,a,o){var u=this.props,c=u.type,s=u.layout,f=u.connectNulls;u.ref;var l=C0(u,Vq),h=ze(ze(ze({},K(l,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:c,layout:s,connectNulls:f});return S.createElement(pa,Rn({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,u=o.points,c=o.strokeDasharray,s=o.isAnimationActive,f=o.animationBegin,l=o.animationDuration,h=o.animationEasing,p=o.animationId,y=o.animateNewValues,v=o.width,d=o.height,m=this.state,x=m.prevPoints,w=m.totalLength;return S.createElement(bt,{begin:f,duration:l,isActive:s,easing:h,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var g=O.t;if(x){var b=x.length/u.length,_=u.map(function(E,M){var I=Math.floor(M*b);if(x[I]){var $=x[I],k=Ge($.x,E.x),R=Ge($.y,E.y);return ze(ze({},E),{},{x:k(g),y:R(g)})}if(y){var L=Ge(v*2,E.x),B=Ge(d/2,E.y);return ze(ze({},E),{},{x:L(g),y:B(g)})}return ze(ze({},E),{},{x:E.x,y:E.y})});return a.renderCurveStatically(_,n,i)}var A=Ge(0,w),P=A(g),j;if(c){var T="".concat(c).split(/[,\s]+/gim).map(function(E){return parseFloat(E)});j=a.getStrokeDasharray(P,w,T)}else j=a.generateSimpleStrokeDasharray(w,P);return a.renderCurveStatically(u,n,i,{strokeDasharray:j})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,u=a.isAnimationActive,c=this.state,s=c.prevPoints,f=c.totalLength;return u&&o&&o.length&&(!s&&f>0||!Oi(s,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,u=i.points,c=i.className,s=i.xAxis,f=i.yAxis,l=i.top,h=i.left,p=i.width,y=i.height,v=i.isAnimationActive,d=i.id;if(a||!u||!u.length)return null;var m=this.state.isAnimationFinished,x=u.length===1,w=te("recharts-line",c),O=s&&s.allowDataOverflow,g=f&&f.allowDataOverflow,b=O||g,_=J(d)?this.id:d,A=(n=K(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},P=A.r,j=P===void 0?3:P,T=A.strokeWidth,E=T===void 0?2:T,M=G1(o)?o:{},I=M.clipDot,$=I===void 0?!0:I,k=j*2+E;return S.createElement(ne,{className:w},O||g?S.createElement("defs",null,S.createElement("clipPath",{id:"clipPath-".concat(_)},S.createElement("rect",{x:O?h:h-p/2,y:g?l:l-y/2,width:O?p:p*2,height:g?y:y*2})),!$&&S.createElement("clipPath",{id:"clipPath-dots-".concat(_)},S.createElement("rect",{x:h-k/2,y:l-k/2,width:p+k,height:y+k}))):null,!x&&this.renderCurve(b,_),this.renderErrorBar(b,_),(x||o)&&this.renderDots(b,$,_),(!v||m)&&Mt.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(Or(n),[0]):n,o=[],u=0;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Y2(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Z2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J2(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?o:t&&t.length&&q(i)&&q(a)?t.slice(i,a+1):[]};function z_(e){return e==="number"?[0,"auto"]:void 0}var Ah=function(t,r,n,i){var a=t.graphicalItems,o=t.tooltipAxis,u=Ao(r,t);return n<0||!a||!a.length||n>=u.length?null:a.reduce(function(c,s){var f,l=(f=s.props.data)!==null&&f!==void 0?f:r;l&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(l=l.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var p=l===void 0?u:l;h=Bi(p,o.dataKey,i)}else h=l&&l[n]||u[n];return h?[].concat(rn(c),[kO(s,h)]):c},[])},U0=function(t,r,n,i){var a=i||{x:t.chartX,y:t.chartY},o=lL(a,n),u=t.orderedTooltipTicks,c=t.tooltipAxis,s=t.tooltipTicks,f=N$(o,u,s,c);if(f>=0&&s){var l=s[f]&&s[f].value,h=Ah(t,r,f,l),p=fL(n,u,f,a);return{activeTooltipIndex:f,activeLabel:l,activePayload:h,activeCoordinate:p}}return null},hL=function(t,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=t.stackOffset,p=EO(f,a);return n.reduce(function(y,v){var d,m=v.type.defaultProps!==void 0?C(C({},v.type.defaultProps),v.props):v.props,x=m.type,w=m.dataKey,O=m.allowDataOverflow,g=m.allowDuplicatedCategory,b=m.scale,_=m.ticks,A=m.includeHidden,P=m[o];if(y[P])return y;var j=Ao(t.data,{graphicalItems:i.filter(function(U){var G,se=o in U.props?U.props[o]:(G=U.type.defaultProps)===null||G===void 0?void 0:G[o];return se===P}),dataStartIndex:c,dataEndIndex:s}),T=j.length,E,M,I;q2(m.domain,O,x)&&(E=qf(m.domain,null,O),p&&(x==="number"||b!=="auto")&&(I=$n(j,w,"category")));var $=z_(x);if(!E||E.length===0){var k,R=(k=m.domain)!==null&&k!==void 0?k:$;if(w){if(E=$n(j,w,x),x==="category"&&p){var L=N1(E);g&&L?(M=E,E=_a(0,T)):g||(E=Bm(R,E,v).reduce(function(U,G){return U.indexOf(G)>=0?U:[].concat(rn(U),[G])},[]))}else if(x==="category")g?E=E.filter(function(U){return U!==""&&!J(U)}):E=Bm(R,E,v).reduce(function(U,G){return U.indexOf(G)>=0||G===""||J(G)?U:[].concat(rn(U),[G])},[]);else if(x==="number"){var B=U$(j,i.filter(function(U){var G,se,me=o in U.props?U.props[o]:(G=U.type.defaultProps)===null||G===void 0?void 0:G[o],De="hide"in U.props?U.props.hide:(se=U.type.defaultProps)===null||se===void 0?void 0:se.hide;return me===P&&(A||!De)}),w,a,f);B&&(E=B)}p&&(x==="number"||b!=="auto")&&(I=$n(j,w,"category"))}else p?E=_a(0,T):u&&u[P]&&u[P].hasStack&&x==="number"?E=h==="expand"?[0,1]:CO(u[P].stackGroups,c,s):E=TO(j,i.filter(function(U){var G=o in U.props?U.props[o]:U.type.defaultProps[o],se="hide"in U.props?U.props.hide:U.type.defaultProps.hide;return G===P&&(A||!se)}),x,f,!0);if(x==="number")E=wh(l,E,P,a,_),R&&(E=qf(R,E,O));else if(x==="category"&&R){var z=R,H=E.every(function(U){return z.indexOf(U)>=0});H&&(E=z)}}return C(C({},y),{},V({},P,C(C({},m),{},{axisType:a,domain:E,categoricalDomain:I,duplicateDomain:M,originalDomain:(d=m.domain)!==null&&d!==void 0?d:$,isCategorical:p,layout:f})))},{})},pL=function(t,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=Ao(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:s}),p=h.length,y=EO(f,a),v=-1;return n.reduce(function(d,m){var x=m.type.defaultProps!==void 0?C(C({},m.type.defaultProps),m.props):m.props,w=x[o],O=z_("number");if(!d[w]){v++;var g;return y?g=_a(0,p):u&&u[w]&&u[w].hasStack?(g=CO(u[w].stackGroups,c,s),g=wh(l,g,w,a)):(g=qf(O,TO(h,n.filter(function(b){var _,A,P=o in b.props?b.props[o]:(_=b.type.defaultProps)===null||_===void 0?void 0:_[o],j="hide"in b.props?b.props.hide:(A=b.type.defaultProps)===null||A===void 0?void 0:A.hide;return P===w&&!j}),"number",f),i.defaultProps.allowDataOverflow),g=wh(l,g,w,a)),C(C({},d),{},V({},w,C(C({axisType:a},i.defaultProps),{},{hide:!0,orientation:Xe(cL,"".concat(a,".").concat(v%2),null),domain:g,originalDomain:O,isCategorical:y,layout:f})))}return d},{})},dL=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.children,l="".concat(i,"Id"),h=Ye(f,a),p={};return h&&h.length?p=hL(t,{axes:h,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:u,dataStartIndex:c,dataEndIndex:s}):o&&o.length&&(p=pL(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:u,dataStartIndex:c,dataEndIndex:s})),p},vL=function(t){var r=qt(t),n=Tt(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:Zh(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:la(r,n)}},W0=function(t){var r=t.children,n=t.defaultShowTooltip,i=He(r,Hr),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},yL=function(t){return!t||!t.length?!1:t.some(function(r){var n=Et(r&&r.type);return n&&n.indexOf("Bar")>=0})},z0=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},gL=function(t,r){var n=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,u=t.yAxisMap,c=u===void 0?{}:u,s=n.width,f=n.height,l=n.children,h=n.margin||{},p=He(l,Hr),y=He(l,jr),v=Object.keys(c).reduce(function(g,b){var _=c[b],A=_.orientation;return!_.mirror&&!_.hide?C(C({},g),{},V({},A,g[A]+_.width)):g},{left:h.left||0,right:h.right||0}),d=Object.keys(o).reduce(function(g,b){var _=o[b],A=_.orientation;return!_.mirror&&!_.hide?C(C({},g),{},V({},A,Xe(g,"".concat(A))+_.height)):g},{top:h.top||0,bottom:h.bottom||0}),m=C(C({},d),v),x=m.bottom;p&&(m.bottom+=p.props.height||Hr.defaultProps.height),y&&r&&(m=B$(m,i,n,r));var w=s-m.left-m.right,O=f-m.top-m.bottom;return C(C({brushBottom:x},m),{},{width:Math.max(w,0),height:Math.max(O,0)})},mL=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},Np=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,u=o===void 0?["axis"]:o,c=t.axisComponents,s=t.legendContent,f=t.formatAxisMap,l=t.defaultProps,h=function(m,x){var w=x.graphicalItems,O=x.stackGroups,g=x.offset,b=x.updateId,_=x.dataStartIndex,A=x.dataEndIndex,P=m.barSize,j=m.layout,T=m.barGap,E=m.barCategoryGap,M=m.maxBarSize,I=z0(j),$=I.numericAxisName,k=I.cateAxisName,R=yL(w),L=[];return w.forEach(function(B,z){var H=Ao(m.data,{graphicalItems:[B],dataStartIndex:_,dataEndIndex:A}),U=B.type.defaultProps!==void 0?C(C({},B.type.defaultProps),B.props):B.props,G=U.dataKey,se=U.maxBarSize,me=U["".concat($,"Id")],De=U["".concat(k,"Id")],wt={},Ie=c.reduce(function(Ze,Ce){var Te=x["".concat(Ce.axisType,"Map")],Kt=U["".concat(Ce.axisType,"Id")];Te&&Te[Kt]||Ce.axisType==="zAxis"||or(!1);var Ht=Te[Kt];return C(C({},Ze),{},V(V({},Ce.axisType,Ht),"".concat(Ce.axisType,"Ticks"),Tt(Ht)))},wt),F=Ie[k],Q=Ie["".concat(k,"Ticks")],ee=O&&O[me]&&O[me].hasStack&&Z$(B,O[me].stackGroups),D=Et(B.type).indexOf("Bar")>=0,ve=la(F,Q),re=[],Y=R&&q$({barSize:P,stackGroups:O,totalSize:mL(Ie,k)});if(D){var ye,Z,Ne=J(se)?M:se,We=(ye=(Z=la(F,Q,!0))!==null&&Z!==void 0?Z:Ne)!==null&&ye!==void 0?ye:0;re=L$({barGap:T,barCategoryGap:E,bandSize:We!==ve?We:ve,sizeList:Y[De],maxBarSize:Ne}),We!==ve&&(re=re.map(function(Ze){return C(C({},Ze),{},{position:C(C({},Ze.position),{},{offset:Ze.position.offset-We/2})})}))}var gr=B&&B.type&&B.type.getComposedData;gr&&L.push({props:C(C({},gr(C(C({},Ie),{},{displayedData:H,props:m,dataKey:G,item:B,bandSize:ve,barPosition:re,offset:g,stackedData:ee,layout:j,dataStartIndex:_,dataEndIndex:A}))),{},V(V(V({key:B.key||"item-".concat(z)},$,Ie[$]),k,Ie[k]),"animationId",b)),childIndex:Y1(B,m.children),item:B})}),L},p=function(m,x){var w=m.props,O=m.dataStartIndex,g=m.dataEndIndex,b=m.updateId;if(!Jd({props:w}))return null;var _=w.children,A=w.layout,P=w.stackOffset,j=w.data,T=w.reverseStackOrder,E=z0(A),M=E.numericAxisName,I=E.cateAxisName,$=Ye(_,n),k=X$(j,$,"".concat(M,"Id"),"".concat(I,"Id"),P,T),R=c.reduce(function(U,G){var se="".concat(G.axisType,"Map");return C(C({},U),{},V({},se,dL(w,C(C({},G),{},{graphicalItems:$,stackGroups:G.axisType===M&&k,dataStartIndex:O,dataEndIndex:g}))))},{}),L=gL(C(C({},R),{},{props:w,graphicalItems:$}),x?.legendBBox);Object.keys(R).forEach(function(U){R[U]=f(w,R[U],L,U.replace("Map",""),r)});var B=R["".concat(I,"Map")],z=vL(B),H=h(w,C(C({},R),{},{dataStartIndex:O,dataEndIndex:g,updateId:b,graphicalItems:$,stackGroups:k,offset:L}));return C(C({formattedGraphicalItems:H,graphicalItems:$,offset:L,stackGroups:k},z),R)},y=(function(d){function m(x){var w,O,g;return Z2(this,m),g=eL(this,m,[x]),V(g,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),V(g,"accessibilityManager",new N2),V(g,"handleLegendBBoxUpdate",function(b){if(b){var _=g.state,A=_.dataStartIndex,P=_.dataEndIndex,j=_.updateId;g.setState(C({legendBBox:b},p({props:g.props,dataStartIndex:A,dataEndIndex:P,updateId:j},C(C({},g.state),{},{legendBBox:b}))))}}),V(g,"handleReceiveSyncEvent",function(b,_,A){if(g.props.syncId===b){if(A===g.eventEmitterSymbol&&typeof g.props.syncMethod!="function")return;g.applySyncEvent(_)}}),V(g,"handleBrushChange",function(b){var _=b.startIndex,A=b.endIndex;if(_!==g.state.dataStartIndex||A!==g.state.dataEndIndex){var P=g.state.updateId;g.setState(function(){return C({dataStartIndex:_,dataEndIndex:A},p({props:g.props,dataStartIndex:_,dataEndIndex:A,updateId:P},g.state))}),g.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),V(g,"handleMouseEnter",function(b){var _=g.getMouseInfo(b);if(_){var A=C(C({},_),{},{isTooltipActive:!0});g.setState(A),g.triggerSyncEvent(A);var P=g.props.onMouseEnter;X(P)&&P(A,b)}}),V(g,"triggeredAfterMouseMove",function(b){var _=g.getMouseInfo(b),A=_?C(C({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};g.setState(A),g.triggerSyncEvent(A);var P=g.props.onMouseMove;X(P)&&P(A,b)}),V(g,"handleItemMouseEnter",function(b){g.setState(function(){return{isTooltipActive:!0,activeItem:b,activePayload:b.tooltipPayload,activeCoordinate:b.tooltipPosition||{x:b.cx,y:b.cy}}})}),V(g,"handleItemMouseLeave",function(){g.setState(function(){return{isTooltipActive:!1}})}),V(g,"handleMouseMove",function(b){b.persist(),g.throttleTriggeredAfterMouseMove(b)}),V(g,"handleMouseLeave",function(b){g.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};g.setState(_),g.triggerSyncEvent(_);var A=g.props.onMouseLeave;X(A)&&A(_,b)}),V(g,"handleOuterEvent",function(b){var _=X1(b),A=Xe(g.props,"".concat(_));if(_&&X(A)){var P,j;/.*touch.*/i.test(_)?j=g.getMouseInfo(b.changedTouches[0]):j=g.getMouseInfo(b),A((P=j)!==null&&P!==void 0?P:{},b)}}),V(g,"handleClick",function(b){var _=g.getMouseInfo(b);if(_){var A=C(C({},_),{},{isTooltipActive:!0});g.setState(A),g.triggerSyncEvent(A);var P=g.props.onClick;X(P)&&P(A,b)}}),V(g,"handleMouseDown",function(b){var _=g.props.onMouseDown;if(X(_)){var A=g.getMouseInfo(b);_(A,b)}}),V(g,"handleMouseUp",function(b){var _=g.props.onMouseUp;if(X(_)){var A=g.getMouseInfo(b);_(A,b)}}),V(g,"handleTouchMove",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&g.throttleTriggeredAfterMouseMove(b.changedTouches[0])}),V(g,"handleTouchStart",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&g.handleMouseDown(b.changedTouches[0])}),V(g,"handleTouchEnd",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&g.handleMouseUp(b.changedTouches[0])}),V(g,"handleDoubleClick",function(b){var _=g.props.onDoubleClick;if(X(_)){var A=g.getMouseInfo(b);_(A,b)}}),V(g,"handleContextMenu",function(b){var _=g.props.onContextMenu;if(X(_)){var A=g.getMouseInfo(b);_(A,b)}}),V(g,"triggerSyncEvent",function(b){g.props.syncId!==void 0&&Al.emit(Sl,g.props.syncId,b,g.eventEmitterSymbol)}),V(g,"applySyncEvent",function(b){var _=g.props,A=_.layout,P=_.syncMethod,j=g.state.updateId,T=b.dataStartIndex,E=b.dataEndIndex;if(b.dataStartIndex!==void 0||b.dataEndIndex!==void 0)g.setState(C({dataStartIndex:T,dataEndIndex:E},p({props:g.props,dataStartIndex:T,dataEndIndex:E,updateId:j},g.state)));else if(b.activeTooltipIndex!==void 0){var M=b.chartX,I=b.chartY,$=b.activeTooltipIndex,k=g.state,R=k.offset,L=k.tooltipTicks;if(!R)return;if(typeof P=="function")$=P(L,b);else if(P==="value"){$=-1;for(var B=0;B=0){var ee,D;if(M.dataKey&&!M.allowDuplicatedCategory){var ve=typeof M.dataKey=="function"?Q:"payload.".concat(M.dataKey.toString());ee=Bi(B,ve,$),D=z&&H&&Bi(H,ve,$)}else ee=B?.[I],D=z&&H&&H[I];if(De||me){var re=b.props.activeIndex!==void 0?b.props.activeIndex:I;return[N.cloneElement(b,C(C(C({},P.props),Ie),{},{activeIndex:re})),null,null]}if(!J(ee))return[F].concat(rn(g.renderActivePoints({item:P,activePoint:ee,basePoint:D,childIndex:I,isRange:z})))}else{var Y,ye=(Y=g.getItemByXY(g.state.activeCoordinate))!==null&&Y!==void 0?Y:{graphicalItem:F},Z=ye.graphicalItem,Ne=Z.item,We=Ne===void 0?b:Ne,gr=Z.childIndex,Ze=C(C(C({},P.props),Ie),{},{activeIndex:gr});return[N.cloneElement(We,Ze),null,null]}return z?[F,null,null]:[F,null]}),V(g,"renderCustomized",function(b,_,A){return N.cloneElement(b,C(C({key:"recharts-customized-".concat(A)},g.props),g.state))}),V(g,"renderMap",{CartesianGrid:{handler:qi,once:!0},ReferenceArea:{handler:g.renderReferenceElement},ReferenceLine:{handler:qi},ReferenceDot:{handler:g.renderReferenceElement},XAxis:{handler:qi},YAxis:{handler:qi},Brush:{handler:g.renderBrush,once:!0},Bar:{handler:g.renderGraphicChild},Line:{handler:g.renderGraphicChild},Area:{handler:g.renderGraphicChild},Radar:{handler:g.renderGraphicChild},RadialBar:{handler:g.renderGraphicChild},Scatter:{handler:g.renderGraphicChild},Pie:{handler:g.renderGraphicChild},Funnel:{handler:g.renderGraphicChild},Tooltip:{handler:g.renderCursor,once:!0},PolarGrid:{handler:g.renderPolarGrid,once:!0},PolarAngleAxis:{handler:g.renderPolarAxis},PolarRadiusAxis:{handler:g.renderPolarAxis},Customized:{handler:g.renderCustomized}}),g.clipPathId="".concat((w=x.id)!==null&&w!==void 0?w:un("recharts"),"-clip"),g.throttleTriggeredAfterMouseMove=Ow(g.triggeredAfterMouseMove,(O=x.throttleDelay)!==null&&O!==void 0?O:1e3/60),g.state={},g}return nL(m,d),Q2(m,[{key:"componentDidMount",value:function(){var w,O;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var w=this.props,O=w.children,g=w.data,b=w.height,_=w.layout,A=He(O,_t);if(A){var P=A.props.defaultIndex;if(!(typeof P!="number"||P<0||P>this.state.tooltipTicks.length-1)){var j=this.state.tooltipTicks[P]&&this.state.tooltipTicks[P].value,T=Ah(this.state,g,P,j),E=this.state.tooltipTicks[P].coordinate,M=(this.state.offset.top+b)/2,I=_==="horizontal",$=I?{x:E,y:M}:{y:E,x:M},k=this.state.formattedGraphicalItems.find(function(L){var B=L.item;return B.type.name==="Scatter"});k&&($=C(C({},$),k.props.points[P].tooltipPosition),T=k.props.points[P].tooltipPayload);var R={activeTooltipIndex:P,isTooltipActive:!0,activeLabel:j,activePayload:T,activeCoordinate:$};this.setState(R),this.renderCursor(A),this.accessibilityManager.setIndex(P)}}}},{key:"getSnapshotBeforeUpdate",value:function(w,O){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==O.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==w.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==w.margin){var g,b;this.accessibilityManager.setDetails({offset:{left:(g=this.props.margin.left)!==null&&g!==void 0?g:0,top:(b=this.props.margin.top)!==null&&b!==void 0?b:0}})}return null}},{key:"componentDidUpdate",value:function(w){af([He(w.children,_t)],[He(this.props.children,_t)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var w=He(this.props.children,_t);if(w&&typeof w.props.shared=="boolean"){var O=w.props.shared?"axis":"item";return u.indexOf(O)>=0?O:a}return a}},{key:"getMouseInfo",value:function(w){if(!this.container)return null;var O=this.container,g=O.getBoundingClientRect(),b=ST(g),_={chartX:Math.round(w.pageX-b.left),chartY:Math.round(w.pageY-b.top)},A=g.width/O.offsetWidth||1,P=this.inRange(_.chartX,_.chartY,A);if(!P)return null;var j=this.state,T=j.xAxisMap,E=j.yAxisMap,M=this.getTooltipEventType(),I=U0(this.state,this.props.data,this.props.layout,P);if(M!=="axis"&&T&&E){var $=qt(T).scale,k=qt(E).scale,R=$&&$.invert?$.invert(_.chartX):null,L=k&&k.invert?k.invert(_.chartY):null;return C(C({},_),{},{xValue:R,yValue:L},I)}return I?C(C({},_),I):null}},{key:"inRange",value:function(w,O){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,b=this.props.layout,_=w/g,A=O/g;if(b==="horizontal"||b==="vertical"){var P=this.state.offset,j=_>=P.left&&_<=P.left+P.width&&A>=P.top&&A<=P.top+P.height;return j?{x:_,y:A}:null}var T=this.state,E=T.angleAxisMap,M=T.radiusAxisMap;if(E&&M){var I=qt(E);return Wm({x:_,y:A},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var w=this.props.children,O=this.getTooltipEventType(),g=He(w,_t),b={};g&&O==="axis"&&(g.props.trigger==="click"?b={onClick:this.handleClick}:b={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var _=Fi(this.props,this.handleOuterEvent);return C(C({},_),b)}},{key:"addListener",value:function(){Al.on(Sl,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Al.removeListener(Sl,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(w,O,g){for(var b=this.state.formattedGraphicalItems,_=0,A=b.length;_{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=yh[i])e=i+1;else return!0;if(e==t)return!1}}function al(n){return n>=127462&&n<=127487}const hl=8205;function Nu(n,e,t=!0,i=!0){return(t?bh:Xu)(n,e,i)}function bh(n,e,t){if(e==n.length)return e;e&&Sh(n.charCodeAt(e))&&xh(n.charCodeAt(e-1))&&e--;let i=zs(n,e);for(e+=cl(i);e=0&&al(zs(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Xu(n,e,t){for(;e>0;){let i=bh(n,e-2,t);if(i=56320&&n<57344}function xh(n){return n>=55296&&n<56320}function cl(n){return n<65536?1:2}class V{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=li(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ze.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=li(this,e,t);let i=[];return this.decompose(e,t,i,0),Ze.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Ai(this),r=new Ai(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Ai(this,e)}iterRange(e,t=this.length){return new kh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new wh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?V.empty:e.length<=32?new K(e):Ze.from(K.split(e,[]))}}class K extends V{constructor(e,t=Fu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new _u(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new K(fl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Xn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new K(l,o.length+r.length));else{let a=l.length>>1;i.push(new K(l.slice(0,a)),new K(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof K))return super.replace(e,t,i);[e,t]=li(this,e,t);let s=Xn(this.text,Xn(i.text,fl(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new K(s,r):Ze.from(K.split(s,[]),r)}sliceString(e,t=this.length,i=` +import{r as Se,j as zu}from"./router-Bz250laD.js";function xr(){return xr=Object.assign?Object.assign.bind():function(n){for(var e=1;e{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=bh[i])e=i+1;else return!0;if(e==t)return!1}}function hl(n){return n>=127462&&n<=127487}const cl=8205;function Nu(n,e,t=!0,i=!0){return(t?Sh:Xu)(n,e,i)}function Sh(n,e,t){if(e==n.length)return e;e&&xh(n.charCodeAt(e))&&kh(n.charCodeAt(e-1))&&e--;let i=zs(n,e);for(e+=fl(i);e=0&&hl(zs(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Xu(n,e,t){for(;e>0;){let i=Sh(n,e-2,t);if(i=56320&&n<57344}function kh(n){return n>=55296&&n<56320}function fl(n){return n<65536?1:2}class V{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=li(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ze.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=li(this,e,t);let i=[];return this.decompose(e,t,i,0),Ze.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Ai(this),r=new Ai(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Ai(this,e)}iterRange(e,t=this.length){return new wh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new vh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?V.empty:e.length<=32?new K(e):Ze.from(K.split(e,[]))}}class K extends V{constructor(e,t=Fu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new _u(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new K(ul(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Xn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new K(l,o.length+r.length));else{let a=l.length>>1;i.push(new K(l.slice(0,a)),new K(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof K))return super.replace(e,t,i);[e,t]=li(this,e,t);let s=Xn(this.text,Xn(i.text,ul(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new K(s,r):Ze.from(K.split(s,[]),r)}sliceString(e,t=this.length,i=` `){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new K(i,s)),i=[],s=-1);return s>-1&&t.push(new K(i,s)),t}}class Ze extends V{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=li(this,e,t),i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new Ze(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` -`){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ze))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new K(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ze)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof K&&a&&(p=c[c.length-1])instanceof K&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new K(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Ze.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ze(l,t)}}V.empty=new K([""],0);function Fu(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Xn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof K?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof K?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(s instanceof K){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof K?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class kh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ai(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class wh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},Ai.prototype[Symbol.iterator]=kh.prototype[Symbol.iterator]=wh.prototype[Symbol.iterator]=function(){return this});class _u{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function li(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function pe(n,e,t=!0,i=!0){return Nu(n,e,t,i)}function Uu(n){return n>=56320&&n<57344}function Hu(n){return n>=55296&&n<56320}function Te(n,e){let t=n.charCodeAt(e);if(!Hu(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Uu(i)?(t-55296<<10)+(i-56320)+65536:t}function bo(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Ye(n){return n<65536?1:2}const kr=/\r\n?|\n/;var de=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(de||(de={}));class it{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=de.Simple&&h>=e&&(i==de.TrackDel&&se||i==de.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new it(e)}static create(e){return new it(e)}}class se extends it{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return wr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return vr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&&kt(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?V.of(d.split(i||kr)):d:V.empty,m=p.length;if(f==u&&m==0)return;fo&&Oe(s,f-o,-1),Oe(s,u-f,m),kt(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new se(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function kt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function vr(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Bi(n),l=new Bi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);Oe(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Bi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?V.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?V.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Wt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Wt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new Wt(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>Wt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function Th(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let So=0;class A{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=So++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new A(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:xo),!!e.static,e.enables)}of(e){return new Fn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function xo(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Fn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=So++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Tr(f,c)){let d=i(f);if(l?!ul(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=ns(u,p);if(this.dependencies.every(g=>g instanceof A?u.facet(g)===f.facet(g):g instanceof he?u.field(g,!1)==f.field(g,!1):!0)||(l?ul(d=i(f),m,s):s(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function ul(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(On).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(On),o=s.facet(On),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,On.of({field:this,create:e})]}get extension(){return this}}const $t={lowest:4,low:3,default:2,high:1,highest:0};function Si(n){return e=>new Ch(e,n)}const Mt={highest:Si($t.highest),high:Si($t.high),default:Si($t.default),low:Si($t.low),lowest:Si($t.lowest)};class Ch{constructor(e,t){this.inner=e,this.prec=t}}class vs{of(e){return new Cr(this,e)}reconfigure(e){return vs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Cr{constructor(e,t){this.compartment=e,this.inner=t}}class is{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Gu(e,t,o))u instanceof he?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,xo(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(y=>g.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(g=>ju(g,p,d))}}let f=h.map(u=>u(l));return new is(e,o,f,l,a,r)}}function Gu(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Cr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Cr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Ch)r(o.inner,o.prec);else if(o instanceof he)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Fn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,$t.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,$t.default),i.reduce((o,l)=>o.concat(l))}function Mi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function ns(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Ph=A.define(),Pr=A.define({combine:n=>n.some(e=>e),static:!0}),Qh=A.define({combine:n=>n.length?n[0]:void 0,static:!0}),Ah=A.define(),Mh=A.define(),Rh=A.define(),Dh=A.define({combine:n=>n.length?n[0]:!1});class st{constructor(e,t){this.type=e,this.value=t}static define(){return new Zu}}class Zu{of(e){return new st(this,e)}}class Yu{constructor(e){this.map=e}of(e){return new q(this,e)}}class q{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new q(this.type,t)}is(e){return this.type==e}static define(e={}){return new Yu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}q.reconfigure=q.define();q.appendConfig=q.define();class ie{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Th(i,t.newLength),r.some(l=>l.type==ie.time)||(this.annotations=r.concat(ie.time.of(Date.now())))}static create(e,t,i,s,r,o){return new ie(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ie.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ie.time=st.define();ie.userEvent=st.define();ie.addToHistory=st.define();ie.remote=st.define();function Ku(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof ie?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof ie?n=r[0]:n=qh(e,ti(r),!1)}return n}function ed(n){let e=n.startState,t=e.facet(Rh),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=Eh(i,Qr(e,r,n.changes.newLength),!0))}return i==n?n:ie.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const td=[];function ti(n){return n==null?td:Array.isArray(n)?n:[n]}var Y=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Y||(Y={}));const id=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Ar;try{Ar=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function nd(n){if(Ar)return Ar.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||id.test(t)))return!0}return!1}function sd(n){return e=>{if(!/\S/.test(e))return Y.Space;if(nd(e))return Y.Word;for(let t=0;t-1)return Y.Word;return Y.Other}}class I{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(q.reconfigure)?(t=null,i=l.value):l.is(q.appendConfig)&&(t=null,i=ti(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=is.resolve(i,s,this),r=new I(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Pr)?e.newSelection:e.newSelection.asSingle();new I(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=ti(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return I.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=is.resolve(e.extensions||[],new Map),i=e.doc instanceof V?e.doc:V.of((e.doc||"").split(t.staticFacet(I.lineSeparator)||kr)),s=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return Th(s,i.length),t.staticFacet(Pr)||(s=s.asSingle()),new I(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(I.tabSize)}get lineBreak(){return this.facet(I.lineSeparator)||` -`}get readOnly(){return this.facet(Dh)}phrase(e,...t){for(let i of this.facet(I.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(Ph))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return sd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=pe(t,o,!1);if(r(t.slice(a,o))!=Y.Word)break;o=a}for(;ln.length?n[0]:4});I.lineSeparator=Qh;I.readOnly=Dh;I.phrases=A.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});I.languageData=Ph;I.changeFilter=Ah;I.transactionFilter=Mh;I.transactionExtender=Rh;vs.reconfigure=q.define();function rt(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class Nt{eq(e){return this==e}range(e,t=e){return Mr.create(e,t,this)}}Nt.prototype.startSide=Nt.prototype.endSide=0;Nt.prototype.point=!1;Nt.prototype.mapMode=de.TrackDel;let Mr=class $h{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new $h(e,t,i)}};function Rr(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class ko{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),s.push(u-o),r.push(d-o))}return{mapped:i.length?new ko(s,r,i,l):null,pos:o}}}class N{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new N(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Rr)),this.isEmpty)return t.length?N.of(t):this;let l=new Bh(this,null,-1).goto(0),a=0,h=[],c=new gt;for(;l.value||a=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Wi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Wi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=dl(o,l,i),h=new xi(o,a,r),c=new xi(l,a,r);i.iterGaps((f,u,d)=>pl(h,f,c,u,d,s)),i.empty&&i.length==0&&pl(h,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=999999999);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=dl(r,o),a=new xi(r,l,0).goto(i),h=new xi(o,l,0).goto(i);for(;;){if(a.to!=h.to||!Dr(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>s)return!0;a.next(),h.next()}}static spans(e,t,i,s,r=-1){let o=new xi(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(s.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new gt;for(let s of e instanceof Mr?[e]:t?rd(e):e)i.add(s.from,s.to,s.value);return i.finish()}static join(e){if(!e.length)return N.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let s=e[i];s!=N.empty;s=s.nextLayer)t=new N(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}N.empty=new N([],[],null,-1);function rd(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(Rr);e=i}return n}N.empty.nextLayer=N.empty;class gt{finishChunk(e){this.chunks.push(new ko(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new gt)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(N.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=N.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function dl(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new Bh(o,t,i,r));return s.length==1?s[0]:new Wi(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Is(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Is(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Is(this.heap,0)}}}function Is(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class xi{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Wi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){yn(this.active,e),yn(this.activeTo,e),yn(this.activeRank,e),this.minActive=ml(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t0;)t++;bn(this.active,t,i),bn(this.activeTo,t,s),bn(this.activeRank,t,r),e&&bn(e,t,this.cursor.from),this.minActive=ml(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&yn(i,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[s]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function pl(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,a=i-e;for(;;){let h=n.to+a-t.to,c=h||n.endSide-t.endSide,f=c<0?n.to+a:t.to,u=Math.min(f,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&Dr(n.activeForPoint(n.to),t.activeForPoint(t.to))||r.comparePoint(l,u,n.point,t.point):u>l&&!Dr(n.active,t.active)&&r.compareRange(l,u,n.active,t.active),f>o)break;(h||n.openEnd!=t.openEnd)&&r.boundChange&&r.boundChange(f),l=f,c<=0&&n.next(),c>=0&&t.next()}}function Dr(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function ml(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=pe(n,s)}return i===!0?-1:n.length}const qr="ͼ",gl=typeof Symbol>"u"?"__"+qr:Symbol.for(qr),$r=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Ol=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Tt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=Ol[gl]||1;return Ol[gl]=e+1,qr+e.toString(36)}static mount(e,t,i){let s=e[$r],r=i&&i.nonce;s?r&&s.setNonce(r):s=new od(e,r),s.mount(Array.isArray(t)?t:[t],e)}}let yl=new Map;class od{constructor(e,t){let i=e.ownerDocument||e,s=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=yl.get(i);if(r)return e[$r]=r;this.sheet=new s.CSSStyleSheet,yl.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[$r]=this}mount(e,t){let i=this.sheet,s=0,r=0;for(let o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ld=typeof navigator<"u"&&/Mac/.test(navigator.platform),ad=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ue=0;ue<10;ue++)Ct[48+ue]=Ct[96+ue]=String(ue);for(var ue=1;ue<=24;ue++)Ct[ue+111]="F"+ue;for(var ue=65;ue<=90;ue++)Ct[ue]=String.fromCharCode(ue+32),Li[ue]=String.fromCharCode(ue);for(var Vs in Ct)Li.hasOwnProperty(Vs)||(Li[Vs]=Ct[Vs]);function hd(n){var e=ld&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ad&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Li:Ct)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function U(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;e2);var Q={mac:Sl||/Mac/.test(xe.platform),windows:/Win/.test(xe.platform),linux:/Linux|X11/.test(xe.platform),ie:Ts,ie_version:Lh?Br.documentMode||6:Lr?+Lr[1]:Wr?+Wr[1]:0,gecko:bl,gecko_version:bl?+(/Firefox\/(\d+)/.exec(xe.userAgent)||[0,0])[1]:0,chrome:!!Ns,chrome_version:Ns?+Ns[1]:0,ios:Sl,android:/Android\b/.test(xe.userAgent),webkit_version:cd?+(/\bAppleWebKit\/(\d+)/.exec(xe.userAgent)||[0,0])[1]:0,safari:zr,safari_version:zr?+(/\bVersion\/(\d+(\.\d+)?)/.exec(xe.userAgent)||[0,0])[1]:0,tabSize:Br.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function zi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Ir(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function _n(n,e){if(!e.anchorNode)return!1;try{return Ir(n,e.anchorNode)}catch{return!1}}function ai(n){return n.nodeType==3?Ft(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Ri(n,e,t,i){return t?xl(n,e,t,i,-1)||xl(n,e,t,i,1):!1}function Xt(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function ss(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function xl(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:nt(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=Xt(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?nt(n):0}else return!1}}function nt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function sn(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function fd(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function zh(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function ud(n,e,t,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,p=1,m=1;if(d)u=fd(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let S=c.getBoundingClientRect();({scaleX:p,scaleY:m}=zh(c,S)),u={left:S.left,right:S.left+c.clientWidth*p,top:S.top,bottom:S.top+c.clientHeight*m}}let g=0,y=0;if(s=="nearest")e.top0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+o)):e.bottom>u.bottom&&(y=e.bottom-u.bottom+o,t<0&&e.top-y0&&e.right>u.right+g&&(g=e.right-u.right+r)):e.right>u.right&&(g=e.right-u.right+r,t<0&&e.leftu.bottom||e.leftu.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function dd(n){let e=n.ownerDocument,t,i;for(let s=n.parentNode;s&&!(s==e.body||t&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:t,y:i}}class pd{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?nt(t):0),i,Math.min(e.focusOffset,i?nt(i):0))}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let qt=null;Q.safari&&Q.safari_version>=26&&(qt=!1);function Ih(n){if(n.setActive)return n.setActive();if(qt)return n.focus(qt);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(qt==null?{get preventScroll(){return qt={preventScroll:!0},!0}}:void 0),!qt){qt=!1;for(let t=0;tMath.max(1,n.scrollHeight-n.clientHeight-4)}function Xh(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=nt(t)}else if(t.parentNode&&!ss(t))i=Xt(t),t=t.parentNode;else return null}}function Fh(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&it)return f.domBoundsAround(e,t,h);if(u>=e&&s==-1&&(s=a,r=h),h>t&&f.dom.parentNode==this.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=wo){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Uh(n,e,t,i,s,r,o,l,a){let{children:h}=n,c=h.length?h[e]:null,f=r.length?r[r.length-1]:null,u=f?f.breakAfter:o;if(!(e==i&&c&&!o&&!u&&r.length<2&&c.merge(t,s,r.length?f:null,t==0,l,a))){if(i0&&(!o&&r.length&&c.merge(t,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(tOd||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ve(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new ye(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return yd(this.dom,e,t)}}class Ot extends _{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let s of t)s.setParent(this)}setAttrs(e){if(Vh(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,s,r,o){return i&&(!(i instanceof Ot&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(s=r),i=a,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Ot(this.mark,t,o)}domAtPos(e){return jh(this,e)}coordsAt(e,t){return Zh(this,e,t)}}function yd(n,e,t){let i=n.nodeValue.length;e>i&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?Q.chrome||Q.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return Q.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?sn(a,o<0):a||null}class pt extends _{static create(e,t,i){return new pt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=pt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,s,r,o){return i&&(!(i instanceof pt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0)?ye.before(this.dom):ye.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?s.length-1:0;r=s[l],!(e>0?l==0:l==s.length-1||r.top0?ye.before(this.dom):ye.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return V.empty}get isHidden(){return!0}}Ve.prototype.children=pt.prototype.children=hi.prototype.children=wo;function jh(n,e){let t=n.dom,{children:i}=n,s=0;for(let r=0;sr&&e0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r0&&e instanceof Ot&&s.length&&(i=s[s.length-1])instanceof Ot&&i.mark.eq(e.mark)?Gh(i,e.children[0],t-1):(s.push(e),e.setParent(n)),n.length+=e.length}function Zh(n,e,t){let i=null,s=-1,r=null,o=-1;function l(h,c){for(let f=0,u=0;f=c&&(d.children.length?l(d,c-u):(!r||r.isHidden&&(t>0||Sd(r,d)))&&(p>c||u==p&&d.getSide()>0)?(r=d,o=c-u):(u-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let r of i)if(r!=t&&(s.indexOf(r)==-1||n[r]!==e[r]))return!1;return!0}function Nr(n,e,t){let i=!1;if(e)for(let s in e)t&&s in t||(i=!0,s=="style"?n.style.cssText="":n.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(i=!0,s=="style"?n.style.cssText=t[s]:n.setAttribute(s,t[s]));return i}function xd(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new Pt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=Yh(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Pt(e,i,s,t,e.widget||null,!0)}static line(e){return new on(e)}static set(e,t=!1){return N.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}R.none=N.empty;class rn extends R{constructor(e){let{start:t,end:i}=Yh(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof rn&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&rs(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}rn.prototype.point=!1;class on extends R{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof on&&this.spec.class==e.spec.class&&rs(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}on.prototype.mapMode=de.TrackBefore;on.prototype.point=!0;class Pt extends R{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?de.TrackBefore:de.TrackAfter:de.TrackDel}get type(){return this.startSide!=this.endSide?ke.WidgetRange:this.startSide<=0?ke.WidgetBefore:ke.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Pt&&kd(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Pt.prototype.point=!0;function Yh(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function kd(n,e){return n==e||!!(n&&e&&n.compare(e))}function Un(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class te extends _{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,r,o){if(i){if(!(i instanceof te))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),Hh(this,e,t,i?i.children.slice():[],r,o),!0}split(e){let t=new te;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){rs(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Gh(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Vr(t,this.attrs||{})),i&&(this.attrs=Vr({class:i},this.attrs||{}))}domAtPos(e){return jh(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Vh(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Nr(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let s=this.dom.lastChild;for(;s&&_.get(s)instanceof Ot;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((i=_.get(s))===null||i===void 0?void 0:i.isEditable)==!1&&(!Q.ios||!this.children.some(r=>r instanceof Ve))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Ve)||/[^ -~]/.test(i.text))return null;let s=ai(i.dom);if(s.length!=1)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Zh(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight=t){if(r instanceof te)return r;if(o>t)break}s=o+r.breakAfter}return null}}class mt extends _{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,s,r,o){return i&&(!(i instanceof mt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0}}class Xr extends ot{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Di{constructor(e,t,i,s){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof mt&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new te),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Sn(new hi(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof mt)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:l,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(l){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),r=Math.min(s,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Sn(new Ve(this.text.slice(this.textOff,this.textOff+r)),t),i),this.atCursorPos=!0,this.textOff+=r,e-=r,i=s<=r?0:t.length}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof Pt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(i instanceof Pt)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new mt(i.widget||ci.block,l,i));else{let a=pt.create(i.widget||ci.inline,l,l?0:i.startSide),h=this.atCursorPos&&!a.isEditable&&r<=s.length&&(e0),c=!a.isEditable&&(es.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(f.append(Sn(new hi(1),s),r),r=s.length+Math.max(0,r-s.length)),f.append(Sn(a,s),r),this.atCursorPos=c,this.pendingBuffer=c?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,i,s,r){let o=new Di(e,t,i,r);return o.openEnd=N.spans(s,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Sn(n,e){for(let t of e)n=new Ot(t,[n],n.length);return n}class ci extends ot{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ci.inline=new ci("span");ci.block=new ci("div");var Z=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(Z||(Z={}));const _t=Z.LTR,vo=Z.RTL;function Kh(n){let e=[];for(let t=0;t=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function ec(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;m-=3)if(Ue[m+1]==-d){let g=Ue[m+2],y=g&2?s:g&4?g&1?r:s:0;y&&(H[f]=H[Ue[m]]=y),l=m;break}}else{if(Ue.length==189)break;Ue[l++]=f,Ue[l++]=u,Ue[l++]=a}else if((p=H[f])==2||p==1){let m=p==s;a=m?0:1;for(let g=l-3;g>=0;g-=3){let y=Ue[g+2];if(y&2)break;if(m)Ue[g+2]|=2;else{if(y&4)break;Ue[g+2]|=4}}}}}function Qd(n,e,t,i){for(let s=0,r=i;s<=t.length;s++){let o=s?t[s-1].to:n,l=sa;)p==g&&(p=t[--m].from,g=m?t[m-1].to:n),H[--p]=d;a=c}else r=h,a++}}}function _r(n,e,t,i,s,r,o){let l=i%2?2:1;if(i%2==s%2)for(let a=e,h=0;aa&&o.push(new wt(a,m.from,d));let g=m.direction==_t!=!(d%2);Ur(n,g?i+1:i,s,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(c?H[p]!=l:H[p]==l))break;p++}u?_r(n,a,p,i+1,s,u,o):ae;){let c=!0,f=!1;if(!h||a>r[h-1].to){let m=H[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(h&&p==r[h-1].to){if(f)break e;let m=r[--h];if(!c)for(let g=m.from,y=h;;){if(g==e)break e;if(y&&r[y-1].to==g)g=r[--y].from;else{if(H[g-1]==l)break e;break}}if(u)u.push(m);else{m.toH.length;)H[H.length]=256;let i=[],s=e==_t?0:1;return Ur(n,s,s,t,0,n.length,i),i}function tc(n){return[new wt(0,n,0)]}let ic="";function Md(n,e,t,i,s){var r;let o=i.head-n.from,l=wt.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=e[l],h=a.side(s,t);if(o==h){let u=l+=s?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!s,t),h=a.side(s,t)}let c=pe(n.text,o,a.forward(s,t));(ca.to)&&(c=h),ic=n.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return f&&c==h&&f.level+(s?0:1)n.some(e=>e)}),cc=A.define({combine:n=>n.some(e=>e)}),fc=A.define();class ni{constructor(e,t="nearest",i="nearest",s=5,r=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new ni(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ni(b.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const xn=q.define({map:(n,e)=>n.map(e)}),uc=q.define();function Pe(n,e,t){let i=n.facet(oc);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const dt=A.define({combine:n=>n.length?n[0]:!0});let Dd=0;const Kt=A.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let a=[];return o&&a.push(Ii.of(h=>{let c=h.plugin(l);return c?o(c):R.none})),r&&a.push(r(l)),a})}static fromClass(e,t){return J.define((i,s)=>new e(i,s),t)}}class Xs{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Pe(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Pe(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Pe(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const dc=A.define(),Po=A.define(),Ii=A.define(),pc=A.define(),ln=A.define(),mc=A.define();function Tl(n,e){let t=n.state.facet(mc);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(n):r),s=[];return N.spans(i,e.from,e.to,{point(){},span(r,o,l,a){let h=r-e.from,c=o-e.from,f=s;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,p;if(d==null&&(d=Rd(e.text,h,c)),a>0&&f.length&&(p=f[f.length-1]).to==h&&p.direction==d)p.to=c,f=p.inner;else{let m={from:h,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),s}const gc=A.define();function Qo(n){let e=0,t=0,i=0,s=0;for(let r of n.state.facet(gc)){let o=r(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:i,bottom:s}}const Ti=A.define();class Le{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Le(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAc)break;r+=2}if(!a)return i;new Le(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),o=a.toA,l=a.toB}}}class os{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=se.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,l,a)=>s.push(new Le(r,o,l,a))),this.changedRanges=s}static create(e,t,i){return new os(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Cl extends _{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=R.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new te],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Le(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:h,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!zd(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?qd(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:c}=this.hasComposition;i=new Le(h,c,e.changes.mapPos(h,-1),e.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Q.ie||Q.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=Wd(o,l,e.changes);return i=Le.extendWithRanges(i,a),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=Q.chrome||Q.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||s.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to=0?s[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:c,toB:f}=l,u,d,p,m;if(i&&i.range.fromBc){let w=Di.build(this.view.state.doc,c,i.range.fromB,this.decorations,this.dynamicDecorationMap),k=Di.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);d=w.breakAtStart,p=w.openStart,m=k.openEnd;let v=this.compositionView(i);k.breakAtStart?v.breakAfter=1:k.content.length&&v.merge(v.length,v.length,k.content[0],!1,k.openStart,0)&&(v.breakAfter=k.content[0].breakAfter,k.content.shift()),w.content.length&&v.merge(0,0,w.content[w.content.length-1],!0,0,w.openEnd)&&w.content.pop(),u=w.content.concat(v).concat(k.content)}else({content:u,breakAtStart:d,openStart:p,openEnd:m}=Di.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:y}=r.findPos(h,1),{i:S,off:x}=r.findPos(a,-1);Uh(this,S,x,g,y,u,d,p,m)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(uc)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Ve(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new Ot(s,[t],t.length);let i=new te;return i.append(t,0),i}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=_.get(r);l&&l!=o&&(l.dom=null),o.setDOM(r)},i=this.childPos(e.range.fromB,1),s=this.children[i.i];t(e.line,s);for(let r=e.marks.length-1;r>=-1;r--)i=s.childPos(i.off,1),s=s.children[i.i],t(r>=0?e.marks[r].node:e.text,s)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom,r=!s&&!(this.view.state.facet(dt)||this.dom.tabIndex>-1)&&_n(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(Q.gecko&&l.empty&&!this.hasComposition&&Ed(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=h=new ye(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!Ri(a.node,a.offset,c.anchorNode,c.anchorOffset)||!Ri(h.node,h.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(c.focusNode)&&Ld(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=zi(this.view.root);if(f)if(l.empty){if(Q.gecko){let u=$d(a.node,a.offset);if(u&&u!=3){let d=(u==1?Xh:Fh)(a.node,a.offset);d&&(a=new ye(d.node,d.offset))}}f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(u)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new ye(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new ye(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ri(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=zi(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=te.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(s,r)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let s=e.offset;!i&&s=0;s--){let r=_.get(t.childNodes[s]);r instanceof te&&(i=r.domAtPos(r.length))}return i?new ye(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=_.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t=0;o--){let l=this.children[o],a=r-l.breakAfter,h=a-l.length;if(ae||l.covers(1))&&(!i||l instanceof te&&!(i instanceof te&&t>=0)))i=l,s=h;else if(i&&h==e&&a==e&&l instanceof mt&&Math.abs(t)<2){if(l.deco.startSide<0)break;o&&(i=null)}r=h}return i?i.coordsAt(e-s,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),s=this.children[t];if(!(s instanceof te))return null;for(;s.children.length;){let{i:l,off:a}=s.childPos(i,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}i=a}if(!(s instanceof Ve))return null;let r=pe(s.text,i);if(r==i)return null;let o=Ft(s.dom,i,r).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Z.LTR;for(let h=0,c=0;cs)break;if(h>=i){let d=f.dom.getBoundingClientRect();if(t.push(d.height),o){let p=f.dom.lastChild,m=p?ai(p):[];if(m.length){let g=m[m.length-1],y=a?g.right-d.left:d.right-g.left;y>l&&(l=y,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Z.RTL:Z.LTR}measureTextSize(){for(let r of this.children)if(r instanceof te){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=ai(e.firstChild)[0];t=e.getBoundingClientRect().height,i=r?r.width/27:7,s=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:s}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new _h(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(R.replace({widget:new Xr(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return R.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Ii).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),i=!1,s=this.view.state.facet(pc).map((r,o)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[e++]=i,t.push(N.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];et.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=Qo(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;ud(this.view.scrollDOM,o,t.heads instanceof pt||s.children.some(i);return i(this.children[t])}}function Ed(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function Oc(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=Xh(t.focusNode,t.focusOffset),s=Fh(t.focusNode,t.focusOffset),r=i||s;if(s&&i&&s.node!=i.node){let l=_.get(s.node);if(!l||l instanceof Ve&&l.text!=s.node.nodeValue)r=s;else if(n.docView.lastCompositionAfterCursor){let a=_.get(i.node);!a||a instanceof Ve&&a.text!=i.node.nodeValue||(r=s)}}if(n.docView.lastCompositionAfterCursor=r!=i,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function qd(n,e,t){let i=Oc(n,t);if(!i)return null;let{node:s,from:r,to:o}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc,h=new Le(a.mapPos(r),a.mapPos(o),r,o),c=[];for(let f=s.parentNode;;f=f.parentNode){let u=_.get(f);if(u instanceof Ot)c.push({node:f,deco:u.mark});else{if(u instanceof te||f.nodeName=="DIV"&&f.parentNode==n.contentDOM)return{range:h,text:s,marks:c,line:f};if(f!=n.contentDOM)c.push({node:f,deco:new rn({inclusive:!0,attributes:xd(f),tagName:f.tagName.toLowerCase()})});else return null}}}function $d(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}function Id(n,e,t=1){let i=n.charCategorizer(e),s=n.doc.lineAt(e),r=e-s.from;if(s.length==0)return b.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,l=r;t<0?o=pe(s.text,r,!1):l=pe(s.text,r);let a=i(s.text.slice(o,l));for(;o>0;){let h=pe(s.text,o,!1);if(i(s.text.slice(h,o))!=a)break;o=h}for(;ln?e.left-n:Math.max(0,n-e.right)}function Nd(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function Fs(n,e){return n.tope.top+1}function Pl(n,e){return en.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function jr(n,e,t){let i,s,r,o,l=!1,a,h,c,f;for(let p=n.firstChild;p;p=p.nextSibling){let m=ai(p);for(let g=0;gx||o==x&&r>S)&&(i=p,s=y,r=S,o=x,l=S?e0:gy.bottom&&(!c||c.bottomy.top)&&(h=p,f=y):c&&Fs(c,y)?c=Ql(c,y.bottom):f&&Fs(f,y)&&(f=Pl(f,y.top))}}if(c&&c.bottom>=t?(i=a,s=c):f&&f.top<=t&&(i=h,s=f),!i)return{node:n,offset:0};let u=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return Al(i,u,t);if(l&&i.contentEditable!="false")return jr(i,u,t);let d=Array.prototype.indexOf.call(n.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:n,offset:d}}function Al(n,e,t){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;lt?c.top-t:t-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=u;if(Q.chrome||Q.gecko){let p=Ft(n,l).getBoundingClientRect();Math.abs(p.left-c.right)<.1&&(d=!u)}if(f<=0)return{node:n,offset:l+(d?1:0)};s=l+(d?1:0),r=f}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function yc(n,e,t,i=-1){var s,r;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,a,{docHeight:h}=n.viewState,{x:c,y:f}=e,u=f-l;if(u<0)return 0;if(u>h)return n.state.doc.length;for(let w=n.viewState.heightOracle.textHeight/2,k=!1;a=n.elementAtHeight(u),a.type!=ke.Text;)for(;u=i>0?a.bottom+w:a.top-w,!(u>=0&&u<=h);){if(k)return t?null:0;k=!0,i=-i}f=l+u;let d=a.from;if(dn.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:t?null:Ml(n,o,a,c,f);let p=n.dom.ownerDocument,m=n.root.elementFromPoint?n.root:p,g=m.elementFromPoint(c,f);g&&!n.contentDOM.contains(g)&&(g=null),g||(c=Math.max(o.left+1,Math.min(o.right-1,c)),g=m.elementFromPoint(c,f),g&&!n.contentDOM.contains(g)&&(g=null));let y,S=-1;if(g&&((s=n.docView.nearest(g))===null||s===void 0?void 0:s.isEditable)!=!1){if(p.caretPositionFromPoint){let w=p.caretPositionFromPoint(c,f);w&&({offsetNode:y,offset:S}=w)}else if(p.caretRangeFromPoint){let w=p.caretRangeFromPoint(c,f);w&&({startContainer:y,startOffset:S}=w)}y&&(!n.contentDOM.contains(y)||Q.safari&&Xd(y,S,c)||Q.chrome&&Fd(y,S,c))&&(y=void 0),y&&(S=Math.min(nt(y),S))}if(!y||!n.docView.dom.contains(y)){let w=te.find(n.docView,d);if(!w)return u>a.top+a.height/2?a.to:a.from;({node:y,offset:S}=jr(w.dom,c,f))}let x=n.docView.nearest(y);if(!x)return null;if(x.isWidget&&((r=x.dom)===null||r===void 0?void 0:r.nodeType)==1){let w=x.dom.getBoundingClientRect();return e.yn.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((s-t.top-(n.defaultLineHeight-l)*.5)/l);r+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+Er(o,r,n.state.tabSize)}function bc(n,e,t){let i,s=n;if(n.nodeType!=3||e!=(i=n.nodeValue.length))return!1;for(;;){let r=s.nextSibling;if(r){if(r.nodeName=="BR")break;return!1}else{let o=s.parentNode;if(!o||o.nodeName=="DIV")break;s=o}}return Ft(n,i-1,i).getBoundingClientRect().right>t}function Xd(n,e,t){return bc(n,e,t)}function Fd(n,e,t){if(e!=0)return bc(n,e,t);for(let s=n;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let i=n.nodeType==1?n.getBoundingClientRect():Ft(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Gr(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let s;for(let r of i.type){if(r.from>e)break;if(!(r.toe)return r;(!s||r.type==ke.Text&&(s.type!=r.type||(t<0?r.frome)))&&(s=r)}}return s||i}return i}function _d(n,e,t,i){let s=Gr(n,e.head,e.assoc||-1),r=!i||s.type!=ke.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(s.from),a=n.posAtCoords({x:t==(l==Z.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return b.cursor(a,t?-1:1)}return b.cursor(t?s.to:s.from,t?-1:1)}function Rl(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,a=null;;){let h=Md(s,r,o,l,t),c=ic;if(!h){if(s.number==(t?n.state.doc.lines:1))return l;c=` -`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),h=n.visualLineSide(s,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function Ud(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==Y.Space&&(s=o),s==o}}function Hd(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return b.cursor(s,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s,e.assoc||-1),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+c}let f=a.left+o,u=i??n.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,m=yc(n,{x:f,y:p},!1,r);if(pa.bottom||(r<0?ms)){let g=n.docView.coordsForChar(m),y=!g||p{if(e>r&&es(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:b.cursor(i,ir)&&!Zd(o,t)&&this.lineBreak(),s=o}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=_.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(Gd(e,i.node,i.offset)?t:0))}}function Gd(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let l=r||o?[]:Jd(e),a=new jd(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=ep(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!Ir(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Ir(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((Q.ios||Q.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(b.range(h,a)):this.newSel=b.single(h,a)}}}function xc(n,e){let t,{newSel:i}=e,s=n.state.selection.main,r=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=s.from,h=null;(r===8||Q.android&&e.text.length=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,s.to))}:n.state.doc.lineAt(s.from).toDate.now()-50?t={from:s.from,to:s.to,insert:n.state.toText(n.inputState.insertingText)}:Q.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` - `&&n.lineWrapping&&(i&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:V.of([" "])}),t)return Ao(n,t,i,r);if(i&&!i.main.eq(s)){let o=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=Sc(n.state.facet(ln).map(a=>a(n)),i))),n.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function Ao(n,e,t,i=-1){if(Q.ios&&n.inputState.flushIOSKey(e))return!0;let s=n.state.selection.main;if(Q.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&n.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ii(n.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.lengths.head)&&ii(n.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&ii(n.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=Kd(n,e,t));return n.state.facet(lc).some(a=>a(n,e.from,e.to,r,l))||n.dispatch(l()),!0}function Kd(n,e,t){let i,s=n.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.fromr.to){let a=e.fromf(n)),h,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:b.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=r.frome.to?s.sliceDoc(e.to,r.to):"";i=s.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=s.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let c=n.state.sliceDoc(e.from,e.to),f,u=t&&Oc(n,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=n.state.doc.lineAt(r.head);let d=r.to-e.to;i=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:a,range:h||p.map(a)};let m=p.to-d,g=m-c.length;if(n.state.sliceDoc(g,m)!=c||m>=f.from&&g<=f.to)return{range:p};let y=s.changes({from:g,to:m,insert:e.insert}),S=p.to-r.to;return{changes:y,range:h?b.range(Math.max(0,h.anchor+S),Math.max(0,h.head+S)):p.map(y)}})}else i={changes:a,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function kc(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Jd(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new Dl(t,i)),(s!=t||r!=i)&&e.push(new Dl(s,r))),e}function ep(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?b.single(t+e,i+e):null}class tp{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Q.safari&&e.contentDOM.addEventListener("input",()=>null),Q.gecko&&Op(e.contentDOM.ownerDocument)}handleEvent(e){!hp(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=ip(e),i=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&vc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Q.android&&Q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return Q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=wc.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||np.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function El(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(s){Pe(t.state,s)}}}function ip(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let l in r){let a=r[l];a&&t(l).handlers.push(El(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(El(i.value,a))}}for(let i in Ne)t(i).handlers.push(Ne[i]);for(let i in ze)t(i).observers.push(ze[i]);return e}const wc=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],np="dthko",vc=[16,17,18,20,91,92,224,225],kn=6;function wn(n){return Math.max(0,n)*.7+8}function sp(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class rp{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=dd(e.contentDOM),this.atoms=e.state.facet(ln).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(I.allowMultipleSelections)&&op(e,t),this.dragging=ap(e,t)&&Pc(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&sp(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Qo(this.view);e.clientX-a.left<=s+kn?t=-wn(s-e.clientX):e.clientX+a.right>=o-kn&&(t=wn(e.clientX-o)),e.clientY-a.top<=r+kn?i=-wn(r-e.clientY):e.clientY+a.bottom>=l-kn&&(i=wn(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=Sc(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function op(n,e){let t=n.state.facet(nc);return t.length?t[0](e):Q.mac?e.metaKey:e.ctrlKey}function lp(n,e){let t=n.state.facet(sc);return t.length?t[0](e):Q.mac?!e.altKey:!e.ctrlKey}function ap(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=zi(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function hp(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=_.get(t))&&i.ignoreEvent(e))return!1;return!0}const Ne=Object.create(null),ze=Object.create(null),Tc=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function cp(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Cc(n,t.value)},50)}function Cs(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function Cc(n,e){e=Cs(n.state,To,e);let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Zr!=null&&t.selection.ranges.every(a=>a.empty)&&Zr==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:b.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ze.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};Ne.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);ze.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};ze.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Ne.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(rc))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=dp(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new rp(n,e,t,i)),i&&n.observer.ignore(()=>{Ih(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function ql(n,e,t,i){if(i==1)return b.cursor(e,t);if(i==2)return Id(n.state,e,t);{let s=te.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return le>=t.top&&e<=t.bottom&&n>=t.left&&n<=t.right;function fp(n,e,t,i){let s=te.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&$l(t,i,o))return-1;let l=s.coordsAt(r,1);return l&&$l(t,i,l)?1:o&&o.bottom>=i?-1:1}function Bl(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:fp(n,t,e.clientX,e.clientY)}}const up=Q.ie&&Q.ie_version<=11;let Wl=null,Ll=0,zl=0;function Pc(n){if(!up)return n.detail;let e=Wl,t=zl;return Wl=n,zl=Date.now(),Ll=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(Ll+1)%3:1}function dp(n,e){let t=Bl(n,e),i=Pc(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,l){let a=Bl(n,r),h,c=ql(n,a.pos,a.bias,i);if(t.pos!=a.pos&&!o){let f=ql(n,t.pos,t.bias,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=pp(s,a.pos))?h:l?s.addRange(c):b.create([c])}}}function pp(n,e){for(let t=0;t=e)return b.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Ne.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let s=n.docView.nearest(e.target);if(s&&s.isWidget){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=b.range(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Cs(n.state,Co,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ne.dragend=n=>(n.inputState.draggedContent=null,!1);function Il(n,e,t,i){if(t=Cs(n.state,To,t),!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&lp(n,e)?{from:r.from,to:r.to}:null,l={from:s,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Ne.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,r=()=>{++s==t.length&&Il(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Il(n,e,i,!0),!0}return!1};Ne.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=Tc?null:e.clipboardData;return t?(Cc(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(cp(n),!1)};function mp(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function gp(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:Cs(n,Co,e.join(n.lineBreak)),ranges:t,linewise:i}}let Zr=null;Ne.copy=Ne.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=gp(n.state);if(!t&&!s)return!1;Zr=s?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=Tc?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(mp(n,t),!1)};const Qc=st.define();function Ac(n,e){let t=[];for(let i of n.facet(ac)){let s=i(n,e);s&&t.push(s)}return t.length?n.update({effects:t,annotations:Qc.of(!0)}):null}function Mc(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=Ac(n.state,e);t?n.dispatch(t):n.update([])}},10)}ze.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),Mc(n)};ze.blur=n=>{n.observer.clearSelectionRange(),Mc(n)};ze.compositionstart=ze.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};ze.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,Q.chrome&&Q.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};ze.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Ne.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return Ao(n,{from:a,to:h,insert:n.state.toText(r)},null),!0}}let s;if(Q.chrome&&Q.android&&(s=wc.find(r=>r.inputType==e.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return Q.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),Q.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>ze.compositionend(n,e),20),!1};const Vl=new Set;function Op(n){Vl.has(n)||(Vl.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const Nl=["pre-wrap","normal","pre-line","break-spaces"];let fi=!1;function Xl(){fi=!1}class yp{constructor(e){this.lineWrapping=e,this.doc=V.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Nl.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Hn&&(fi=!0),this.height=e)}replace(e,t,i){return we.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l],u=r.lineAt(a,G.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,G.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=s[l-1].toA;)a=s[l-1].fromA,c=s[l-1].fromB,l--,ar*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class De extends Rc{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,s){return new Ke(s,this.length,i,this.height,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof De||s instanceof fe&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof fe?s=new De(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):we.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(s.heights[s.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class fe extends we{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let h=s+(e0){let r=i[i.length-1];r instanceof fe?i[i.length-1]=new fe(r.length+s):i.push(null,new fe(s-1))}if(e>0){let r=i[0];r instanceof fe?i[0]=new fe(e+r.length):i.unshift(new fe(e-1),null)}return we.of(i)}decomposeLeft(e,t){t.push(new fe(e-1),null)}decomposeRight(e,t){t.push(null,new fe(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;for(s.from>t&&o.push(new fe(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++];a==-1?a=f:Math.abs(f-a)>=Hn&&(a=-2);let u=new De(c,f);u.outdated=!1,o.push(u),l+=c+1}l<=r&&o.push(null,new fe(r-l).updateHeight(e,l));let h=we.of(o);return(a<0||Math.abs(h.height-this.height)>=Hn||Math.abs(a-this.heightMetrics(e,t).perLine)>=Hn)&&(fi=!0),ls(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Sp extends we{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return h;let c=t==G.ByPosNoHeight?G.ByPosNoHeight:G.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,G.ByPos,i,s,r);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&Fl(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?we.of(this.break?[e,null,t]:[e,t]):(this.left=ls(this.left,e),this.right=ls(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return s&&s.from<=t+r.length&&s.more?a=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Fl(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof fe&&(i=n[e+1])instanceof fe&&n.splice(e-1,3,new fe(t.length+1+i.length))}const xp=5;class Mo{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof De?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new De(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=xp)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new De(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new fe(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof De)return e;let t=new De(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof De)&&!this.isCovered?this.nodes.push(new De(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==n.parentNode?s.innerHeight:a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function Tp(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function Cp(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Us{constructor(e,t,i,s){this.from=e,this.to=t,this.size=i,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new yp(t),this.stateDeco=e.facet(Ii).filter(i=>typeof i!="function"),this.heightMap=we.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle.setDoc(e.doc),[new Le(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=R.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new vn(r,o))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ul:new Ro(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Pi(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ii).filter(c=>typeof c!="function");let s=e.changedRanges,r=Le.extendWithRanges(s,kp(i,this.stateDeco,e?e.changes:se.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Xl(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||fi)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(cc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Z.RTL:Z.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:w,scaleY:k}=zh(t,l);(w>.005&&Math.abs(this.scaleX-w)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=w,this.scaleY=k,h|=16,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Nh(e.scrollDOM);let p=(this.printing?Cp:vp)(t,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget&&!Tp(e.dom))return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let w=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(w)&&(o=!0),o||s.lineWrapping&&Math.abs(S-this.contentDOMWidth)>s.charWidth){let{lineHeight:k,charWidth:v,textHeight:T}=e.docView.measureTextSize();o=k>0&&s.refresh(r,k,v,T,Math.max(5,S/v),w),o&&(e.docView.minWidth=0,h|=16)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),Xl();for(let k of this.viewports){let v=k.from==this.viewport.from?w:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?we.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle,[new Le(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new bp(k.from,v))}fi&&(h|=2)}let x=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return x&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||x)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new vn(s.lineAt(o-i*1e3,G.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,G.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,G.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=Z.LTR&&!i)return[];let l=[],a=(c,f,u,d)=>{if(f-cc&&yy.from>=u.from&&y.to<=u.to&&Math.abs(y.from-c)y.fromS));if(!g){if(fx.from<=f&&x.to>=f)){let x=t.moveToLineBoundary(b.cursor(f),!1,!0).head;x>c&&(f=x)}let y=this.gapSize(u,c,f,d),S=i||y<2e6?y:2e6;g=new Us(c,f,y,S)}l.push(g)},h=c=>{if(c.length2e6)for(let v of e)v.from>=c.from&&v.fromc.from&&a(c.from,d,c,f),pt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];N.spans(t,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let r=0;r=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Pi(this.heightMap.lineAt(e,G.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Pi(this.heightMap.lineAt(this.scaler.fromDOM(e),G.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Pi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class vn{constructor(e,t){this.from=e,this.to=t}}function Qp(n,e,t){let i=[],s=n,r=0;return N.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function Cn(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function Ap(n,e){for(let t of n)if(e(t))return t}const Ul={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};class Ro{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,G.ByPos,e,0,0).top,c=t.lineAt(a,G.ByPos,e,0,0).bottom;return s+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Pi(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Ke(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(s=>Pi(s,e)):n._content)}const Pn=A.define({combine:n=>n.join(" ")}),Yr=A.define({combine:n=>n.indexOf(!0)>-1}),Kr=Tt.newName(),Dc=Tt.newName(),Ec=Tt.newName(),qc={"&light":"."+Dc,"&dark":"."+Ec};function Jr(n,e,t){return new Tt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const Mp=Jr("."+Kr,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},qc),Rp={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Hs=Q.ie&&Q.ie_version<=11;class Dp{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new pd,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(Q.ie&&Q.ie_version<=11||Q.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Q.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Q.chrome&&Q.chrome_version<126)&&(this.editContext=new qp(e),e.state.facet(dt)&&(e.contentDOM.editContext=this.editContext.editContext)),Hs&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(dt)?i.root.activeElement!=this.dom:!_n(this.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Ri(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=zi(e.root);if(!t)return!1;let i=Q.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Ep(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=_n(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&ii(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&_n(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Yd(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,s=xc(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=Hl(t,e.previousSibling||e.target.previousSibling,-1),s=Hl(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(dt)!=e.state.facet(dt)&&(e.view.contentDOM.editContext=e.state.facet(dt)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Hl(n,e,t){for(;e;){let i=_.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function jl(n,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,r=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor);return Ri(o.node,o.offset,s,r)&&([t,i,s,r]=[s,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function Ep(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return jl(n,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?jl(n,t):null}class qp{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let s=e.state.selection.main,{anchor:r,head:o}=s,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&rthis.to&&(a=r);let c=kc(e.state.sliceDoc(l,a),i.text,(h?s.from:s.to)-l,h?"end":null);if(!c){let u=b.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));u.main.eq(s)||e.dispatch({selection:u,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:V.of(i.text.slice(c.from,c.toB).split(` -`))};if((Q.mac||Q.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:V.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Ao(e,f,b.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=zi(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,t+=c,this.to+=c;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(rthis.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),s&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class P{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||md(e.parent)||document,this.viewState=new _l(e.state||I.create(e)),e.scrollTo&&e.scrollTo.is(xn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Kt).map(s=>new Xs(s));for(let s of this.plugins)s.update(this);this.observer=new Dp(this),this.inputState=new tp(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Cl(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof ie?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(Qc))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Ac(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(I.phrases)!=this.state.facet(I.phrases))return this.setState(r);s=os.create(this,r,e),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new ni(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(xn)&&(f=d.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=as.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Ti)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Pn)!=s.state.facet(Pn)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(Hr))try{u(s)}catch(d){Pe(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!xc(this,c)&&h.force&&ii(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new _l(e),this.plugins=e.facet(Kt).map(i=>new Xs(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Cl(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Kt),i=e.state.facet(Kt);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new Xs(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Nh(i))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(p){return Pe(this.state,p),Gl}}),f=os.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let d=0;d1||p<-1){s=s+p,i.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Hr))l(t)}get themeClasses(){return Kr+" "+(this.state.facet(Yr)?Ec:Dc)+" "+this.state.facet(Pn)}updateAttrs(){let e=Zl(this,dc,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(dt)?"true":"false",class:"cm-content",style:`${Q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Zl(this,Po,t);let i=this.observer.ignore(()=>{let s=Nr(this.contentDOM,this.contentAttrs,t),r=Nr(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(P.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Ti);let e=this.state.facet(P.cspNonce);Tt.mount(this.root,this.styleModules.concat(Mp).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return _s(this,e,Rl(this,e,t,i))}moveByGroup(e,t){return _s(this,e,Rl(this,e,t,i=>Ud(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return b.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return _d(this,e,t,i)}moveVertically(e,t,i){return _s(this,e,Hd(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),yc(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[wt.find(r,e-s.from,-1,t)];return sn(i,o.dir==Z.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(hc)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>$p)return tc(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||ec(r.isolates,i=Tl(this,e))))return r.order;i||(i=Tl(this,e));let s=Ad(e.text,t,i);return this.bidiCache.push(new as(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ih(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return xn.of(new ni(typeof e=="number"?b.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return xn.of(new ni(b.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return J.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return J.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=Tt.newName(),s=[Pn.of(i),Ti.of(Jr(`.${i}`,e))];return t&&t.dark&&s.push(Yr.of(!0)),s}static baseTheme(e){return Mt.lowest(Ti.of(Jr("."+Kr,e,qc)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&_.get(i)||_.get(e);return((t=s?.rootView)===null||t===void 0?void 0:t.view)||null}}P.styleModule=Ti;P.inputHandler=lc;P.clipboardInputFilter=To;P.clipboardOutputFilter=Co;P.scrollHandler=fc;P.focusChangeEffect=ac;P.perLineTextDirection=hc;P.exceptionSink=oc;P.updateListener=Hr;P.editable=dt;P.mouseSelectionStyle=rc;P.dragMovesSelection=sc;P.clickAddsSelectionRange=nc;P.decorations=Ii;P.outerDecorations=pc;P.atomicRanges=ln;P.bidiIsolatedRanges=mc;P.scrollMargins=gc;P.darkTheme=Yr;P.cspNonce=A.define({combine:n=>n.length?n[0]:""});P.contentAttributes=Po;P.editorAttributes=dc;P.lineWrapping=P.contentAttributes.of({class:"cm-lineWrapping"});P.announce=q.define();const $p=4096,Gl={};class as{constructor(e,t,i,s,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:Z.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&Vr(o,t)}return t}const Bp=Q.mac?"mac":Q.windows?"win":Q.linux?"linux":"key";function Wp(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let a=0;ai.concat(s),[]))),t}function zp(n,e,t){return Bc($c(n.state),e,n,t)}let xt=null;const Ip=4e3;function Vp(n,e=Bp){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>Wp(y,e));for(let y=1;y{let w=xt={view:x,prefix:S,scope:o};return setTimeout(()=>{xt==w&&(xt=null)},Ip),!0}]})}let m=p.join(" ");s(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(d=>f(d,eo))}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let eo=null;function Bc(n,e,t,i){eo=e;let s=hd(e),r=Te(s,0),o=Ye(r)==s.length&&s!=" ",l="",a=!1,h=!1,c=!1;xt&&xt.view==t&&xt.scope==i&&(l=xt.prefix+" ",vc.indexOf(e.keyCode)<0&&(h=!0,xt=null));let f=new Set,u=g=>{if(g){for(let y of g.run)if(!f.has(y)&&(f.add(y),y(t)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},d=n[i],p,m;return d&&(u(d[l+Qn(s,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Q.windows&&e.ctrlKey&&e.altKey)&&!(Q.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Ct[e.keyCode])&&p!=s?(u(d[l+Qn(p,e,!0)])||e.shiftKey&&(m=Li[e.keyCode])!=s&&m!=p&&u(d[l+Qn(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+Qn(s,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),eo=null,a}class hn{constructor(e,t,i,s,r){this.className=e,this.left=t,this.top=i,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=Wc(e);return[new hn(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return Np(e,t,i)}}function Wc(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Z.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function Kl(n,e,t,i){let s=n.coordsAtPos(e,t*2);if(!s)return i;let r=n.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=n.posAtCoords({x:r.left+1,y:o}),a=n.posAtCoords({x:r.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function Np(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to),r=n.textDirection==Z.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=Wc(n),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=Gr(n,i,1),p=Gr(n,s,-1),m=d.type==ke.Text?d:null,g=p.type==ke.Text?p:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=Kl(n,i,1,m)),g&&(n.lineWrapping||p.widgetLineBreaks)&&(g=Kl(n,s,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return S(x(t.from,t.to,m));{let k=m?x(t.from,null,m):w(d,!1),v=g?x(null,t.to,g):w(p,!0),T=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&k.bottom+n.defaultLineHeight/2D&&W.from=ne)break;ee>X&&$(Math.max(F,X),k==null&&F<=D,Math.min(ee,ne),v==null&&ee>=B,me.dir)}if(X=oe.to+1,X>=ne)break}return z.length==0&&$(D,k==null,B,v==null,n.textDirection),{top:E,bottom:M,horizontal:z}}function w(k,v){let T=l.top+(v?k.top:k.bottom);return{top:T,bottom:T,horizontal:[]}}}function Xp(n,e){return n.constructor==e.constructor&&n.eq(e)}class Fp{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(jn)!=e.state.facet(jn)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(jn);for(;t!Xp(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,Q.safari&&Q.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const jn=A.define();function Lc(n){return[J.define(e=>new Fp(e,n)),jn.of(n)]}const Vi=A.define({combine(n){return rt(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function _p(n={}){return[Vi.of(n),Up,Hp,jp,cc.of(!0)]}function zc(n){return n.startState.facet(Vi)!=n.state.facet(Vi)}const Up=Lc({above:!0,markers(n){let{state:e}=n,t=e.facet(Vi),i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty||t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:b.cursor(s.head,s.head>s.anchor?-1:1);for(let a of hn.forRange(n,o,l))i.push(a)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=zc(n);return t&&Jl(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){Jl(e.state,n)},class:"cm-cursorLayer"});function Jl(n,e){e.style.animationDuration=n.facet(Vi).cursorBlinkRate+"ms"}const Hp=Lc({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:hn.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||zc(n)},class:"cm-selectionLayer"}),jp=Mt.highest(P.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Ic=q.define({map(n,e){return n==null?null:e.mapPos(n)}}),Qi=he.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(Ic)?i.value:t,n)}}),Gp=J.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Qi);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Qi)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(Qi),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Qi)!=n&&this.view.dispatch({effects:Ic.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Zp(){return[Qi,Gp]}function ea(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function Yp(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class Kp{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,a,h,c)=>s(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new gt,i=t.add.bind(t);for(let{from:s,to:r}of Yp(e,this.maxLength))ea(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(i=Math.min(l,i),s=Math.max(a,s))}),e.viewportMoved||s-i>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>=o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(y.range(m,g));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(g,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:u})}}return t}}const to=/x/.unicode!=null?"gu":"g",Jp=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,to),em={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let js=null;function tm(){var n;if(js==null&&typeof document<"u"&&document.body){let e=document.body.style;js=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return js||!1}const Gn=A.define({combine(n){let e=rt(n,{render:null,specialChars:Jp,addSpecialChars:null});return(e.replaceTabs=!tm())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,to)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,to)),e}});function im(n={}){return[Gn.of(n),nm()]}let ta=null;function nm(){return ta||(ta=J.fromClass(class{constructor(n){this.view=n,this.decorations=R.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Gn)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Kp({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=Te(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,a=gi(o.text,l,i-o.from);return R.replace({widget:new lm((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=R.replace({widget:new om(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Gn);n.startState.facet(Gn)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const sm="•";function rm(n){return n>=32?sm:n==10?"␤":String.fromCharCode(9216+n)}class om extends ot{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=rm(this.code),i=e.state.phrase("Control character")+" "+(em[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class lm extends ot{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function am(){return cm}const hm=R.line({class:"cm-activeLine"}),cm=J.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(hm.range(s.from)),e=s.from)}return R.set(t)}},{decorations:n=>n.decorations});class fm extends ot{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?ai(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),s=sn(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function um(n){let e=J.fromClass(class{constructor(t){this.view=t,this.placeholder=n?R.set([R.widget({widget:new fm(n),side:1}).range(0)]):R.none}get decorations(){return this.view.state.doc.length?R.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,P.contentAttributes.of({"aria-placeholder":n})]:e}const io=2e3;function dm(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>io||t.off>io||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=s;a++){let h=n.doc.line(a);h.length<=l&&r.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=s;a++){let h=n.doc.line(a),c=Er(h.text,o,n.tabSize,!0);if(c<0)r.push(b.cursor(h.to));else{let f=Er(h.text,l,n.tabSize);r.push(b.range(h.from+c,h.from+f))}}}return r}function pm(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function ia(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>io?-1:s==i.length?pm(n,e.clientX):gi(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function mm(n,e){let t=ia(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=ia(n,s);if(!l)return i;let a=dm(n.state,t,l);return a.length?o?b.create(a.concat(i.ranges)):b.create(a):i}}:null}function gm(n){let e=(t=>t.altKey&&t.button==0);return P.mouseSelectionStyle.of((t,i)=>e(i)?mm(t,i):null)}const Om={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},ym={style:"cursor: crosshair"};function bm(n={}){let[e,t]=Om[n.key||"Alt"],i=J.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,P.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?ym:null})]}const An="-10000px";class Vc{constructor(e,t,i,s){this.facet=t,this.createTooltipView=i,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function Sm(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Gs=A.define({combine:n=>{var e,t,i;return{position:Q.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Sm}}}),na=new WeakMap,Do=J.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(Gs);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Vc(n,Eo,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(Gs);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=An,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(Q.safari){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(n=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),s=Qo(this.view);return{visible:{left:i.left+s.left,top:i.top+s.top,right:i.right-s.right,bottom:i.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(Gs).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:i,scaleX:s,scaleY:r}=n,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1)){c.style.top=An;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=u.right-u.left,g=(e=na.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||km,S=this.view.textDirection==Z.LTR,x=u.width>i.right-i.left?S?i.left:i.right-u.width:S?Math.max(i.left,Math.min(f.left-(d?14:0)+y.x,i.right-m)):Math.min(Math.max(i.left,f.left-m+(d?14:0)-y.x),i.right-m),w=this.above[l];!a.strictSide&&(w?f.top-g-p-y.yi.bottom)&&w==i.bottom-f.bottom>f.top-i.top&&(w=this.above[l]=!w);let k=(w?f.top-i.top:i.bottom-f.bottom)-p;if(kx&&E.topv&&(v=w?E.top-g-2-p:E.bottom+p+2);if(this.position=="absolute"?(c.style.top=(v-n.parent.top)/r+"px",sa(c,(x-n.parent.left)/s)):(c.style.top=v/r+"px",sa(c,x/s)),d){let E=f.left+(S?y.x:-y.x)-(x+14-7);d.style.left=E/s+"px"}h.overlap!==!0&&o.push({left:x,top:v,right:T,bottom:v+g}),c.classList.toggle("cm-tooltip-above",w),c.classList.toggle("cm-tooltip-below",!w),h.positioned&&h.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=An}},{eventObservers:{scroll(){this.maybeMeasure()}}});function sa(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const xm=P.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),km={x:0,y:0},Eo=A.define({enables:[Do,xm]}),hs=A.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Ps{static create(e){return new Ps(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Vc(e,hs,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const wm=Eo.compute([hs],n=>{let e=n.facet(hs);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Ps.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class vm{constructor(e,t,i,s,r){this.view=e,this.source=t,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||t.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(s)).find(c=>c.from<=s&&c.to>=s),h=a&&a.dir==Z.RTL?-1:1;r=t.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Pe(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Do),t=e?e.manager.tooltips.findIndex(i=>i.create==Ps.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!Tm(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!Cm(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Mn=4;function Tm(n,e){let{left:t,right:i,top:s,bottom:r}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),r=Math.max(l.bottom,r)}return e.clientX>=t-Mn&&e.clientX<=i+Mn&&e.clientY>=s-Mn&&e.clientY<=r+Mn}function Cm(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rights||Math.min(o.bottom,l)=e&&a<=t}function Pm(n,e={}){let t=q.define(),i=he.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let l of s){let a=r.changes.mapPos(l.pos,-1,de.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Qm)&&(s=[]);return s},provide:s=>hs.from(s)});return{active:i,extension:[i,J.define(s=>new vm(s,n,i,t,e.hoverTime||300)),wm]}}function Nc(n,e){let t=n.plugin(Do);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Qm=q.define(),ra=A.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Ni(n,e){let t=n.plugin(Xc),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const Xc=J.fromClass(class{constructor(n){this.input=n.state.facet(Xi),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(ra);this.top=new Rn(n,!0,e.topContainer),this.bottom=new Rn(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(ra);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Rn(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Rn(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Xi);if(t!=this.input){let i=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>P.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Rn{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=oa(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=oa(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function oa(n){let e=n.nextSibling;return n.remove(),e}const Xi=A.define({enables:Xc});class yt extends Nt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}yt.prototype.elementClass="";yt.prototype.toDOM=void 0;yt.prototype.mapMode=de.TrackBefore;yt.prototype.startSide=yt.prototype.endSide=-1;yt.prototype.point=!0;const Zn=A.define(),Am=A.define(),Mm={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>N.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},qi=A.define();function Rm(n){return[Fc(),qi.of({...Mm,...n})]}const la=A.define({combine:n=>n.some(e=>e)});function Fc(n){return[Dm]}const Dm=J.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(qi).map(e=>new ha(n,e)),this.fixed=!n.state.facet(la);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(la)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=N.iter(this.view.state.facet(Zn),this.view.viewport.from),i=[],s=this.gutters.map(r=>new Em(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==ke.Text&&o){no(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==ke.Text){no(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(qi),t=n.state.facet(qi),i=n.docChanged||n.heightChanged||n.viewportChanged||!N.eq(n.startState.facet(Zn),n.state.facet(Zn),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new ha(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>P.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Z.LTR?{left:i,right:s}:{right:i,left:s}})});function aa(n){return Array.isArray(n)?n:[n]}function no(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class Em{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=N.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new _c(e,o,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];no(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),s=i?[i]:null;for(let r of e.state.facet(Am)){let o=r(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class ha{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,s)&&s.preventDefault()});this.markers=aa(t.markers(e)),t.initialSpacer&&(this.spacer=new _c(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=aa(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!N.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class _c{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),qm(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,h)||o(l,a,h):o}return i}})}});class Zs extends yt{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ys(n,e){return n.state.facet(Jt).formatNumber(e,n.state)}const Wm=qi.compute([Jt],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet($m)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new Zs(Ys(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let s of e.state.facet(Bm)){let r=s(e,t,i);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(Jt)!=e.state.facet(Jt),initialSpacer(e){return new Zs(Ys(e,ca(e.state.doc.lines)))},updateSpacer(e,t){let i=Ys(t.view,ca(t.view.state.doc.lines));return i==e.number?e:new Zs(i)},domEventHandlers:n.facet(Jt).domEventHandlers,side:"before"}));function Lm(n={}){return[Jt.of(n),Fc(),Wm]}function ca(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(zm.range(s)))}return N.of(e)});function Vm(){return Im}const Uc=1024;let Nm=0;class Ks{constructor(e,t){this.from=e,this.to=t}}class L{constructor(e={}){this.id=Nm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ve.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}L.closedBy=new L({deserialize:n=>n.split(" ")});L.openedBy=new L({deserialize:n=>n.split(" ")});L.group=new L({deserialize:n=>n.split(" ")});L.isolate=new L({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});L.contextHash=new L({perNode:!0});L.lookAhead=new L({perNode:!0});L.mounted=new L({perNode:!0});class cs{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[L.mounted.id]}}const Xm=Object.create(null);class ve{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Xm,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new ve(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(L.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(L.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}ve.none=new ve("",Object.create(null),0,8);class Qs{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|re.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Bo(ve.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new j(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new j(ve.none,t,i,s)))}static build(e){return Hm(e)}}j.empty=new j(ve.none,[],[],0);class qo{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new qo(this.buffer,this.index)}}class Qt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return ve.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Fi(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from;if(Hc(s,i,f,f+c.length)){if(c instanceof Qt){if(r&re.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,s);if(u>-1)return new Je(new Fm(o,c,e,f),null,u)}else if(r&re.IncludeAnonymous||!c.type.isAnonymous||$o(c)){let u;if(!(r&re.IgnoreMounts)&&(u=cs.get(c))&&!u.overlay)return new Ae(u.tree,f,e,o);let d=new Ae(c,f,e,o);return r&re.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,s)}}}if(r&re.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let s;if(!(i&re.IgnoreOverlays)&&(s=cs.get(this._tree))&&s.overlay){let r=e-this.from;for(let{from:o,to:l}of s.overlay)if((t>0?o<=r:o=r:l>r))return new Ae(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ua(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function so(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Fm{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class Je extends jc{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new Je(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&re.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Je(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Je(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Je(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o)),t.push(0)}return new j(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Gc(n){if(!n.length)return null;let e=0,t=n[0];for(let r=1;rt.from||o.to=e){let l=new Ae(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[i])).push(Fi(l,e,t,!1))}}return s?Gc(s):i}class ro{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ae)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof Ae?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&re.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&re.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&re.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&re.IncludeAnonymous||l instanceof Qt||!l.type.isAnonymous||$o(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}for(let s=i;s=0;r--){if(r<0)return so(this._tree,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function $o(n){return n.children.some(e=>e instanceof Qt||!e.type.isAnonymous||$o(e))}function Hm(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Uc,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new qo(t,t.length):t,a=i.types,h=0,c=0;function f(k,v,T,E,M,z){let{id:$,start:D,end:B,size:W}=l,X=c,ne=h;if(W<0)if(l.next(),W==-1){let ce=r[$];T.push(ce),E.push(D-k);return}else if(W==-3){h=$;return}else if(W==-4){c=$;return}else throw new RangeError(`Unrecognized record size: ${W}`);let oe=a[$],me,F,ee=D-k;if(B-D<=s&&(F=g(l.pos-v,M))){let ce=new Uint16Array(F.size-F.skip),ge=l.pos-F.size,_e=ce.length;for(;l.pos>ge;)_e=y(F.start,ce,_e);me=new Qt(ce,B-F.start,i),ee=F.start-k}else{let ce=l.pos-W;l.next();let ge=[],_e=[],Dt=$>=o?$:-1,Gt=0,gn=B;for(;l.pos>ce;)Dt>=0&&l.id==Dt&&l.size>=0?(l.end<=gn-s&&(p(ge,_e,D,Gt,l.end,gn,Dt,X,ne),Gt=ge.length,gn=l.end),l.next()):z>2500?u(D,ce,ge,_e):f(D,ce,ge,_e,Dt,z+1);if(Dt>=0&&Gt>0&&Gt-1&&Gt>0){let ll=d(oe,ne);me=Bo(oe,ge,_e,0,ge.length,0,B-D,ll,ll)}else me=m(oe,ge,_e,B-D,X-B,ne)}T.push(me),E.push(ee)}function u(k,v,T,E){let M=[],z=0,$=-1;for(;l.pos>v;){let{id:D,start:B,end:W,size:X}=l;if(X>4)l.next();else{if($>-1&&B<$)break;$<0&&($=W-s),M.push(D,B,W),z++,l.next()}}if(z){let D=new Uint16Array(z*4),B=M[M.length-2];for(let W=M.length-3,X=0;W>=0;W-=3)D[X++]=M[W],D[X++]=M[W+1]-B,D[X++]=M[W+2]-B,D[X++]=X;T.push(new Qt(D,M[2]-B,i)),E.push(B-k)}}function d(k,v){return(T,E,M)=>{let z=0,$=T.length-1,D,B;if($>=0&&(D=T[$])instanceof j){if(!$&&D.type==k&&D.length==M)return D;(B=D.prop(L.lookAhead))&&(z=E[$]+D.length+B)}return m(k,T,E,M,z,v)}}function p(k,v,T,E,M,z,$,D,B){let W=[],X=[];for(;k.length>E;)W.push(k.pop()),X.push(v.pop()+T-M);k.push(m(i.types[$],W,X,z-M,D-z,B)),v.push(M-T)}function m(k,v,T,E,M,z,$){if(z){let D=[L.contextHash,z];$=$?[D].concat($):[D]}if(M>25){let D=[L.lookAhead,M];$=$?[D].concat($):[D]}return new j(k,v,T,E,$)}function g(k,v){let T=l.fork(),E=0,M=0,z=0,$=T.end-s,D={size:0,start:0,skip:0};e:for(let B=T.pos-k;T.pos>B;){let W=T.size;if(T.id==v&&W>=0){D.size=E,D.start=M,D.skip=z,z+=4,E+=4,T.next();continue}let X=T.pos-W;if(W<0||X=o?4:0,oe=T.start;for(T.next();T.pos>X;){if(T.size<0)if(T.size==-3)ne+=4;else break e;else T.id>=o&&(ne+=4);T.next()}M=oe,E+=W,z+=ne}return(v<0||E==k)&&(D.size=E,D.start=M,D.skip=z),D.size>4?D:void 0}function y(k,v,T){let{id:E,start:M,end:z,size:$}=l;if(l.next(),$>=0&&E4){let B=l.pos-($-4);for(;l.pos>B;)T=y(k,v,T)}v[--T]=D,v[--T]=z-k,v[--T]=M-k,v[--T]=E}else $==-3?h=E:$==-4&&(c=E);return T}let S=[],x=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,S,x,-1,0);let w=(e=n.length)!==null&&e!==void 0?e:S.length?x[0]+S[0].length:0;return new j(a[n.topID],S.reverse(),x.reverse(),w)}const da=new WeakMap;function Yn(n,e){if(!n.isAnonymous||e instanceof Qt||e.type!=n)return 1;let t=da.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof j)){t=1;break}t+=Yn(n,i)}da.set(e,t)}return t}function Bo(n,e,t,i,s,r,o,l,a){let h=0;for(let p=i;p=c)break;v+=T}if(x==w+1){if(v>c){let T=p[w];d(T.children,T.positions,0,T.children.length,m[w]+S);continue}f.push(p[w])}else{let T=m[x-1]+p[x-1].length-k;f.push(Bo(n,p,m,w,x,k,T,null,a))}u.push(k+S-r)}}return d(e,t,i,s,0),(l||a)(f,u,o)}class jm{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Je?this.setBuffer(e.context.buffer,e.index,t):e instanceof Ae&&this.map.set(e.tree,t)}get(e){return e instanceof Je?this.getBuffer(e.context.buffer,e.index):e instanceof Ae?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class It{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new It(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new It(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew Ks(s.from,s.to)):[new Ks(0,0)]:[new Ks(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class Gm{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new L({perNode:!0});let Zm=0;class qe{constructor(e,t,i,s){this.name=e,this.set=t,this.base=i,this.modified=s,this.id=Zm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof qe&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let s=new qe(i,[],null,[]);if(s.set.push(s),t)for(let r of t.set)s.set.push(r);return s}static defineModifier(e){let t=new fs(e);return i=>i.modified.indexOf(t)>-1?i:fs.get(i.base||i,i.modified.concat(t).sort((s,r)=>s.id-r.id))}}let Ym=0;class fs{constructor(e){this.name=e,this.instances=[],this.id=Ym++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&Km(t,l.modified));if(i)return i;let s=[],r=new qe(e.name,s,e,t);for(let l of t)l.instances.push(r);let o=Jm(t);for(let l of e.set)if(!l.modified.length)for(let a of o)s.push(fs.get(l,a));return r}}function Km(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function Jm(n){let e=[[]];for(let t=0;ti.length-t.length)}function Lo(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+s);let c=new _i(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return Zc.add(e)}const Zc=new L({combine(n,e){let t,i,s;for(;n||e;){if(!n||e&&n.depth>=e.depth?(s=e,e=e.next):(s=n,n=n.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let r=new _i(s.tags,s.mode,s.context);t?t.next=r:i=r,t=r}return i}});class _i{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function eg(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function tg(n,e,t,i=0,s=n.length){let r=new ig(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class ig{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=s,c=ng(e)||_i.empty,f=eg(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,l),h),c.opaque)return;let u=e.tree&&e.tree.prop(L.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),m=e.firstChild();for(let g=0,y=l;;g++){let S=g=x||!e.nextSibling())););if(!S||x>i)break;y=S.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,S.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),h))}m&&e.parent()}else if(e.firstChild()){u&&(s="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function ng(n){let e=n.type.prop(Zc);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const C=qe.define,En=C(),bt=C(),pa=C(bt),ma=C(bt),St=C(),qn=C(St),Js=C(St),Ge=C(),Et=C(Ge),He=C(),je=C(),oo=C(),ki=C(oo),$n=C(),O={comment:En,lineComment:C(En),blockComment:C(En),docComment:C(En),name:bt,variableName:C(bt),typeName:pa,tagName:C(pa),propertyName:ma,attributeName:C(ma),className:C(bt),labelName:C(bt),namespace:C(bt),macroName:C(bt),literal:St,string:qn,docString:C(qn),character:C(qn),attributeValue:C(qn),number:Js,integer:C(Js),float:C(Js),bool:C(St),regexp:C(St),escape:C(St),color:C(St),url:C(St),keyword:He,self:C(He),null:C(He),atom:C(He),unit:C(He),modifier:C(He),operatorKeyword:C(He),controlKeyword:C(He),definitionKeyword:C(He),moduleKeyword:C(He),operator:je,derefOperator:C(je),arithmeticOperator:C(je),logicOperator:C(je),bitwiseOperator:C(je),compareOperator:C(je),updateOperator:C(je),definitionOperator:C(je),typeOperator:C(je),controlOperator:C(je),punctuation:oo,separator:C(oo),bracket:ki,angleBracket:C(ki),squareBracket:C(ki),paren:C(ki),brace:C(ki),content:Ge,heading:Et,heading1:C(Et),heading2:C(Et),heading3:C(Et),heading4:C(Et),heading5:C(Et),heading6:C(Et),contentSeparator:C(Ge),list:C(Ge),quote:C(Ge),emphasis:C(Ge),strong:C(Ge),link:C(Ge),monospace:C(Ge),strikethrough:C(Ge),inserted:C(),deleted:C(),changed:C(),invalid:C(),meta:$n,documentMeta:C($n),annotation:C($n),processingInstruction:C($n),definition:qe.defineModifier("definition"),constant:qe.defineModifier("constant"),function:qe.defineModifier("function"),standard:qe.defineModifier("standard"),local:qe.defineModifier("local"),special:qe.defineModifier("special")};for(let n in O){let e=O[n];e instanceof qe&&(e.name=n)}Yc([{tag:O.link,class:"tok-link"},{tag:O.heading,class:"tok-heading"},{tag:O.emphasis,class:"tok-emphasis"},{tag:O.strong,class:"tok-strong"},{tag:O.keyword,class:"tok-keyword"},{tag:O.atom,class:"tok-atom"},{tag:O.bool,class:"tok-bool"},{tag:O.url,class:"tok-url"},{tag:O.labelName,class:"tok-labelName"},{tag:O.inserted,class:"tok-inserted"},{tag:O.deleted,class:"tok-deleted"},{tag:O.literal,class:"tok-literal"},{tag:O.string,class:"tok-string"},{tag:O.number,class:"tok-number"},{tag:[O.regexp,O.escape,O.special(O.string)],class:"tok-string2"},{tag:O.variableName,class:"tok-variableName"},{tag:O.local(O.variableName),class:"tok-variableName tok-local"},{tag:O.definition(O.variableName),class:"tok-variableName tok-definition"},{tag:O.special(O.variableName),class:"tok-variableName2"},{tag:O.definition(O.propertyName),class:"tok-propertyName tok-definition"},{tag:O.typeName,class:"tok-typeName"},{tag:O.namespace,class:"tok-namespace"},{tag:O.className,class:"tok-className"},{tag:O.macroName,class:"tok-macroName"},{tag:O.propertyName,class:"tok-propertyName"},{tag:O.operator,class:"tok-operator"},{tag:O.comment,class:"tok-comment"},{tag:O.meta,class:"tok-meta"},{tag:O.invalid,class:"tok-invalid"},{tag:O.punctuation,class:"tok-punctuation"}]);var er;const Lt=new L;function Kc(n){return A.define({combine:n?e=>e.concat(n):void 0})}const sg=new L;class $e{constructor(e,t,i=[],s=""){this.data=e,this.name=s,I.prototype.hasOwnProperty("tree")||Object.defineProperty(I.prototype,"tree",{get(){return ae(this)}}),this.parser=t,this.extension=[At.of(this),I.languageData.of((r,o,l)=>{let a=ga(r,o,l),h=a.type.prop(Lt);if(!h)return[];let c=r.facet(h),f=a.type.prop(sg);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return ga(e,t,i).type.prop(Lt)==this.data}findRegions(e){let t=e.facet(At);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(Lt)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(L.mounted);if(l){if(l.tree.prop(Lt)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new Ui(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ae(n){let e=n.field($e.state,!1);return e?e.tree:j.empty}class rg{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let wi=null;class ui{constructor(e,t,i=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new ui(e,t,[],j.empty,0,i,[],null)}startParse(){return this.parser.startParse(new rg(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=j.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(It.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=wi;wi=this;try{return e()}finally{wi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Oa(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=It.applyChanges(i,a),s=j.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=Oa(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Wo{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=wi;if(a){for(let h of s)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new j(ve.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return wi}}function Oa(n,e,t){return It.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class di{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new di(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=ui.create(e.facet(At).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new di(i)}}$e.state=he.define({create:di.init,update(n,e){for(let t of e.effects)if(t.is($e.setState))return t.value;return e.startState.facet(At)!=e.state.facet(At)?di.init(e.state):n.apply(e)}});let Jc=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Jc=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const tr=typeof navigator<"u"&&(!((er=navigator.scheduling)===null||er===void 0)&&er.isInputPending)?()=>navigator.scheduling.isInputPending():null,og=J.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field($e.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field($e.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Jc(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>tr&&tr()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:$e.setState.of(new di(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Pe(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),At=A.define({combine(n){return n.length?n[0]:null},enables:n=>[$e.state,og,P.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class ef{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const lg=A.define(),cn=A.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Ut(n){let e=n.facet(cn);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Hi(n,e){let t="",i=n.tabSize,s=n.facet(cn)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=e?ag(n,t,e):null}class As{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ut(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return gi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ms=new L;function ag(n,e,t){let i=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o&&!(o.fromi.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return tf(i,n,t)}function tf(n,e,t){for(let i=n;i;i=i.next){let s=cg(i.node);if(s)return s(Io.create(e,t,i))}return 0}function hg(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function cg(n){let e=n.type.prop(Ms);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(L.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>nf(o,!0,1,void 0,r&&!hg(o)?s.from:void 0)}return n.parent==null?fg:null}function fg(){return 0}class Io extends As{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Io(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(ug(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return tf(this.context.next,this.base,this.pos)}}function ug(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function dg(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function ir({closing:n,align:e=!0,units:t=1}){return i=>nf(i,e,t,n)}function nf(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,a=e?dg(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}function ya({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const pg=200;function mg(){return I.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+pg)return n;let r=t.sliceString(s.from,i);if(!e.some(h=>h.test(r)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=zo(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],d=Hi(o,f);u!=d&&a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const gg=A.define(),Vo=new L;function sf(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(r&&l.from=e&&h.to>t&&(r=h)}}return r}function yg(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function us(n,e,t){for(let i of n.facet(gg)){let s=i(n,e,t);if(s)return s}return Og(n,e,t)}function rf(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Rs=q.define({map:rf}),fn=q.define({map:rf});function of(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const Ht=he.define({create(){return R.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,i)=>n=ba(n,t,i)),n=n.map(e.changes);for(let t of e.effects)if(t.is(Rs)&&!bg(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(hf),s=i?R.replace({widget:new Cg(i(e.state,t.value))}):Sa;n=n.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(fn)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=ba(n,e.selection.main.head)),n},provide:n=>P.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{se&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(s,r)=>s>=t||r<=e}):n}function ds(n,e,t){var i;let s=null;return(i=n.field(Ht,!1))===null||i===void 0||i.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function bg(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function lf(n,e){return n.field(Ht,!1)?e:e.concat(q.appendConfig.of(cf()))}const Sg=n=>{for(let e of of(n)){let t=us(n.state,e.from,e.to);if(t)return n.dispatch({effects:lf(n.state,[Rs.of(t),af(n,t)])}),!0}return!1},xg=n=>{if(!n.state.field(Ht,!1))return!1;let e=[];for(let t of of(n)){let i=ds(n.state,t.from,t.to);i&&e.push(fn.of(i),af(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function af(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return P.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const kg=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(Ht,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(fn.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},vg=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Sg},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:xg},{key:"Ctrl-Alt-[",run:kg},{key:"Ctrl-Alt-]",run:wg}],Tg={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},hf=A.define({combine(n){return rt(n,Tg)}});function cf(n){return[Ht,Ag]}function ff(n,e){let{state:t}=n,i=t.facet(hf),s=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=ds(n.state,l.from,l.to);a&&n.dispatch({effects:fn.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,s,e);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const Sa=R.replace({widget:new class extends ot{toDOM(n){return ff(n,null)}}});class Cg extends ot{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return ff(e,this.value)}}const Pg={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class nr extends yt{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Qg(n={}){let e={...Pg,...n},t=new nr(e,!0),i=new nr(e,!1),s=J.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(At)!=o.state.facet(At)||o.startState.field(Ht,!1)!=o.state.field(Ht,!1)||ae(o.startState)!=ae(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new gt;for(let a of o.viewportLineBlocks){let h=ds(o.state,a.from,a.to)?i:us(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:r}=e;return[s,Rm({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||N.empty},initialSpacer(){return new nr(e,!1)},domEventHandlers:{...r,click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let h=ds(o.state,l.from,l.to);if(h)return o.dispatch({effects:fn.of(h)}),!0;let c=us(o.state,l.from,l.to);return c?(o.dispatch({effects:Rs.of(c)}),!0):!1}}}),cf()]}const Ag=P.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class un{constructor(e,t){this.specs=e;let i;function s(l){let a=Tt.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof $e?l=>l.prop(Lt)==o.data:o?l=>l==o:void 0,this.style=Yc(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new Tt(i):null,this.themeType=t.themeType}static define(e,t){return new un(e,t||{})}}const lo=A.define(),uf=A.define({combine(n){return n.length?[n[0]]:null}});function sr(n){let e=n.facet(lo);return e.length?e:n.facet(uf)}function df(n,e){let t=[Rg],i;return n instanceof un&&(n.module&&t.push(P.styleModule.of(n.module)),i=n.themeType),e?.fallback?t.push(uf.of(n)):i?t.push(lo.computeN([P.darkTheme],s=>s.facet(P.darkTheme)==(i=="dark")?[n]:[])):t.push(lo.of(n)),t}class Mg{constructor(e){this.markCache=Object.create(null),this.tree=ae(e.state),this.decorations=this.buildDeco(e,sr(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=ae(e.state),i=sr(e.state),s=i!=sr(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return R.none;let i=new gt;for(let{from:s,to:r}of e.visibleRanges)tg(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=R.mark({class:a})))},s,r);return i.finish()}}const Rg=Mt.high(J.fromClass(Mg,{decorations:n=>n.decorations})),Dg=un.define([{tag:O.meta,color:"#404740"},{tag:O.link,textDecoration:"underline"},{tag:O.heading,textDecoration:"underline",fontWeight:"bold"},{tag:O.emphasis,fontStyle:"italic"},{tag:O.strong,fontWeight:"bold"},{tag:O.strikethrough,textDecoration:"line-through"},{tag:O.keyword,color:"#708"},{tag:[O.atom,O.bool,O.url,O.contentSeparator,O.labelName],color:"#219"},{tag:[O.literal,O.inserted],color:"#164"},{tag:[O.string,O.deleted],color:"#a11"},{tag:[O.regexp,O.escape,O.special(O.string)],color:"#e40"},{tag:O.definition(O.variableName),color:"#00f"},{tag:O.local(O.variableName),color:"#30a"},{tag:[O.typeName,O.namespace],color:"#085"},{tag:O.className,color:"#167"},{tag:[O.special(O.variableName),O.macroName],color:"#256"},{tag:O.definition(O.propertyName),color:"#00c"},{tag:O.comment,color:"#940"},{tag:O.invalid,color:"#f00"}]),Eg=P.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),pf=1e4,mf="()[]{}",gf=A.define({combine(n){return rt(n,{afterCursor:!0,brackets:mf,maxScanDistance:pf,renderMatch:Bg})}}),qg=R.mark({class:"cm-matchingBracket"}),$g=R.mark({class:"cm-nonmatchingBracket"});function Bg(n){let e=[],t=n.matched?qg:$g;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const Wg=he.define({create(){return R.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(gf);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=et(e.state,s.head,-1,i)||s.head>0&&et(e.state,s.head-1,1,i)||i.afterCursor&&(et(e.state,s.head,1,i)||s.headP.decorations.from(n)}),Lg=[Wg,Eg];function zg(n={}){return[gf.of(n),Lg]}const Ig=new L;function ao(n,e,t){let i=n.prop(e<0?L.openedBy:L.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function ho(n){let e=n.type.prop(Ig);return e?e(n.node):n}function et(n,e,t,i={}){let s=i.maxScanDistance||pf,r=i.brackets||mf,o=ae(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=ao(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return Vg(n,e,t,a,c,h,r)}}return Ng(n,e,t,o,l.type,s,r)}function Vg(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to},h=0,c=l?.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let m=t>0?0:d.length-1,g=t>0?d.length:-1;m!=g;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}function xa(n,e,t,i=0,s=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=s;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosi?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Xg(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||Fg,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||Xo,mergeTokens:n.mergeTokens!==!1}}function Fg(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}const ka=new WeakMap;class yf extends $e{constructor(e){let t=Kc(e.languageData),i=Xg(e),s,r=new class extends Wo{createParse(o,l,a){return new Ug(s,o,l,a)}};super(t,r,[],e.name),this.topNode=Gg(t,this),s=this,this.streamParser=i,this.stateAfter=new L({perNode:!0}),this.tokenTable=e.tokenTable?new kf(i.tokenTable):jg}static define(e){return new yf(e)}getIndent(e){let t,{overrideIndentation:i}=e.options;i&&(t=ka.get(e.state),t!=null&&t1e4)return null;for(;r=i&&t+e.length<=s&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],h=l instanceof j&&a=e.length)return e;!s&&t==0&&e.type==n.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],a;if(ot&&No(n,r.tree,0-r.offset,t,l),h;if(a&&a.pos<=i&&(h=bf(n,r.tree,t+r.offset,a.pos+r.offset,!1)))return{state:a.state,tree:h}}return{state:n.streamParser.startState(s?Ut(s):4),tree:j.empty}}let Ug=class{constructor(e,t,i,s){this.lang=e,this.input=t,this.fragments=i,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=ui.get(),o=s[0].from,{state:l,tree:a}=_g(e,i,o,this.to,r?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;hh.from<=r.viewport.from&&h.to>=r.viewport.from)&&(this.state=this.lang.streamParser.startState(Ut(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let e=ui.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(t,this.chunkStart+512);for(e&&(i=Math.min(i,e.viewport.to));this.parsedPos=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` +`){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ze))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new K(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ze)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof K&&a&&(p=c[c.length-1])instanceof K&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new K(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Ze.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ze(l,t)}}V.empty=new K([""],0);function Fu(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Xn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof K?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof K?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof K){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof K?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class wh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ai(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class vh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},Ai.prototype[Symbol.iterator]=wh.prototype[Symbol.iterator]=vh.prototype[Symbol.iterator]=function(){return this});class _u{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function li(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function pe(n,e,t=!0,i=!0){return Nu(n,e,t,i)}function Uu(n){return n>=56320&&n<57344}function Hu(n){return n>=55296&&n<56320}function Te(n,e){let t=n.charCodeAt(e);if(!Hu(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Uu(i)?(t-55296<<10)+(i-56320)+65536:t}function So(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Ye(n){return n<65536?1:2}const wr=/\r\n?|\n/;var de=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(de||(de={}));class it{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=de.Simple&&h>=e&&(i==de.TrackDel&&se||i==de.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new it(e)}static create(e){return new it(e)}}class se extends it{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return vr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return Tr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&&kt(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?V.of(d.split(i||wr)):d:V.empty,m=p.length;if(f==u&&m==0)return;fo&&Oe(s,f-o,-1),Oe(s,u-f,m),kt(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new se(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function kt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function Tr(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Bi(n),l=new Bi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);Oe(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Bi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?V.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?V.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Wt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Wt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new Wt(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>Wt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function Ch(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let xo=0;class A{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=xo++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new A(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:ko),!!e.static,e.enables)}of(e){return new Fn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function ko(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Fn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=xo++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Cr(f,c)){let d=i(f);if(l?!dl(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=ns(u,p);if(this.dependencies.every(g=>g instanceof A?u.facet(g)===f.facet(g):g instanceof he?u.field(g,!1)==f.field(g,!1):!0)||(l?dl(d=i(f),m,s):s(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function dl(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(On).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(On),o=s.facet(On),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,On.of({field:this,create:e})]}get extension(){return this}}const $t={lowest:4,low:3,default:2,high:1,highest:0};function Si(n){return e=>new Ph(e,n)}const Mt={highest:Si($t.highest),high:Si($t.high),default:Si($t.default),low:Si($t.low),lowest:Si($t.lowest)};class Ph{constructor(e,t){this.inner=e,this.prec=t}}class vs{of(e){return new Pr(this,e)}reconfigure(e){return vs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Pr{constructor(e,t){this.compartment=e,this.inner=t}}class is{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Gu(e,t,o))u instanceof he?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,ko(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(y=>g.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(g=>ju(g,p,d))}}let f=h.map(u=>u(l));return new is(e,o,f,l,a,r)}}function Gu(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Pr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Pr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Ph)r(o.inner,o.prec);else if(o instanceof he)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Fn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,$t.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,$t.default),i.reduce((o,l)=>o.concat(l))}function Mi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function ns(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Qh=A.define(),Qr=A.define({combine:n=>n.some(e=>e),static:!0}),Ah=A.define({combine:n=>n.length?n[0]:void 0,static:!0}),Mh=A.define(),Rh=A.define(),Dh=A.define(),Eh=A.define({combine:n=>n.length?n[0]:!1});class st{constructor(e,t){this.type=e,this.value=t}static define(){return new Zu}}class Zu{of(e){return new st(this,e)}}class Yu{constructor(e){this.map=e}of(e){return new q(this,e)}}class q{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new q(this.type,t)}is(e){return this.type==e}static define(e={}){return new Yu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}q.reconfigure=q.define();q.appendConfig=q.define();class ie{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Ch(i,t.newLength),r.some(l=>l.type==ie.time)||(this.annotations=r.concat(ie.time.of(Date.now())))}static create(e,t,i,s,r,o){return new ie(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ie.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ie.time=st.define();ie.userEvent=st.define();ie.addToHistory=st.define();ie.remote=st.define();function Ku(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof ie?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof ie?n=r[0]:n=$h(e,ti(r),!1)}return n}function ed(n){let e=n.startState,t=e.facet(Dh),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=qh(i,Ar(e,r,n.changes.newLength),!0))}return i==n?n:ie.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const td=[];function ti(n){return n==null?td:Array.isArray(n)?n:[n]}var Y=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Y||(Y={}));const id=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Mr;try{Mr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function nd(n){if(Mr)return Mr.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||id.test(t)))return!0}return!1}function sd(n){return e=>{if(!/\S/.test(e))return Y.Space;if(nd(e))return Y.Word;for(let t=0;t-1)return Y.Word;return Y.Other}}class I{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(q.reconfigure)?(t=null,i=l.value):l.is(q.appendConfig)&&(t=null,i=ti(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=is.resolve(i,s,this),r=new I(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Qr)?e.newSelection:e.newSelection.asSingle();new I(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=ti(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return I.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=is.resolve(e.extensions||[],new Map),i=e.doc instanceof V?e.doc:V.of((e.doc||"").split(t.staticFacet(I.lineSeparator)||wr)),s=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return Ch(s,i.length),t.staticFacet(Qr)||(s=s.asSingle()),new I(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(I.tabSize)}get lineBreak(){return this.facet(I.lineSeparator)||` +`}get readOnly(){return this.facet(Eh)}phrase(e,...t){for(let i of this.facet(I.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(Qh))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return sd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=pe(t,o,!1);if(r(t.slice(a,o))!=Y.Word)break;o=a}for(;ln.length?n[0]:4});I.lineSeparator=Ah;I.readOnly=Eh;I.phrases=A.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});I.languageData=Qh;I.changeFilter=Mh;I.transactionFilter=Rh;I.transactionExtender=Dh;vs.reconfigure=q.define();function rt(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class Nt{eq(e){return this==e}range(e,t=e){return Rr.create(e,t,this)}}Nt.prototype.startSide=Nt.prototype.endSide=0;Nt.prototype.point=!1;Nt.prototype.mapMode=de.TrackDel;let Rr=class Bh{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Bh(e,t,i)}};function Dr(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class wo{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),s.push(u-o),r.push(d-o))}return{mapped:i.length?new wo(s,r,i,l):null,pos:o}}}class N{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new N(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Dr)),this.isEmpty)return t.length?N.of(t):this;let l=new Wh(this,null,-1).goto(0),a=0,h=[],c=new gt;for(;l.value||a=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Wi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Wi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=pl(o,l,i),h=new xi(o,a,r),c=new xi(l,a,r);i.iterGaps((f,u,d)=>ml(h,f,c,u,d,s)),i.empty&&i.length==0&&ml(h,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=999999999);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=pl(r,o),a=new xi(r,l,0).goto(i),h=new xi(o,l,0).goto(i);for(;;){if(a.to!=h.to||!Er(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>s)return!0;a.next(),h.next()}}static spans(e,t,i,s,r=-1){let o=new xi(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(s.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new gt;for(let s of e instanceof Rr?[e]:t?rd(e):e)i.add(s.from,s.to,s.value);return i.finish()}static join(e){if(!e.length)return N.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let s=e[i];s!=N.empty;s=s.nextLayer)t=new N(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}N.empty=new N([],[],null,-1);function rd(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(Dr);e=i}return n}N.empty.nextLayer=N.empty;class gt{finishChunk(e){this.chunks.push(new wo(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new gt)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(N.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=N.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function pl(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new Wh(o,t,i,r));return s.length==1?s[0]:new Wi(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Is(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Is(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Is(this.heap,0)}}}function Is(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class xi{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Wi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){yn(this.active,e),yn(this.activeTo,e),yn(this.activeRank,e),this.minActive=gl(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t0;)t++;bn(this.active,t,i),bn(this.activeTo,t,s),bn(this.activeRank,t,r),e&&bn(e,t,this.cursor.from),this.minActive=gl(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&yn(i,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[s]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function ml(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,a=i-e;for(;;){let h=n.to+a-t.to,c=h||n.endSide-t.endSide,f=c<0?n.to+a:t.to,u=Math.min(f,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&Er(n.activeForPoint(n.to),t.activeForPoint(t.to))||r.comparePoint(l,u,n.point,t.point):u>l&&!Er(n.active,t.active)&&r.compareRange(l,u,n.active,t.active),f>o)break;(h||n.openEnd!=t.openEnd)&&r.boundChange&&r.boundChange(f),l=f,c<=0&&n.next(),c>=0&&t.next()}}function Er(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function gl(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=pe(n,s)}return i===!0?-1:n.length}const $r="ͼ",Ol=typeof Symbol>"u"?"__"+$r:Symbol.for($r),Br=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),yl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Tt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=yl[Ol]||1;return yl[Ol]=e+1,$r+e.toString(36)}static mount(e,t,i){let s=e[Br],r=i&&i.nonce;s?r&&s.setNonce(r):s=new od(e,r),s.mount(Array.isArray(t)?t:[t],e)}}let bl=new Map;class od{constructor(e,t){let i=e.ownerDocument||e,s=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=bl.get(i);if(r)return e[Br]=r;this.sheet=new s.CSSStyleSheet,bl.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Br]=this}mount(e,t){let i=this.sheet,s=0,r=0;for(let o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ld=typeof navigator<"u"&&/Mac/.test(navigator.platform),ad=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ue=0;ue<10;ue++)Ct[48+ue]=Ct[96+ue]=String(ue);for(var ue=1;ue<=24;ue++)Ct[ue+111]="F"+ue;for(var ue=65;ue<=90;ue++)Ct[ue]=String.fromCharCode(ue+32),Li[ue]=String.fromCharCode(ue);for(var Vs in Ct)Li.hasOwnProperty(Vs)||(Li[Vs]=Ct[Vs]);function hd(n){var e=ld&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ad&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Li:Ct)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function U(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;e2);var Q={mac:xl||/Mac/.test(xe.platform),windows:/Win/.test(xe.platform),linux:/Linux|X11/.test(xe.platform),ie:Ts,ie_version:zh?Wr.documentMode||6:zr?+zr[1]:Lr?+Lr[1]:0,gecko:Sl,gecko_version:Sl?+(/Firefox\/(\d+)/.exec(xe.userAgent)||[0,0])[1]:0,chrome:!!Ns,chrome_version:Ns?+Ns[1]:0,ios:xl,android:/Android\b/.test(xe.userAgent),webkit_version:cd?+(/\bAppleWebKit\/(\d+)/.exec(xe.userAgent)||[0,0])[1]:0,safari:Ir,safari_version:Ir?+(/\bVersion\/(\d+(\.\d+)?)/.exec(xe.userAgent)||[0,0])[1]:0,tabSize:Wr.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function zi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Vr(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function _n(n,e){if(!e.anchorNode)return!1;try{return Vr(n,e.anchorNode)}catch{return!1}}function ai(n){return n.nodeType==3?Ft(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Ri(n,e,t,i){return t?kl(n,e,t,i,-1)||kl(n,e,t,i,1):!1}function Xt(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function ss(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function kl(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:nt(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=Xt(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?nt(n):0}else return!1}}function nt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function sn(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function fd(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function Ih(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function ud(n,e,t,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,p=1,m=1;if(d)u=fd(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let S=c.getBoundingClientRect();({scaleX:p,scaleY:m}=Ih(c,S)),u={left:S.left,right:S.left+c.clientWidth*p,top:S.top,bottom:S.top+c.clientHeight*m}}let g=0,y=0;if(s=="nearest")e.top0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+o)):e.bottom>u.bottom&&(y=e.bottom-u.bottom+o,t<0&&e.top-y0&&e.right>u.right+g&&(g=e.right-u.right+r)):e.right>u.right&&(g=e.right-u.right+r,t<0&&e.leftu.bottom||e.leftu.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function dd(n){let e=n.ownerDocument,t,i;for(let s=n.parentNode;s&&!(s==e.body||t&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:t,y:i}}class pd{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?nt(t):0),i,Math.min(e.focusOffset,i?nt(i):0))}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let qt=null;Q.safari&&Q.safari_version>=26&&(qt=!1);function Vh(n){if(n.setActive)return n.setActive();if(qt)return n.focus(qt);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(qt==null?{get preventScroll(){return qt={preventScroll:!0},!0}}:void 0),!qt){qt=!1;for(let t=0;tMath.max(1,n.scrollHeight-n.clientHeight-4)}function Fh(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=nt(t)}else if(t.parentNode&&!ss(t))i=Xt(t),t=t.parentNode;else return null}}function _h(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&it)return f.domBoundsAround(e,t,h);if(u>=e&&s==-1&&(s=a,r=h),h>t&&f.dom.parentNode==this.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=vo){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Hh(n,e,t,i,s,r,o,l,a){let{children:h}=n,c=h.length?h[e]:null,f=r.length?r[r.length-1]:null,u=f?f.breakAfter:o;if(!(e==i&&c&&!o&&!u&&r.length<2&&c.merge(t,s,r.length?f:null,t==0,l,a))){if(i0&&(!o&&r.length&&c.merge(t,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(tOd||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ve(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new ye(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return yd(this.dom,e,t)}}class Ot extends _{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let s of t)s.setParent(this)}setAttrs(e){if(Nh(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,s,r,o){return i&&(!(i instanceof Ot&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(s=r),i=a,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Ot(this.mark,t,o)}domAtPos(e){return Gh(this,e)}coordsAt(e,t){return Yh(this,e,t)}}function yd(n,e,t){let i=n.nodeValue.length;e>i&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?Q.chrome||Q.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return Q.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?sn(a,o<0):a||null}class pt extends _{static create(e,t,i){return new pt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=pt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,s,r,o){return i&&(!(i instanceof pt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0)?ye.before(this.dom):ye.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?s.length-1:0;r=s[l],!(e>0?l==0:l==s.length-1||r.top0?ye.before(this.dom):ye.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return V.empty}get isHidden(){return!0}}Ve.prototype.children=pt.prototype.children=hi.prototype.children=vo;function Gh(n,e){let t=n.dom,{children:i}=n,s=0;for(let r=0;sr&&e0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r0&&e instanceof Ot&&s.length&&(i=s[s.length-1])instanceof Ot&&i.mark.eq(e.mark)?Zh(i,e.children[0],t-1):(s.push(e),e.setParent(n)),n.length+=e.length}function Yh(n,e,t){let i=null,s=-1,r=null,o=-1;function l(h,c){for(let f=0,u=0;f=c&&(d.children.length?l(d,c-u):(!r||r.isHidden&&(t>0||Sd(r,d)))&&(p>c||u==p&&d.getSide()>0)?(r=d,o=c-u):(u-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let r of i)if(r!=t&&(s.indexOf(r)==-1||n[r]!==e[r]))return!1;return!0}function Xr(n,e,t){let i=!1;if(e)for(let s in e)t&&s in t||(i=!0,s=="style"?n.style.cssText="":n.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(i=!0,s=="style"?n.style.cssText=t[s]:n.setAttribute(s,t[s]));return i}function xd(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new Pt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=Kh(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Pt(e,i,s,t,e.widget||null,!0)}static line(e){return new on(e)}static set(e,t=!1){return N.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}R.none=N.empty;class rn extends R{constructor(e){let{start:t,end:i}=Kh(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof rn&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&rs(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}rn.prototype.point=!1;class on extends R{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof on&&this.spec.class==e.spec.class&&rs(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}on.prototype.mapMode=de.TrackBefore;on.prototype.point=!0;class Pt extends R{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?de.TrackBefore:de.TrackAfter:de.TrackDel}get type(){return this.startSide!=this.endSide?ke.WidgetRange:this.startSide<=0?ke.WidgetBefore:ke.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Pt&&kd(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Pt.prototype.point=!0;function Kh(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function kd(n,e){return n==e||!!(n&&e&&n.compare(e))}function Un(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class te extends _{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,r,o){if(i){if(!(i instanceof te))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),jh(this,e,t,i?i.children.slice():[],r,o),!0}split(e){let t=new te;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){rs(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Zh(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Nr(t,this.attrs||{})),i&&(this.attrs=Nr({class:i},this.attrs||{}))}domAtPos(e){return Gh(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Nh(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Xr(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let s=this.dom.lastChild;for(;s&&_.get(s)instanceof Ot;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((i=_.get(s))===null||i===void 0?void 0:i.isEditable)==!1&&(!Q.ios||!this.children.some(r=>r instanceof Ve))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Ve)||/[^ -~]/.test(i.text))return null;let s=ai(i.dom);if(s.length!=1)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Yh(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight=t){if(r instanceof te)return r;if(o>t)break}s=o+r.breakAfter}return null}}class mt extends _{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,s,r,o){return i&&(!(i instanceof mt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0}}class Fr extends ot{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Di{constructor(e,t,i,s){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof mt&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new te),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Sn(new hi(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof mt)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:l,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(l){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),r=Math.min(s,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Sn(new Ve(this.text.slice(this.textOff,this.textOff+r)),t),i),this.atCursorPos=!0,this.textOff+=r,e-=r,i=s<=r?0:t.length}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof Pt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(i instanceof Pt)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new mt(i.widget||ci.block,l,i));else{let a=pt.create(i.widget||ci.inline,l,l?0:i.startSide),h=this.atCursorPos&&!a.isEditable&&r<=s.length&&(e0),c=!a.isEditable&&(es.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(f.append(Sn(new hi(1),s),r),r=s.length+Math.max(0,r-s.length)),f.append(Sn(a,s),r),this.atCursorPos=c,this.pendingBuffer=c?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,i,s,r){let o=new Di(e,t,i,r);return o.openEnd=N.spans(s,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Sn(n,e){for(let t of e)n=new Ot(t,[n],n.length);return n}class ci extends ot{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ci.inline=new ci("span");ci.block=new ci("div");var Z=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(Z||(Z={}));const _t=Z.LTR,To=Z.RTL;function Jh(n){let e=[];for(let t=0;t=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function tc(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;m-=3)if(Ue[m+1]==-d){let g=Ue[m+2],y=g&2?s:g&4?g&1?r:s:0;y&&(H[f]=H[Ue[m]]=y),l=m;break}}else{if(Ue.length==189)break;Ue[l++]=f,Ue[l++]=u,Ue[l++]=a}else if((p=H[f])==2||p==1){let m=p==s;a=m?0:1;for(let g=l-3;g>=0;g-=3){let y=Ue[g+2];if(y&2)break;if(m)Ue[g+2]|=2;else{if(y&4)break;Ue[g+2]|=4}}}}}function Qd(n,e,t,i){for(let s=0,r=i;s<=t.length;s++){let o=s?t[s-1].to:n,l=sa;)p==g&&(p=t[--m].from,g=m?t[m-1].to:n),H[--p]=d;a=c}else r=h,a++}}}function Ur(n,e,t,i,s,r,o){let l=i%2?2:1;if(i%2==s%2)for(let a=e,h=0;aa&&o.push(new wt(a,m.from,d));let g=m.direction==_t!=!(d%2);Hr(n,g?i+1:i,s,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(c?H[p]!=l:H[p]==l))break;p++}u?Ur(n,a,p,i+1,s,u,o):ae;){let c=!0,f=!1;if(!h||a>r[h-1].to){let m=H[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(h&&p==r[h-1].to){if(f)break e;let m=r[--h];if(!c)for(let g=m.from,y=h;;){if(g==e)break e;if(y&&r[y-1].to==g)g=r[--y].from;else{if(H[g-1]==l)break e;break}}if(u)u.push(m);else{m.toH.length;)H[H.length]=256;let i=[],s=e==_t?0:1;return Hr(n,s,s,t,0,n.length,i),i}function ic(n){return[new wt(0,n,0)]}let nc="";function Md(n,e,t,i,s){var r;let o=i.head-n.from,l=wt.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=e[l],h=a.side(s,t);if(o==h){let u=l+=s?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!s,t),h=a.side(s,t)}let c=pe(n.text,o,a.forward(s,t));(ca.to)&&(c=h),nc=n.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return f&&c==h&&f.level+(s?0:1)n.some(e=>e)}),fc=A.define({combine:n=>n.some(e=>e)}),uc=A.define();class ni{constructor(e,t="nearest",i="nearest",s=5,r=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new ni(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ni(b.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const xn=q.define({map:(n,e)=>n.map(e)}),dc=q.define();function Pe(n,e,t){let i=n.facet(lc);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const dt=A.define({combine:n=>n.length?n[0]:!0});let Dd=0;const Kt=A.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let a=[];return o&&a.push(Ii.of(h=>{let c=h.plugin(l);return c?o(c):R.none})),r&&a.push(r(l)),a})}static fromClass(e,t){return J.define((i,s)=>new e(i,s),t)}}class Xs{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Pe(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Pe(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Pe(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const pc=A.define(),Qo=A.define(),Ii=A.define(),mc=A.define(),ln=A.define(),gc=A.define();function Cl(n,e){let t=n.state.facet(gc);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(n):r),s=[];return N.spans(i,e.from,e.to,{point(){},span(r,o,l,a){let h=r-e.from,c=o-e.from,f=s;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,p;if(d==null&&(d=Rd(e.text,h,c)),a>0&&f.length&&(p=f[f.length-1]).to==h&&p.direction==d)p.to=c,f=p.inner;else{let m={from:h,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),s}const Oc=A.define();function Ao(n){let e=0,t=0,i=0,s=0;for(let r of n.state.facet(Oc)){let o=r(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:i,bottom:s}}const Ti=A.define();class Le{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Le(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAc)break;r+=2}if(!a)return i;new Le(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),o=a.toA,l=a.toB}}}class os{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=se.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,l,a)=>s.push(new Le(r,o,l,a))),this.changedRanges=s}static create(e,t,i){return new os(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Pl extends _{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=R.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new te],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Le(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:h,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!zd(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?qd(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:c}=this.hasComposition;i=new Le(h,c,e.changes.mapPos(h,-1),e.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Q.ie||Q.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=Wd(o,l,e.changes);return i=Le.extendWithRanges(i,a),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=Q.chrome||Q.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||s.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to=0?s[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:c,toB:f}=l,u,d,p,m;if(i&&i.range.fromBc){let w=Di.build(this.view.state.doc,c,i.range.fromB,this.decorations,this.dynamicDecorationMap),k=Di.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);d=w.breakAtStart,p=w.openStart,m=k.openEnd;let v=this.compositionView(i);k.breakAtStart?v.breakAfter=1:k.content.length&&v.merge(v.length,v.length,k.content[0],!1,k.openStart,0)&&(v.breakAfter=k.content[0].breakAfter,k.content.shift()),w.content.length&&v.merge(0,0,w.content[w.content.length-1],!0,0,w.openEnd)&&w.content.pop(),u=w.content.concat(v).concat(k.content)}else({content:u,breakAtStart:d,openStart:p,openEnd:m}=Di.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:y}=r.findPos(h,1),{i:S,off:x}=r.findPos(a,-1);Hh(this,S,x,g,y,u,d,p,m)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(dc)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Ve(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new Ot(s,[t],t.length);let i=new te;return i.append(t,0),i}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=_.get(r);l&&l!=o&&(l.dom=null),o.setDOM(r)},i=this.childPos(e.range.fromB,1),s=this.children[i.i];t(e.line,s);for(let r=e.marks.length-1;r>=-1;r--)i=s.childPos(i.off,1),s=s.children[i.i],t(r>=0?e.marks[r].node:e.text,s)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom,r=!s&&!(this.view.state.facet(dt)||this.dom.tabIndex>-1)&&_n(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(Q.gecko&&l.empty&&!this.hasComposition&&Ed(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=h=new ye(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!Ri(a.node,a.offset,c.anchorNode,c.anchorOffset)||!Ri(h.node,h.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(c.focusNode)&&Ld(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=zi(this.view.root);if(f)if(l.empty){if(Q.gecko){let u=$d(a.node,a.offset);if(u&&u!=3){let d=(u==1?Fh:_h)(a.node,a.offset);d&&(a=new ye(d.node,d.offset))}}f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(u)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new ye(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new ye(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ri(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=zi(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=te.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(s,r)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let s=e.offset;!i&&s=0;s--){let r=_.get(t.childNodes[s]);r instanceof te&&(i=r.domAtPos(r.length))}return i?new ye(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=_.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t=0;o--){let l=this.children[o],a=r-l.breakAfter,h=a-l.length;if(ae||l.covers(1))&&(!i||l instanceof te&&!(i instanceof te&&t>=0)))i=l,s=h;else if(i&&h==e&&a==e&&l instanceof mt&&Math.abs(t)<2){if(l.deco.startSide<0)break;o&&(i=null)}r=h}return i?i.coordsAt(e-s,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),s=this.children[t];if(!(s instanceof te))return null;for(;s.children.length;){let{i:l,off:a}=s.childPos(i,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}i=a}if(!(s instanceof Ve))return null;let r=pe(s.text,i);if(r==i)return null;let o=Ft(s.dom,i,r).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Z.LTR;for(let h=0,c=0;cs)break;if(h>=i){let d=f.dom.getBoundingClientRect();if(t.push(d.height),o){let p=f.dom.lastChild,m=p?ai(p):[];if(m.length){let g=m[m.length-1],y=a?g.right-d.left:d.right-g.left;y>l&&(l=y,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Z.RTL:Z.LTR}measureTextSize(){for(let r of this.children)if(r instanceof te){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=ai(e.firstChild)[0];t=e.getBoundingClientRect().height,i=r?r.width/27:7,s=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:s}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Uh(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(R.replace({widget:new Fr(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return R.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Ii).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),i=!1,s=this.view.state.facet(mc).map((r,o)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[e++]=i,t.push(N.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];et.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=Ao(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;ud(this.view.scrollDOM,o,t.heads instanceof pt||s.children.some(i);return i(this.children[t])}}function Ed(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function yc(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=Fh(t.focusNode,t.focusOffset),s=_h(t.focusNode,t.focusOffset),r=i||s;if(s&&i&&s.node!=i.node){let l=_.get(s.node);if(!l||l instanceof Ve&&l.text!=s.node.nodeValue)r=s;else if(n.docView.lastCompositionAfterCursor){let a=_.get(i.node);!a||a instanceof Ve&&a.text!=i.node.nodeValue||(r=s)}}if(n.docView.lastCompositionAfterCursor=r!=i,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function qd(n,e,t){let i=yc(n,t);if(!i)return null;let{node:s,from:r,to:o}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc,h=new Le(a.mapPos(r),a.mapPos(o),r,o),c=[];for(let f=s.parentNode;;f=f.parentNode){let u=_.get(f);if(u instanceof Ot)c.push({node:f,deco:u.mark});else{if(u instanceof te||f.nodeName=="DIV"&&f.parentNode==n.contentDOM)return{range:h,text:s,marks:c,line:f};if(f!=n.contentDOM)c.push({node:f,deco:new rn({inclusive:!0,attributes:xd(f),tagName:f.tagName.toLowerCase()})});else return null}}}function $d(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}function Id(n,e,t=1){let i=n.charCategorizer(e),s=n.doc.lineAt(e),r=e-s.from;if(s.length==0)return b.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,l=r;t<0?o=pe(s.text,r,!1):l=pe(s.text,r);let a=i(s.text.slice(o,l));for(;o>0;){let h=pe(s.text,o,!1);if(i(s.text.slice(h,o))!=a)break;o=h}for(;ln?e.left-n:Math.max(0,n-e.right)}function Nd(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function Fs(n,e){return n.tope.top+1}function Ql(n,e){return en.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function Gr(n,e,t){let i,s,r,o,l=!1,a,h,c,f;for(let p=n.firstChild;p;p=p.nextSibling){let m=ai(p);for(let g=0;gx||o==x&&r>S)&&(i=p,s=y,r=S,o=x,l=S?e0:gy.bottom&&(!c||c.bottomy.top)&&(h=p,f=y):c&&Fs(c,y)?c=Al(c,y.bottom):f&&Fs(f,y)&&(f=Ql(f,y.top))}}if(c&&c.bottom>=t?(i=a,s=c):f&&f.top<=t&&(i=h,s=f),!i)return{node:n,offset:0};let u=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return Ml(i,u,t);if(l&&i.contentEditable!="false")return Gr(i,u,t);let d=Array.prototype.indexOf.call(n.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:n,offset:d}}function Ml(n,e,t){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;lt?c.top-t:t-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=u;if(Q.chrome||Q.gecko){let p=Ft(n,l).getBoundingClientRect();Math.abs(p.left-c.right)<.1&&(d=!u)}if(f<=0)return{node:n,offset:l+(d?1:0)};s=l+(d?1:0),r=f}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function bc(n,e,t,i=-1){var s,r;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,a,{docHeight:h}=n.viewState,{x:c,y:f}=e,u=f-l;if(u<0)return 0;if(u>h)return n.state.doc.length;for(let w=n.viewState.heightOracle.textHeight/2,k=!1;a=n.elementAtHeight(u),a.type!=ke.Text;)for(;u=i>0?a.bottom+w:a.top-w,!(u>=0&&u<=h);){if(k)return t?null:0;k=!0,i=-i}f=l+u;let d=a.from;if(dn.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:t?null:Rl(n,o,a,c,f);let p=n.dom.ownerDocument,m=n.root.elementFromPoint?n.root:p,g=m.elementFromPoint(c,f);g&&!n.contentDOM.contains(g)&&(g=null),g||(c=Math.max(o.left+1,Math.min(o.right-1,c)),g=m.elementFromPoint(c,f),g&&!n.contentDOM.contains(g)&&(g=null));let y,S=-1;if(g&&((s=n.docView.nearest(g))===null||s===void 0?void 0:s.isEditable)!=!1){if(p.caretPositionFromPoint){let w=p.caretPositionFromPoint(c,f);w&&({offsetNode:y,offset:S}=w)}else if(p.caretRangeFromPoint){let w=p.caretRangeFromPoint(c,f);w&&({startContainer:y,startOffset:S}=w)}y&&(!n.contentDOM.contains(y)||Q.safari&&Xd(y,S,c)||Q.chrome&&Fd(y,S,c))&&(y=void 0),y&&(S=Math.min(nt(y),S))}if(!y||!n.docView.dom.contains(y)){let w=te.find(n.docView,d);if(!w)return u>a.top+a.height/2?a.to:a.from;({node:y,offset:S}=Gr(w.dom,c,f))}let x=n.docView.nearest(y);if(!x)return null;if(x.isWidget&&((r=x.dom)===null||r===void 0?void 0:r.nodeType)==1){let w=x.dom.getBoundingClientRect();return e.yn.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((s-t.top-(n.defaultLineHeight-l)*.5)/l);r+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+qr(o,r,n.state.tabSize)}function Sc(n,e,t){let i,s=n;if(n.nodeType!=3||e!=(i=n.nodeValue.length))return!1;for(;;){let r=s.nextSibling;if(r){if(r.nodeName=="BR")break;return!1}else{let o=s.parentNode;if(!o||o.nodeName=="DIV")break;s=o}}return Ft(n,i-1,i).getBoundingClientRect().right>t}function Xd(n,e,t){return Sc(n,e,t)}function Fd(n,e,t){if(e!=0)return Sc(n,e,t);for(let s=n;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let i=n.nodeType==1?n.getBoundingClientRect():Ft(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Zr(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let s;for(let r of i.type){if(r.from>e)break;if(!(r.toe)return r;(!s||r.type==ke.Text&&(s.type!=r.type||(t<0?r.frome)))&&(s=r)}}return s||i}return i}function _d(n,e,t,i){let s=Zr(n,e.head,e.assoc||-1),r=!i||s.type!=ke.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(s.from),a=n.posAtCoords({x:t==(l==Z.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return b.cursor(a,t?-1:1)}return b.cursor(t?s.to:s.from,t?-1:1)}function Dl(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,a=null;;){let h=Md(s,r,o,l,t),c=nc;if(!h){if(s.number==(t?n.state.doc.lines:1))return l;c=` +`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),h=n.visualLineSide(s,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function Ud(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==Y.Space&&(s=o),s==o}}function Hd(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return b.cursor(s,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s,e.assoc||-1),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+c}let f=a.left+o,u=i??n.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,m=bc(n,{x:f,y:p},!1,r);if(pa.bottom||(r<0?ms)){let g=n.docView.coordsForChar(m),y=!g||p{if(e>r&&es(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:b.cursor(i,ir)&&!Zd(o,t)&&this.lineBreak(),s=o}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=_.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(Gd(e,i.node,i.offset)?t:0))}}function Gd(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let l=r||o?[]:Jd(e),a=new jd(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=ep(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!Vr(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Vr(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((Q.ios||Q.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(b.range(h,a)):this.newSel=b.single(h,a)}}}function kc(n,e){let t,{newSel:i}=e,s=n.state.selection.main,r=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=s.from,h=null;(r===8||Q.android&&e.text.length=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,s.to))}:n.state.doc.lineAt(s.from).toDate.now()-50?t={from:s.from,to:s.to,insert:n.state.toText(n.inputState.insertingText)}:Q.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` + `&&n.lineWrapping&&(i&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:V.of([" "])}),t)return Mo(n,t,i,r);if(i&&!i.main.eq(s)){let o=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=xc(n.state.facet(ln).map(a=>a(n)),i))),n.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function Mo(n,e,t,i=-1){if(Q.ios&&n.inputState.flushIOSKey(e))return!0;let s=n.state.selection.main;if(Q.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&n.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ii(n.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.lengths.head)&&ii(n.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&ii(n.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=Kd(n,e,t));return n.state.facet(ac).some(a=>a(n,e.from,e.to,r,l))||n.dispatch(l()),!0}function Kd(n,e,t){let i,s=n.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.fromr.to){let a=e.fromf(n)),h,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:b.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=r.frome.to?s.sliceDoc(e.to,r.to):"";i=s.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=s.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let c=n.state.sliceDoc(e.from,e.to),f,u=t&&yc(n,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=n.state.doc.lineAt(r.head);let d=r.to-e.to;i=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:a,range:h||p.map(a)};let m=p.to-d,g=m-c.length;if(n.state.sliceDoc(g,m)!=c||m>=f.from&&g<=f.to)return{range:p};let y=s.changes({from:g,to:m,insert:e.insert}),S=p.to-r.to;return{changes:y,range:h?b.range(Math.max(0,h.anchor+S),Math.max(0,h.head+S)):p.map(y)}})}else i={changes:a,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function wc(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Jd(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new El(t,i)),(s!=t||r!=i)&&e.push(new El(s,r))),e}function ep(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?b.single(t+e,i+e):null}class tp{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Q.safari&&e.contentDOM.addEventListener("input",()=>null),Q.gecko&&Op(e.contentDOM.ownerDocument)}handleEvent(e){!hp(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=ip(e),i=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Tc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Q.android&&Q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return Q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=vc.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||np.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ql(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(s){Pe(t.state,s)}}}function ip(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let l in r){let a=r[l];a&&t(l).handlers.push(ql(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(ql(i.value,a))}}for(let i in Ne)t(i).handlers.push(Ne[i]);for(let i in ze)t(i).observers.push(ze[i]);return e}const vc=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],np="dthko",Tc=[16,17,18,20,91,92,224,225],kn=6;function wn(n){return Math.max(0,n)*.7+8}function sp(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class rp{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=dd(e.contentDOM),this.atoms=e.state.facet(ln).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(I.allowMultipleSelections)&&op(e,t),this.dragging=ap(e,t)&&Qc(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&sp(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Ao(this.view);e.clientX-a.left<=s+kn?t=-wn(s-e.clientX):e.clientX+a.right>=o-kn&&(t=wn(e.clientX-o)),e.clientY-a.top<=r+kn?i=-wn(r-e.clientY):e.clientY+a.bottom>=l-kn&&(i=wn(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=xc(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function op(n,e){let t=n.state.facet(sc);return t.length?t[0](e):Q.mac?e.metaKey:e.ctrlKey}function lp(n,e){let t=n.state.facet(rc);return t.length?t[0](e):Q.mac?!e.altKey:!e.ctrlKey}function ap(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=zi(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function hp(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=_.get(t))&&i.ignoreEvent(e))return!1;return!0}const Ne=Object.create(null),ze=Object.create(null),Cc=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function cp(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Pc(n,t.value)},50)}function Cs(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function Pc(n,e){e=Cs(n.state,Co,e);let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Yr!=null&&t.selection.ranges.every(a=>a.empty)&&Yr==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:b.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ze.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};Ne.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);ze.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};ze.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Ne.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(oc))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=dp(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new rp(n,e,t,i)),i&&n.observer.ignore(()=>{Vh(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function $l(n,e,t,i){if(i==1)return b.cursor(e,t);if(i==2)return Id(n.state,e,t);{let s=te.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return le>=t.top&&e<=t.bottom&&n>=t.left&&n<=t.right;function fp(n,e,t,i){let s=te.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Bl(t,i,o))return-1;let l=s.coordsAt(r,1);return l&&Bl(t,i,l)?1:o&&o.bottom>=i?-1:1}function Wl(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:fp(n,t,e.clientX,e.clientY)}}const up=Q.ie&&Q.ie_version<=11;let Ll=null,zl=0,Il=0;function Qc(n){if(!up)return n.detail;let e=Ll,t=Il;return Ll=n,Il=Date.now(),zl=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(zl+1)%3:1}function dp(n,e){let t=Wl(n,e),i=Qc(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,l){let a=Wl(n,r),h,c=$l(n,a.pos,a.bias,i);if(t.pos!=a.pos&&!o){let f=$l(n,t.pos,t.bias,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=pp(s,a.pos))?h:l?s.addRange(c):b.create([c])}}}function pp(n,e){for(let t=0;t=e)return b.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Ne.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let s=n.docView.nearest(e.target);if(s&&s.isWidget){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=b.range(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Cs(n.state,Po,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ne.dragend=n=>(n.inputState.draggedContent=null,!1);function Vl(n,e,t,i){if(t=Cs(n.state,Co,t),!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&lp(n,e)?{from:r.from,to:r.to}:null,l={from:s,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Ne.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,r=()=>{++s==t.length&&Vl(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Vl(n,e,i,!0),!0}return!1};Ne.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=Cc?null:e.clipboardData;return t?(Pc(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(cp(n),!1)};function mp(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function gp(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:Cs(n,Po,e.join(n.lineBreak)),ranges:t,linewise:i}}let Yr=null;Ne.copy=Ne.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=gp(n.state);if(!t&&!s)return!1;Yr=s?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=Cc?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(mp(n,t),!1)};const Ac=st.define();function Mc(n,e){let t=[];for(let i of n.facet(hc)){let s=i(n,e);s&&t.push(s)}return t.length?n.update({effects:t,annotations:Ac.of(!0)}):null}function Rc(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=Mc(n.state,e);t?n.dispatch(t):n.update([])}},10)}ze.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),Rc(n)};ze.blur=n=>{n.observer.clearSelectionRange(),Rc(n)};ze.compositionstart=ze.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};ze.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,Q.chrome&&Q.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};ze.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Ne.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return Mo(n,{from:a,to:h,insert:n.state.toText(r)},null),!0}}let s;if(Q.chrome&&Q.android&&(s=vc.find(r=>r.inputType==e.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return Q.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),Q.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>ze.compositionend(n,e),20),!1};const Nl=new Set;function Op(n){Nl.has(n)||(Nl.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const Xl=["pre-wrap","normal","pre-line","break-spaces"];let fi=!1;function Fl(){fi=!1}class yp{constructor(e){this.lineWrapping=e,this.doc=V.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Xl.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Hn&&(fi=!0),this.height=e)}replace(e,t,i){return we.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l],u=r.lineAt(a,G.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,G.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=s[l-1].toA;)a=s[l-1].fromA,c=s[l-1].fromB,l--,ar*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class De extends Dc{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,s){return new Ke(s,this.length,i,this.height,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof De||s instanceof fe&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof fe?s=new De(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):we.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(s.heights[s.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class fe extends we{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let h=s+(e0){let r=i[i.length-1];r instanceof fe?i[i.length-1]=new fe(r.length+s):i.push(null,new fe(s-1))}if(e>0){let r=i[0];r instanceof fe?i[0]=new fe(e+r.length):i.unshift(new fe(e-1),null)}return we.of(i)}decomposeLeft(e,t){t.push(new fe(e-1),null)}decomposeRight(e,t){t.push(null,new fe(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;for(s.from>t&&o.push(new fe(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++];a==-1?a=f:Math.abs(f-a)>=Hn&&(a=-2);let u=new De(c,f);u.outdated=!1,o.push(u),l+=c+1}l<=r&&o.push(null,new fe(r-l).updateHeight(e,l));let h=we.of(o);return(a<0||Math.abs(h.height-this.height)>=Hn||Math.abs(a-this.heightMetrics(e,t).perLine)>=Hn)&&(fi=!0),ls(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Sp extends we{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return h;let c=t==G.ByPosNoHeight?G.ByPosNoHeight:G.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,G.ByPos,i,s,r);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&_l(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?we.of(this.break?[e,null,t]:[e,t]):(this.left=ls(this.left,e),this.right=ls(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return s&&s.from<=t+r.length&&s.more?a=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function _l(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof fe&&(i=n[e+1])instanceof fe&&n.splice(e-1,3,new fe(t.length+1+i.length))}const xp=5;class Ro{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof De?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new De(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=xp)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new De(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new fe(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof De)return e;let t=new De(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof De)&&!this.isCovered?this.nodes.push(new De(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==n.parentNode?s.innerHeight:a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function Tp(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function Cp(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Us{constructor(e,t,i,s){this.from=e,this.to=t,this.size=i,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new yp(t),this.stateDeco=e.facet(Ii).filter(i=>typeof i!="function"),this.heightMap=we.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle.setDoc(e.doc),[new Le(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=R.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new vn(r,o))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Hl:new Do(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Pi(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ii).filter(c=>typeof c!="function");let s=e.changedRanges,r=Le.extendWithRanges(s,kp(i,this.stateDeco,e?e.changes:se.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Fl(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||fi)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(fc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Z.RTL:Z.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:w,scaleY:k}=Ih(t,l);(w>.005&&Math.abs(this.scaleX-w)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=w,this.scaleY=k,h|=16,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Xh(e.scrollDOM);let p=(this.printing?Cp:vp)(t,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget&&!Tp(e.dom))return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let w=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(w)&&(o=!0),o||s.lineWrapping&&Math.abs(S-this.contentDOMWidth)>s.charWidth){let{lineHeight:k,charWidth:v,textHeight:T}=e.docView.measureTextSize();o=k>0&&s.refresh(r,k,v,T,Math.max(5,S/v),w),o&&(e.docView.minWidth=0,h|=16)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),Fl();for(let k of this.viewports){let v=k.from==this.viewport.from?w:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?we.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle,[new Le(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new bp(k.from,v))}fi&&(h|=2)}let x=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return x&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||x)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new vn(s.lineAt(o-i*1e3,G.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,G.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,G.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=Z.LTR&&!i)return[];let l=[],a=(c,f,u,d)=>{if(f-cc&&yy.from>=u.from&&y.to<=u.to&&Math.abs(y.from-c)y.fromS));if(!g){if(fx.from<=f&&x.to>=f)){let x=t.moveToLineBoundary(b.cursor(f),!1,!0).head;x>c&&(f=x)}let y=this.gapSize(u,c,f,d),S=i||y<2e6?y:2e6;g=new Us(c,f,y,S)}l.push(g)},h=c=>{if(c.length2e6)for(let v of e)v.from>=c.from&&v.fromc.from&&a(c.from,d,c,f),pt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];N.spans(t,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let r=0;r=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Pi(this.heightMap.lineAt(e,G.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Pi(this.heightMap.lineAt(this.scaler.fromDOM(e),G.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Pi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class vn{constructor(e,t){this.from=e,this.to=t}}function Qp(n,e,t){let i=[],s=n,r=0;return N.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function Cn(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function Ap(n,e){for(let t of n)if(e(t))return t}const Hl={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};class Do{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,G.ByPos,e,0,0).top,c=t.lineAt(a,G.ByPos,e,0,0).bottom;return s+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Pi(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Ke(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(s=>Pi(s,e)):n._content)}const Pn=A.define({combine:n=>n.join(" ")}),Kr=A.define({combine:n=>n.indexOf(!0)>-1}),Jr=Tt.newName(),Ec=Tt.newName(),qc=Tt.newName(),$c={"&light":"."+Ec,"&dark":"."+qc};function eo(n,e,t){return new Tt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const Mp=eo("."+Jr,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},$c),Rp={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Hs=Q.ie&&Q.ie_version<=11;class Dp{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new pd,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(Q.ie&&Q.ie_version<=11||Q.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Q.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Q.chrome&&Q.chrome_version<126)&&(this.editContext=new qp(e),e.state.facet(dt)&&(e.contentDOM.editContext=this.editContext.editContext)),Hs&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(dt)?i.root.activeElement!=this.dom:!_n(this.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Ri(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=zi(e.root);if(!t)return!1;let i=Q.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Ep(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=_n(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&ii(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&_n(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Yd(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,s=kc(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=jl(t,e.previousSibling||e.target.previousSibling,-1),s=jl(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(dt)!=e.state.facet(dt)&&(e.view.contentDOM.editContext=e.state.facet(dt)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function jl(n,e,t){for(;e;){let i=_.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function Gl(n,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,r=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor);return Ri(o.node,o.offset,s,r)&&([t,i,s,r]=[s,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function Ep(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return Gl(n,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?Gl(n,t):null}class qp{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let s=e.state.selection.main,{anchor:r,head:o}=s,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&rthis.to&&(a=r);let c=wc(e.state.sliceDoc(l,a),i.text,(h?s.from:s.to)-l,h?"end":null);if(!c){let u=b.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));u.main.eq(s)||e.dispatch({selection:u,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:V.of(i.text.slice(c.from,c.toB).split(` +`))};if((Q.mac||Q.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:V.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Mo(e,f,b.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=zi(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,t+=c,this.to+=c;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(rthis.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),s&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class P{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||md(e.parent)||document,this.viewState=new Ul(e.state||I.create(e)),e.scrollTo&&e.scrollTo.is(xn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Kt).map(s=>new Xs(s));for(let s of this.plugins)s.update(this);this.observer=new Dp(this),this.inputState=new tp(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Pl(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof ie?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(Ac))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Mc(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(I.phrases)!=this.state.facet(I.phrases))return this.setState(r);s=os.create(this,r,e),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new ni(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(xn)&&(f=d.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=as.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Ti)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Pn)!=s.state.facet(Pn)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(jr))try{u(s)}catch(d){Pe(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!kc(this,c)&&h.force&&ii(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Ul(e),this.plugins=e.facet(Kt).map(i=>new Xs(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Pl(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Kt),i=e.state.facet(Kt);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new Xs(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Xh(i))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(p){return Pe(this.state,p),Zl}}),f=os.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let d=0;d1||p<-1){s=s+p,i.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(jr))l(t)}get themeClasses(){return Jr+" "+(this.state.facet(Kr)?qc:Ec)+" "+this.state.facet(Pn)}updateAttrs(){let e=Yl(this,pc,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(dt)?"true":"false",class:"cm-content",style:`${Q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Yl(this,Qo,t);let i=this.observer.ignore(()=>{let s=Xr(this.contentDOM,this.contentAttrs,t),r=Xr(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(P.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Ti);let e=this.state.facet(P.cspNonce);Tt.mount(this.root,this.styleModules.concat(Mp).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return _s(this,e,Dl(this,e,t,i))}moveByGroup(e,t){return _s(this,e,Dl(this,e,t,i=>Ud(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return b.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return _d(this,e,t,i)}moveVertically(e,t,i){return _s(this,e,Hd(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),bc(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[wt.find(r,e-s.from,-1,t)];return sn(i,o.dir==Z.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(cc)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>$p)return ic(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||tc(r.isolates,i=Cl(this,e))))return r.order;i||(i=Cl(this,e));let s=Ad(e.text,t,i);return this.bidiCache.push(new as(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Vh(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return xn.of(new ni(typeof e=="number"?b.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return xn.of(new ni(b.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return J.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return J.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=Tt.newName(),s=[Pn.of(i),Ti.of(eo(`.${i}`,e))];return t&&t.dark&&s.push(Kr.of(!0)),s}static baseTheme(e){return Mt.lowest(Ti.of(eo("."+Jr,e,$c)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&_.get(i)||_.get(e);return((t=s?.rootView)===null||t===void 0?void 0:t.view)||null}}P.styleModule=Ti;P.inputHandler=ac;P.clipboardInputFilter=Co;P.clipboardOutputFilter=Po;P.scrollHandler=uc;P.focusChangeEffect=hc;P.perLineTextDirection=cc;P.exceptionSink=lc;P.updateListener=jr;P.editable=dt;P.mouseSelectionStyle=oc;P.dragMovesSelection=rc;P.clickAddsSelectionRange=sc;P.decorations=Ii;P.outerDecorations=mc;P.atomicRanges=ln;P.bidiIsolatedRanges=gc;P.scrollMargins=Oc;P.darkTheme=Kr;P.cspNonce=A.define({combine:n=>n.length?n[0]:""});P.contentAttributes=Qo;P.editorAttributes=pc;P.lineWrapping=P.contentAttributes.of({class:"cm-lineWrapping"});P.announce=q.define();const $p=4096,Zl={};class as{constructor(e,t,i,s,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:Z.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&Nr(o,t)}return t}const Bp=Q.mac?"mac":Q.windows?"win":Q.linux?"linux":"key";function Wp(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let a=0;ai.concat(s),[]))),t}function zp(n,e,t){return Wc(Bc(n.state),e,n,t)}let xt=null;const Ip=4e3;function Vp(n,e=Bp){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>Wp(y,e));for(let y=1;y{let w=xt={view:x,prefix:S,scope:o};return setTimeout(()=>{xt==w&&(xt=null)},Ip),!0}]})}let m=p.join(" ");s(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(d=>f(d,to))}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let to=null;function Wc(n,e,t,i){to=e;let s=hd(e),r=Te(s,0),o=Ye(r)==s.length&&s!=" ",l="",a=!1,h=!1,c=!1;xt&&xt.view==t&&xt.scope==i&&(l=xt.prefix+" ",Tc.indexOf(e.keyCode)<0&&(h=!0,xt=null));let f=new Set,u=g=>{if(g){for(let y of g.run)if(!f.has(y)&&(f.add(y),y(t)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},d=n[i],p,m;return d&&(u(d[l+Qn(s,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Q.windows&&e.ctrlKey&&e.altKey)&&!(Q.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Ct[e.keyCode])&&p!=s?(u(d[l+Qn(p,e,!0)])||e.shiftKey&&(m=Li[e.keyCode])!=s&&m!=p&&u(d[l+Qn(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+Qn(s,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),to=null,a}class hn{constructor(e,t,i,s,r){this.className=e,this.left=t,this.top=i,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=Lc(e);return[new hn(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return Np(e,t,i)}}function Lc(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Z.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function Jl(n,e,t,i){let s=n.coordsAtPos(e,t*2);if(!s)return i;let r=n.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=n.posAtCoords({x:r.left+1,y:o}),a=n.posAtCoords({x:r.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function Np(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to),r=n.textDirection==Z.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=Lc(n),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=Zr(n,i,1),p=Zr(n,s,-1),m=d.type==ke.Text?d:null,g=p.type==ke.Text?p:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=Jl(n,i,1,m)),g&&(n.lineWrapping||p.widgetLineBreaks)&&(g=Jl(n,s,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return S(x(t.from,t.to,m));{let k=m?x(t.from,null,m):w(d,!1),v=g?x(null,t.to,g):w(p,!0),T=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&k.bottom+n.defaultLineHeight/2D&&W.from=ne)break;ee>X&&$(Math.max(F,X),k==null&&F<=D,Math.min(ee,ne),v==null&&ee>=B,me.dir)}if(X=oe.to+1,X>=ne)break}return z.length==0&&$(D,k==null,B,v==null,n.textDirection),{top:E,bottom:M,horizontal:z}}function w(k,v){let T=l.top+(v?k.top:k.bottom);return{top:T,bottom:T,horizontal:[]}}}function Xp(n,e){return n.constructor==e.constructor&&n.eq(e)}class Fp{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(jn)!=e.state.facet(jn)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(jn);for(;t!Xp(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,Q.safari&&Q.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const jn=A.define();function zc(n){return[J.define(e=>new Fp(e,n)),jn.of(n)]}const Vi=A.define({combine(n){return rt(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function _p(n={}){return[Vi.of(n),Up,Hp,jp,fc.of(!0)]}function Ic(n){return n.startState.facet(Vi)!=n.state.facet(Vi)}const Up=zc({above:!0,markers(n){let{state:e}=n,t=e.facet(Vi),i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty||t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:b.cursor(s.head,s.head>s.anchor?-1:1);for(let a of hn.forRange(n,o,l))i.push(a)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Ic(n);return t&&ea(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){ea(e.state,n)},class:"cm-cursorLayer"});function ea(n,e){e.style.animationDuration=n.facet(Vi).cursorBlinkRate+"ms"}const Hp=zc({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:hn.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||Ic(n)},class:"cm-selectionLayer"}),jp=Mt.highest(P.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Vc=q.define({map(n,e){return n==null?null:e.mapPos(n)}}),Qi=he.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(Vc)?i.value:t,n)}}),Gp=J.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Qi);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Qi)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(Qi),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Qi)!=n&&this.view.dispatch({effects:Vc.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Zp(){return[Qi,Gp]}function ta(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function Yp(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class Kp{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,a,h,c)=>s(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new gt,i=t.add.bind(t);for(let{from:s,to:r}of Yp(e,this.maxLength))ta(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(i=Math.min(l,i),s=Math.max(a,s))}),e.viewportMoved||s-i>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>=o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(y.range(m,g));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(g,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:u})}}return t}}const io=/x/.unicode!=null?"gu":"g",Jp=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,io),em={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let js=null;function tm(){var n;if(js==null&&typeof document<"u"&&document.body){let e=document.body.style;js=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return js||!1}const Gn=A.define({combine(n){let e=rt(n,{render:null,specialChars:Jp,addSpecialChars:null});return(e.replaceTabs=!tm())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,io)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,io)),e}});function im(n={}){return[Gn.of(n),nm()]}let ia=null;function nm(){return ia||(ia=J.fromClass(class{constructor(n){this.view=n,this.decorations=R.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Gn)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Kp({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=Te(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,a=gi(o.text,l,i-o.from);return R.replace({widget:new lm((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=R.replace({widget:new om(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Gn);n.startState.facet(Gn)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const sm="•";function rm(n){return n>=32?sm:n==10?"␤":String.fromCharCode(9216+n)}class om extends ot{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=rm(this.code),i=e.state.phrase("Control character")+" "+(em[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class lm extends ot{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function am(){return cm}const hm=R.line({class:"cm-activeLine"}),cm=J.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(hm.range(s.from)),e=s.from)}return R.set(t)}},{decorations:n=>n.decorations});class fm extends ot{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?ai(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),s=sn(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function um(n){let e=J.fromClass(class{constructor(t){this.view=t,this.placeholder=n?R.set([R.widget({widget:new fm(n),side:1}).range(0)]):R.none}get decorations(){return this.view.state.doc.length?R.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,P.contentAttributes.of({"aria-placeholder":n})]:e}const no=2e3;function dm(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>no||t.off>no||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=s;a++){let h=n.doc.line(a);h.length<=l&&r.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=s;a++){let h=n.doc.line(a),c=qr(h.text,o,n.tabSize,!0);if(c<0)r.push(b.cursor(h.to));else{let f=qr(h.text,l,n.tabSize);r.push(b.range(h.from+c,h.from+f))}}}return r}function pm(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function na(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>no?-1:s==i.length?pm(n,e.clientX):gi(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function mm(n,e){let t=na(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=na(n,s);if(!l)return i;let a=dm(n.state,t,l);return a.length?o?b.create(a.concat(i.ranges)):b.create(a):i}}:null}function gm(n){let e=(t=>t.altKey&&t.button==0);return P.mouseSelectionStyle.of((t,i)=>e(i)?mm(t,i):null)}const Om={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},ym={style:"cursor: crosshair"};function bm(n={}){let[e,t]=Om[n.key||"Alt"],i=J.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,P.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?ym:null})]}const An="-10000px";class Nc{constructor(e,t,i,s){this.facet=t,this.createTooltipView=i,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function Sm(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Gs=A.define({combine:n=>{var e,t,i;return{position:Q.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Sm}}}),sa=new WeakMap,Eo=J.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(Gs);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Nc(n,qo,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(Gs);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=An,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(Q.safari){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(n=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),s=Ao(this.view);return{visible:{left:i.left+s.left,top:i.top+s.top,right:i.right-s.right,bottom:i.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(Gs).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:i,scaleX:s,scaleY:r}=n,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1)){c.style.top=An;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=u.right-u.left,g=(e=sa.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||km,S=this.view.textDirection==Z.LTR,x=u.width>i.right-i.left?S?i.left:i.right-u.width:S?Math.max(i.left,Math.min(f.left-(d?14:0)+y.x,i.right-m)):Math.min(Math.max(i.left,f.left-m+(d?14:0)-y.x),i.right-m),w=this.above[l];!a.strictSide&&(w?f.top-g-p-y.yi.bottom)&&w==i.bottom-f.bottom>f.top-i.top&&(w=this.above[l]=!w);let k=(w?f.top-i.top:i.bottom-f.bottom)-p;if(kx&&E.topv&&(v=w?E.top-g-2-p:E.bottom+p+2);if(this.position=="absolute"?(c.style.top=(v-n.parent.top)/r+"px",ra(c,(x-n.parent.left)/s)):(c.style.top=v/r+"px",ra(c,x/s)),d){let E=f.left+(S?y.x:-y.x)-(x+14-7);d.style.left=E/s+"px"}h.overlap!==!0&&o.push({left:x,top:v,right:T,bottom:v+g}),c.classList.toggle("cm-tooltip-above",w),c.classList.toggle("cm-tooltip-below",!w),h.positioned&&h.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=An}},{eventObservers:{scroll(){this.maybeMeasure()}}});function ra(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const xm=P.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),km={x:0,y:0},qo=A.define({enables:[Eo,xm]}),hs=A.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Ps{static create(e){return new Ps(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Nc(e,hs,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const wm=qo.compute([hs],n=>{let e=n.facet(hs);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Ps.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class vm{constructor(e,t,i,s,r){this.view=e,this.source=t,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||t.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(s)).find(c=>c.from<=s&&c.to>=s),h=a&&a.dir==Z.RTL?-1:1;r=t.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Pe(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Eo),t=e?e.manager.tooltips.findIndex(i=>i.create==Ps.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!Tm(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!Cm(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Mn=4;function Tm(n,e){let{left:t,right:i,top:s,bottom:r}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),r=Math.max(l.bottom,r)}return e.clientX>=t-Mn&&e.clientX<=i+Mn&&e.clientY>=s-Mn&&e.clientY<=r+Mn}function Cm(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rights||Math.min(o.bottom,l)=e&&a<=t}function Pm(n,e={}){let t=q.define(),i=he.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let l of s){let a=r.changes.mapPos(l.pos,-1,de.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Qm)&&(s=[]);return s},provide:s=>hs.from(s)});return{active:i,extension:[i,J.define(s=>new vm(s,n,i,t,e.hoverTime||300)),wm]}}function Xc(n,e){let t=n.plugin(Eo);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Qm=q.define(),oa=A.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Ni(n,e){let t=n.plugin(Fc),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const Fc=J.fromClass(class{constructor(n){this.input=n.state.facet(Xi),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(oa);this.top=new Rn(n,!0,e.topContainer),this.bottom=new Rn(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(oa);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Rn(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Rn(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Xi);if(t!=this.input){let i=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>P.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Rn{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=la(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=la(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function la(n){let e=n.nextSibling;return n.remove(),e}const Xi=A.define({enables:Fc});class yt extends Nt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}yt.prototype.elementClass="";yt.prototype.toDOM=void 0;yt.prototype.mapMode=de.TrackBefore;yt.prototype.startSide=yt.prototype.endSide=-1;yt.prototype.point=!0;const Zn=A.define(),Am=A.define(),Mm={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>N.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},qi=A.define();function Rm(n){return[_c(),qi.of({...Mm,...n})]}const aa=A.define({combine:n=>n.some(e=>e)});function _c(n){return[Dm]}const Dm=J.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(qi).map(e=>new ca(n,e)),this.fixed=!n.state.facet(aa);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(aa)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=N.iter(this.view.state.facet(Zn),this.view.viewport.from),i=[],s=this.gutters.map(r=>new Em(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==ke.Text&&o){so(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==ke.Text){so(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(qi),t=n.state.facet(qi),i=n.docChanged||n.heightChanged||n.viewportChanged||!N.eq(n.startState.facet(Zn),n.state.facet(Zn),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new ca(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>P.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Z.LTR?{left:i,right:s}:{right:i,left:s}})});function ha(n){return Array.isArray(n)?n:[n]}function so(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class Em{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=N.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new Uc(e,o,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];so(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),s=i?[i]:null;for(let r of e.state.facet(Am)){let o=r(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class ca{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,s)&&s.preventDefault()});this.markers=ha(t.markers(e)),t.initialSpacer&&(this.spacer=new Uc(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=ha(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!N.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Uc{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),qm(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,h)||o(l,a,h):o}return i}})}});class Zs extends yt{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ys(n,e){return n.state.facet(Jt).formatNumber(e,n.state)}const Wm=qi.compute([Jt],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet($m)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new Zs(Ys(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let s of e.state.facet(Bm)){let r=s(e,t,i);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(Jt)!=e.state.facet(Jt),initialSpacer(e){return new Zs(Ys(e,fa(e.state.doc.lines)))},updateSpacer(e,t){let i=Ys(t.view,fa(t.view.state.doc.lines));return i==e.number?e:new Zs(i)},domEventHandlers:n.facet(Jt).domEventHandlers,side:"before"}));function Lm(n={}){return[Jt.of(n),_c(),Wm]}function fa(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(zm.range(s)))}return N.of(e)});function Vm(){return Im}const Hc=1024;let Nm=0;class Ks{constructor(e,t){this.from=e,this.to=t}}class L{constructor(e={}){this.id=Nm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ve.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}L.closedBy=new L({deserialize:n=>n.split(" ")});L.openedBy=new L({deserialize:n=>n.split(" ")});L.group=new L({deserialize:n=>n.split(" ")});L.isolate=new L({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});L.contextHash=new L({perNode:!0});L.lookAhead=new L({perNode:!0});L.mounted=new L({perNode:!0});class cs{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[L.mounted.id]}}const Xm=Object.create(null);class ve{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Xm,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new ve(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(L.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(L.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}ve.none=new ve("",Object.create(null),0,8);class Qs{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|re.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Wo(ve.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new j(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new j(ve.none,t,i,s)))}static build(e){return Hm(e)}}j.empty=new j(ve.none,[],[],0);class $o{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new $o(this.buffer,this.index)}}class Qt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return ve.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Fi(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from;if(jc(s,i,f,f+c.length)){if(c instanceof Qt){if(r&re.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,s);if(u>-1)return new Je(new Fm(o,c,e,f),null,u)}else if(r&re.IncludeAnonymous||!c.type.isAnonymous||Bo(c)){let u;if(!(r&re.IgnoreMounts)&&(u=cs.get(c))&&!u.overlay)return new Ae(u.tree,f,e,o);let d=new Ae(c,f,e,o);return r&re.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,s)}}}if(r&re.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let s;if(!(i&re.IgnoreOverlays)&&(s=cs.get(this._tree))&&s.overlay){let r=e-this.from;for(let{from:o,to:l}of s.overlay)if((t>0?o<=r:o=r:l>r))return new Ae(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function da(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function ro(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Fm{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class Je extends Gc{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new Je(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&re.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Je(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Je(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Je(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o)),t.push(0)}return new j(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Zc(n){if(!n.length)return null;let e=0,t=n[0];for(let r=1;rt.from||o.to=e){let l=new Ae(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[i])).push(Fi(l,e,t,!1))}}return s?Zc(s):i}class oo{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ae)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof Ae?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&re.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&re.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&re.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&re.IncludeAnonymous||l instanceof Qt||!l.type.isAnonymous||Bo(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}for(let s=i;s=0;r--){if(r<0)return ro(this._tree,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function Bo(n){return n.children.some(e=>e instanceof Qt||!e.type.isAnonymous||Bo(e))}function Hm(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Hc,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new $o(t,t.length):t,a=i.types,h=0,c=0;function f(k,v,T,E,M,z){let{id:$,start:D,end:B,size:W}=l,X=c,ne=h;if(W<0)if(l.next(),W==-1){let ce=r[$];T.push(ce),E.push(D-k);return}else if(W==-3){h=$;return}else if(W==-4){c=$;return}else throw new RangeError(`Unrecognized record size: ${W}`);let oe=a[$],me,F,ee=D-k;if(B-D<=s&&(F=g(l.pos-v,M))){let ce=new Uint16Array(F.size-F.skip),ge=l.pos-F.size,_e=ce.length;for(;l.pos>ge;)_e=y(F.start,ce,_e);me=new Qt(ce,B-F.start,i),ee=F.start-k}else{let ce=l.pos-W;l.next();let ge=[],_e=[],Dt=$>=o?$:-1,Gt=0,gn=B;for(;l.pos>ce;)Dt>=0&&l.id==Dt&&l.size>=0?(l.end<=gn-s&&(p(ge,_e,D,Gt,l.end,gn,Dt,X,ne),Gt=ge.length,gn=l.end),l.next()):z>2500?u(D,ce,ge,_e):f(D,ce,ge,_e,Dt,z+1);if(Dt>=0&&Gt>0&&Gt-1&&Gt>0){let al=d(oe,ne);me=Wo(oe,ge,_e,0,ge.length,0,B-D,al,al)}else me=m(oe,ge,_e,B-D,X-B,ne)}T.push(me),E.push(ee)}function u(k,v,T,E){let M=[],z=0,$=-1;for(;l.pos>v;){let{id:D,start:B,end:W,size:X}=l;if(X>4)l.next();else{if($>-1&&B<$)break;$<0&&($=W-s),M.push(D,B,W),z++,l.next()}}if(z){let D=new Uint16Array(z*4),B=M[M.length-2];for(let W=M.length-3,X=0;W>=0;W-=3)D[X++]=M[W],D[X++]=M[W+1]-B,D[X++]=M[W+2]-B,D[X++]=X;T.push(new Qt(D,M[2]-B,i)),E.push(B-k)}}function d(k,v){return(T,E,M)=>{let z=0,$=T.length-1,D,B;if($>=0&&(D=T[$])instanceof j){if(!$&&D.type==k&&D.length==M)return D;(B=D.prop(L.lookAhead))&&(z=E[$]+D.length+B)}return m(k,T,E,M,z,v)}}function p(k,v,T,E,M,z,$,D,B){let W=[],X=[];for(;k.length>E;)W.push(k.pop()),X.push(v.pop()+T-M);k.push(m(i.types[$],W,X,z-M,D-z,B)),v.push(M-T)}function m(k,v,T,E,M,z,$){if(z){let D=[L.contextHash,z];$=$?[D].concat($):[D]}if(M>25){let D=[L.lookAhead,M];$=$?[D].concat($):[D]}return new j(k,v,T,E,$)}function g(k,v){let T=l.fork(),E=0,M=0,z=0,$=T.end-s,D={size:0,start:0,skip:0};e:for(let B=T.pos-k;T.pos>B;){let W=T.size;if(T.id==v&&W>=0){D.size=E,D.start=M,D.skip=z,z+=4,E+=4,T.next();continue}let X=T.pos-W;if(W<0||X=o?4:0,oe=T.start;for(T.next();T.pos>X;){if(T.size<0)if(T.size==-3)ne+=4;else break e;else T.id>=o&&(ne+=4);T.next()}M=oe,E+=W,z+=ne}return(v<0||E==k)&&(D.size=E,D.start=M,D.skip=z),D.size>4?D:void 0}function y(k,v,T){let{id:E,start:M,end:z,size:$}=l;if(l.next(),$>=0&&E4){let B=l.pos-($-4);for(;l.pos>B;)T=y(k,v,T)}v[--T]=D,v[--T]=z-k,v[--T]=M-k,v[--T]=E}else $==-3?h=E:$==-4&&(c=E);return T}let S=[],x=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,S,x,-1,0);let w=(e=n.length)!==null&&e!==void 0?e:S.length?x[0]+S[0].length:0;return new j(a[n.topID],S.reverse(),x.reverse(),w)}const pa=new WeakMap;function Yn(n,e){if(!n.isAnonymous||e instanceof Qt||e.type!=n)return 1;let t=pa.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof j)){t=1;break}t+=Yn(n,i)}pa.set(e,t)}return t}function Wo(n,e,t,i,s,r,o,l,a){let h=0;for(let p=i;p=c)break;v+=T}if(x==w+1){if(v>c){let T=p[w];d(T.children,T.positions,0,T.children.length,m[w]+S);continue}f.push(p[w])}else{let T=m[x-1]+p[x-1].length-k;f.push(Wo(n,p,m,w,x,k,T,null,a))}u.push(k+S-r)}}return d(e,t,i,s,0),(l||a)(f,u,o)}class jm{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Je?this.setBuffer(e.context.buffer,e.index,t):e instanceof Ae&&this.map.set(e.tree,t)}get(e){return e instanceof Je?this.getBuffer(e.context.buffer,e.index):e instanceof Ae?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class It{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new It(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new It(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew Ks(s.from,s.to)):[new Ks(0,0)]:[new Ks(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class Gm{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new L({perNode:!0});let Zm=0;class qe{constructor(e,t,i,s){this.name=e,this.set=t,this.base=i,this.modified=s,this.id=Zm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof qe&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let s=new qe(i,[],null,[]);if(s.set.push(s),t)for(let r of t.set)s.set.push(r);return s}static defineModifier(e){let t=new fs(e);return i=>i.modified.indexOf(t)>-1?i:fs.get(i.base||i,i.modified.concat(t).sort((s,r)=>s.id-r.id))}}let Ym=0;class fs{constructor(e){this.name=e,this.instances=[],this.id=Ym++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&Km(t,l.modified));if(i)return i;let s=[],r=new qe(e.name,s,e,t);for(let l of t)l.instances.push(r);let o=Jm(t);for(let l of e.set)if(!l.modified.length)for(let a of o)s.push(fs.get(l,a));return r}}function Km(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function Jm(n){let e=[[]];for(let t=0;ti.length-t.length)}function zo(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+s);let c=new _i(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return Yc.add(e)}const Yc=new L({combine(n,e){let t,i,s;for(;n||e;){if(!n||e&&n.depth>=e.depth?(s=e,e=e.next):(s=n,n=n.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let r=new _i(s.tags,s.mode,s.context);t?t.next=r:i=r,t=r}return i}});class _i{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function eg(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function tg(n,e,t,i=0,s=n.length){let r=new ig(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class ig{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=s,c=ng(e)||_i.empty,f=eg(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,l),h),c.opaque)return;let u=e.tree&&e.tree.prop(L.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),m=e.firstChild();for(let g=0,y=l;;g++){let S=g=x||!e.nextSibling())););if(!S||x>i)break;y=S.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,S.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),h))}m&&e.parent()}else if(e.firstChild()){u&&(s="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function ng(n){let e=n.type.prop(Yc);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const C=qe.define,En=C(),bt=C(),ma=C(bt),ga=C(bt),St=C(),qn=C(St),Js=C(St),Ge=C(),Et=C(Ge),He=C(),je=C(),lo=C(),ki=C(lo),$n=C(),O={comment:En,lineComment:C(En),blockComment:C(En),docComment:C(En),name:bt,variableName:C(bt),typeName:ma,tagName:C(ma),propertyName:ga,attributeName:C(ga),className:C(bt),labelName:C(bt),namespace:C(bt),macroName:C(bt),literal:St,string:qn,docString:C(qn),character:C(qn),attributeValue:C(qn),number:Js,integer:C(Js),float:C(Js),bool:C(St),regexp:C(St),escape:C(St),color:C(St),url:C(St),keyword:He,self:C(He),null:C(He),atom:C(He),unit:C(He),modifier:C(He),operatorKeyword:C(He),controlKeyword:C(He),definitionKeyword:C(He),moduleKeyword:C(He),operator:je,derefOperator:C(je),arithmeticOperator:C(je),logicOperator:C(je),bitwiseOperator:C(je),compareOperator:C(je),updateOperator:C(je),definitionOperator:C(je),typeOperator:C(je),controlOperator:C(je),punctuation:lo,separator:C(lo),bracket:ki,angleBracket:C(ki),squareBracket:C(ki),paren:C(ki),brace:C(ki),content:Ge,heading:Et,heading1:C(Et),heading2:C(Et),heading3:C(Et),heading4:C(Et),heading5:C(Et),heading6:C(Et),contentSeparator:C(Ge),list:C(Ge),quote:C(Ge),emphasis:C(Ge),strong:C(Ge),link:C(Ge),monospace:C(Ge),strikethrough:C(Ge),inserted:C(),deleted:C(),changed:C(),invalid:C(),meta:$n,documentMeta:C($n),annotation:C($n),processingInstruction:C($n),definition:qe.defineModifier("definition"),constant:qe.defineModifier("constant"),function:qe.defineModifier("function"),standard:qe.defineModifier("standard"),local:qe.defineModifier("local"),special:qe.defineModifier("special")};for(let n in O){let e=O[n];e instanceof qe&&(e.name=n)}Kc([{tag:O.link,class:"tok-link"},{tag:O.heading,class:"tok-heading"},{tag:O.emphasis,class:"tok-emphasis"},{tag:O.strong,class:"tok-strong"},{tag:O.keyword,class:"tok-keyword"},{tag:O.atom,class:"tok-atom"},{tag:O.bool,class:"tok-bool"},{tag:O.url,class:"tok-url"},{tag:O.labelName,class:"tok-labelName"},{tag:O.inserted,class:"tok-inserted"},{tag:O.deleted,class:"tok-deleted"},{tag:O.literal,class:"tok-literal"},{tag:O.string,class:"tok-string"},{tag:O.number,class:"tok-number"},{tag:[O.regexp,O.escape,O.special(O.string)],class:"tok-string2"},{tag:O.variableName,class:"tok-variableName"},{tag:O.local(O.variableName),class:"tok-variableName tok-local"},{tag:O.definition(O.variableName),class:"tok-variableName tok-definition"},{tag:O.special(O.variableName),class:"tok-variableName2"},{tag:O.definition(O.propertyName),class:"tok-propertyName tok-definition"},{tag:O.typeName,class:"tok-typeName"},{tag:O.namespace,class:"tok-namespace"},{tag:O.className,class:"tok-className"},{tag:O.macroName,class:"tok-macroName"},{tag:O.propertyName,class:"tok-propertyName"},{tag:O.operator,class:"tok-operator"},{tag:O.comment,class:"tok-comment"},{tag:O.meta,class:"tok-meta"},{tag:O.invalid,class:"tok-invalid"},{tag:O.punctuation,class:"tok-punctuation"}]);var er;const Lt=new L;function Jc(n){return A.define({combine:n?e=>e.concat(n):void 0})}const sg=new L;class $e{constructor(e,t,i=[],s=""){this.data=e,this.name=s,I.prototype.hasOwnProperty("tree")||Object.defineProperty(I.prototype,"tree",{get(){return ae(this)}}),this.parser=t,this.extension=[At.of(this),I.languageData.of((r,o,l)=>{let a=Oa(r,o,l),h=a.type.prop(Lt);if(!h)return[];let c=r.facet(h),f=a.type.prop(sg);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Oa(e,t,i).type.prop(Lt)==this.data}findRegions(e){let t=e.facet(At);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(Lt)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(L.mounted);if(l){if(l.tree.prop(Lt)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new Ui(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ae(n){let e=n.field($e.state,!1);return e?e.tree:j.empty}class rg{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let wi=null;class ui{constructor(e,t,i=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new ui(e,t,[],j.empty,0,i,[],null)}startParse(){return this.parser.startParse(new rg(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=j.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(It.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=wi;wi=this;try{return e()}finally{wi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ya(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=It.applyChanges(i,a),s=j.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=ya(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Lo{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=wi;if(a){for(let h of s)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new j(ve.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return wi}}function ya(n,e,t){return It.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class di{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new di(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=ui.create(e.facet(At).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new di(i)}}$e.state=he.define({create:di.init,update(n,e){for(let t of e.effects)if(t.is($e.setState))return t.value;return e.startState.facet(At)!=e.state.facet(At)?di.init(e.state):n.apply(e)}});let ef=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ef=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const tr=typeof navigator<"u"&&(!((er=navigator.scheduling)===null||er===void 0)&&er.isInputPending)?()=>navigator.scheduling.isInputPending():null,og=J.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field($e.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field($e.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=ef(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>tr&&tr()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:$e.setState.of(new di(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Pe(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),At=A.define({combine(n){return n.length?n[0]:null},enables:n=>[$e.state,og,P.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class tf{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const lg=A.define(),cn=A.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Ut(n){let e=n.facet(cn);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Hi(n,e){let t="",i=n.tabSize,s=n.facet(cn)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=e?ag(n,t,e):null}class As{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ut(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return gi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ms=new L;function ag(n,e,t){let i=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o&&!(o.fromi.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return nf(i,n,t)}function nf(n,e,t){for(let i=n;i;i=i.next){let s=cg(i.node);if(s)return s(Vo.create(e,t,i))}return 0}function hg(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function cg(n){let e=n.type.prop(Ms);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(L.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>sf(o,!0,1,void 0,r&&!hg(o)?s.from:void 0)}return n.parent==null?fg:null}function fg(){return 0}class Vo extends As{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Vo(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(ug(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return nf(this.context.next,this.base,this.pos)}}function ug(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function dg(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function ir({closing:n,align:e=!0,units:t=1}){return i=>sf(i,e,t,n)}function sf(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,a=e?dg(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}function ba({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const pg=200;function mg(){return I.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+pg)return n;let r=t.sliceString(s.from,i);if(!e.some(h=>h.test(r)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=Io(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],d=Hi(o,f);u!=d&&a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const gg=A.define(),No=new L;function rf(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(r&&l.from=e&&h.to>t&&(r=h)}}return r}function yg(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function us(n,e,t){for(let i of n.facet(gg)){let s=i(n,e,t);if(s)return s}return Og(n,e,t)}function of(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Rs=q.define({map:of}),fn=q.define({map:of});function lf(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const Ht=he.define({create(){return R.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,i)=>n=Sa(n,t,i)),n=n.map(e.changes);for(let t of e.effects)if(t.is(Rs)&&!bg(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(cf),s=i?R.replace({widget:new Cg(i(e.state,t.value))}):xa;n=n.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(fn)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=Sa(n,e.selection.main.head)),n},provide:n=>P.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{se&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(s,r)=>s>=t||r<=e}):n}function ds(n,e,t){var i;let s=null;return(i=n.field(Ht,!1))===null||i===void 0||i.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function bg(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function af(n,e){return n.field(Ht,!1)?e:e.concat(q.appendConfig.of(ff()))}const Sg=n=>{for(let e of lf(n)){let t=us(n.state,e.from,e.to);if(t)return n.dispatch({effects:af(n.state,[Rs.of(t),hf(n,t)])}),!0}return!1},xg=n=>{if(!n.state.field(Ht,!1))return!1;let e=[];for(let t of lf(n)){let i=ds(n.state,t.from,t.to);i&&e.push(fn.of(i),hf(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function hf(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return P.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const kg=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(Ht,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(fn.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},vg=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Sg},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:xg},{key:"Ctrl-Alt-[",run:kg},{key:"Ctrl-Alt-]",run:wg}],Tg={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},cf=A.define({combine(n){return rt(n,Tg)}});function ff(n){return[Ht,Ag]}function uf(n,e){let{state:t}=n,i=t.facet(cf),s=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=ds(n.state,l.from,l.to);a&&n.dispatch({effects:fn.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,s,e);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const xa=R.replace({widget:new class extends ot{toDOM(n){return uf(n,null)}}});class Cg extends ot{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return uf(e,this.value)}}const Pg={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class nr extends yt{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Qg(n={}){let e={...Pg,...n},t=new nr(e,!0),i=new nr(e,!1),s=J.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(At)!=o.state.facet(At)||o.startState.field(Ht,!1)!=o.state.field(Ht,!1)||ae(o.startState)!=ae(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new gt;for(let a of o.viewportLineBlocks){let h=ds(o.state,a.from,a.to)?i:us(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:r}=e;return[s,Rm({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||N.empty},initialSpacer(){return new nr(e,!1)},domEventHandlers:{...r,click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let h=ds(o.state,l.from,l.to);if(h)return o.dispatch({effects:fn.of(h)}),!0;let c=us(o.state,l.from,l.to);return c?(o.dispatch({effects:Rs.of(c)}),!0):!1}}}),ff()]}const Ag=P.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class un{constructor(e,t){this.specs=e;let i;function s(l){let a=Tt.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof $e?l=>l.prop(Lt)==o.data:o?l=>l==o:void 0,this.style=Kc(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new Tt(i):null,this.themeType=t.themeType}static define(e,t){return new un(e,t||{})}}const ao=A.define(),df=A.define({combine(n){return n.length?[n[0]]:null}});function sr(n){let e=n.facet(ao);return e.length?e:n.facet(df)}function pf(n,e){let t=[Rg],i;return n instanceof un&&(n.module&&t.push(P.styleModule.of(n.module)),i=n.themeType),e?.fallback?t.push(df.of(n)):i?t.push(ao.computeN([P.darkTheme],s=>s.facet(P.darkTheme)==(i=="dark")?[n]:[])):t.push(ao.of(n)),t}class Mg{constructor(e){this.markCache=Object.create(null),this.tree=ae(e.state),this.decorations=this.buildDeco(e,sr(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=ae(e.state),i=sr(e.state),s=i!=sr(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return R.none;let i=new gt;for(let{from:s,to:r}of e.visibleRanges)tg(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=R.mark({class:a})))},s,r);return i.finish()}}const Rg=Mt.high(J.fromClass(Mg,{decorations:n=>n.decorations})),Dg=un.define([{tag:O.meta,color:"#404740"},{tag:O.link,textDecoration:"underline"},{tag:O.heading,textDecoration:"underline",fontWeight:"bold"},{tag:O.emphasis,fontStyle:"italic"},{tag:O.strong,fontWeight:"bold"},{tag:O.strikethrough,textDecoration:"line-through"},{tag:O.keyword,color:"#708"},{tag:[O.atom,O.bool,O.url,O.contentSeparator,O.labelName],color:"#219"},{tag:[O.literal,O.inserted],color:"#164"},{tag:[O.string,O.deleted],color:"#a11"},{tag:[O.regexp,O.escape,O.special(O.string)],color:"#e40"},{tag:O.definition(O.variableName),color:"#00f"},{tag:O.local(O.variableName),color:"#30a"},{tag:[O.typeName,O.namespace],color:"#085"},{tag:O.className,color:"#167"},{tag:[O.special(O.variableName),O.macroName],color:"#256"},{tag:O.definition(O.propertyName),color:"#00c"},{tag:O.comment,color:"#940"},{tag:O.invalid,color:"#f00"}]),Eg=P.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),mf=1e4,gf="()[]{}",Of=A.define({combine(n){return rt(n,{afterCursor:!0,brackets:gf,maxScanDistance:mf,renderMatch:Bg})}}),qg=R.mark({class:"cm-matchingBracket"}),$g=R.mark({class:"cm-nonmatchingBracket"});function Bg(n){let e=[],t=n.matched?qg:$g;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const Wg=he.define({create(){return R.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(Of);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=et(e.state,s.head,-1,i)||s.head>0&&et(e.state,s.head-1,1,i)||i.afterCursor&&(et(e.state,s.head,1,i)||s.headP.decorations.from(n)}),Lg=[Wg,Eg];function zg(n={}){return[Of.of(n),Lg]}const Ig=new L;function ho(n,e,t){let i=n.prop(e<0?L.openedBy:L.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function co(n){let e=n.type.prop(Ig);return e?e(n.node):n}function et(n,e,t,i={}){let s=i.maxScanDistance||mf,r=i.brackets||gf,o=ae(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=ho(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return Vg(n,e,t,a,c,h,r)}}return Ng(n,e,t,o,l.type,s,r)}function Vg(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to},h=0,c=l?.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let m=t>0?0:d.length-1,g=t>0?d.length:-1;m!=g;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}function ka(n,e,t,i=0,s=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=s;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosi?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Xg(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||Fg,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||Fo,mergeTokens:n.mergeTokens!==!1}}function Fg(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}const wa=new WeakMap;class bf extends $e{constructor(e){let t=Jc(e.languageData),i=Xg(e),s,r=new class extends Lo{createParse(o,l,a){return new Ug(s,o,l,a)}};super(t,r,[],e.name),this.topNode=Gg(t,this),s=this,this.streamParser=i,this.stateAfter=new L({perNode:!0}),this.tokenTable=e.tokenTable?new wf(i.tokenTable):jg}static define(e){return new bf(e)}getIndent(e){let t,{overrideIndentation:i}=e.options;i&&(t=wa.get(e.state),t!=null&&t1e4)return null;for(;r=i&&t+e.length<=s&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],h=l instanceof j&&a=e.length)return e;!s&&t==0&&e.type==n.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],a;if(ot&&Xo(n,r.tree,0-r.offset,t,l),h;if(a&&a.pos<=i&&(h=Sf(n,r.tree,t+r.offset,a.pos+r.offset,!1)))return{state:a.state,tree:h}}return{state:n.streamParser.startState(s?Ut(s):4),tree:j.empty}}let Ug=class{constructor(e,t,i,s){this.lang=e,this.input=t,this.fragments=i,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=ui.get(),o=s[0].from,{state:l,tree:a}=_g(e,i,o,this.to,r?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;hh.from<=r.viewport.from&&h.to>=r.viewport.from)&&(this.state=this.lang.streamParser.startState(Ut(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let e=ui.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(t,this.chunkStart+512);for(e&&(i=Math.min(i,e.viewport.to));this.parsedPos=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` `&&(t="");else{let i=t.indexOf(` -`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(t,s,1),t+=s;let l=this.chunk.length;s=this.skipGapsTo(i,s,-1),i+=s,r+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&r==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=i:this.chunk.push(e,t,i,r),s}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new Of(t,e?e.state.tabSize:4,e?Ut(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=Sf(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Xo=Object.create(null),ji=[ve.none],Hg=new Qs(ji),wa=[],va=Object.create(null),xf=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])xf[n]=wf(Xo,e);class kf{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),xf)}resolve(e){return e?this.table[e]||(this.table[e]=wf(this.extra,e)):0}}const jg=new kf(Xo);function rr(n,e){wa.indexOf(n)>-1||(wa.push(n),console.warn(e))}function wf(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||O[h];c?typeof c=="function"?a.length?a=a.map(c):rr(h,`Modifier ${h} used at start of tag`):a.length?rr(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:rr(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id),r=va[s];if(r)return r.id;let o=va[s]=ve.define({id:ji.length,name:i,props:[Lo({[i]:t})]});return ji.push(o),o.id}function Gg(n,e){let t=ve.define({id:ji.length,name:"Document",props:[Lt.add(()=>n),Ms.add(()=>i=>e.getIndent(i))],top:!0});return ji.push(t),t}Z.RTL,Z.LTR;const Zg=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=_o(n.state,t.from);return i.line?Yg(n):i.block?Jg(n):!1};function Fo(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const Yg=Fo(iO,0),Kg=Fo(vf,0),Jg=Fo((n,e)=>vf(n,e,tO(e)),0);function _o(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const vi=50;function eO(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-vi,i),o=n.sliceDoc(s,s+vi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let c,f;s-i<=2*vi?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+vi),f=n.sliceDoc(s-vi,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function tO(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to);s.from>i.from&&s.from==t.to&&(s=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function vf(n,e,t=e.selection.ranges){let i=t.map(r=>_o(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>eO(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>f.from)){s=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,p=f.text.slice(u,u+h.length)==h?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}const co=st.define(),nO=st.define(),sO=A.define(),Tf=A.define({combine(n){return rt(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}}),Cf=he.define({create(){return tt.empty},update(n,e){let t=e.state.facet(Tf),i=e.annotation(co);if(i){let a=Qe.fromTransaction(e,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=ps(c,c.length,t.minDepth,a):c=Af(c,e.startState.selection),new tt(h==0?i.rest:c,h==0?c:i.rest)}let s=e.annotation(nO);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(ie.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=Qe.fromTransaction(e),o=e.annotation(ie.time),l=e.annotation(ie.userEvent);return r?n=n.addChanges(r,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new tt(n.done.map(Qe.fromJSON),n.undone.map(Qe.fromJSON))}});function rO(n={}){return[Cf,Tf.of(n),P.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Pf:e.inputType=="historyRedo"?fo:null;return i?(e.preventDefault(),i(t)):!1}})]}function Ds(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(Cf,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const Pf=Ds(0,!1),fo=Ds(1,!1),oO=Ds(0,!0),lO=Ds(1,!0);class Qe{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new Qe(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Qe(e.changes&&se.fromJSON(e.changes),[],e.mapped&&it.fromJSON(e.mapped),e.startSelection&&b.fromJSON(e.startSelection),e.selectionsAfter.map(b.fromJSON))}static fromTransaction(e,t){let i=Be;for(let s of e.startState.facet(sO)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new Qe(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Be)}static selection(e){return new Qe(void 0,Be,void 0,void 0,e)}}function ps(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function aO(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function hO(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Qf(n,e){return n.length?e.length?n.concat(e):n:e}const Be=[],cO=200;function Af(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-cO));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),ps(n,n.length-1,1e9,t.setSelAfter(i)))}else return[Qe.selection([e])]}function fO(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function or(n,e){if(!n.length)return n;let t=n.length,i=Be;for(;t;){let s=uO(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[Qe.selection(i)]:Be}function uO(n,e,t){let i=Qf(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Be,t);if(!n.changes)return Qe.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new Qe(s,q.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const dO=/^(input\.type|delete)($|\.)/;class tt{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new tt(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||dO.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):Es(t,e))}function be(n){return n.textDirectionAt(n.state.selection.main.head)==Z.LTR}const Rf=n=>Mf(n,!be(n)),Df=n=>Mf(n,be(n));function Ef(n,e){return Fe(n,t=>t.empty?n.moveByGroup(t,e):Es(t,e))}const mO=n=>Ef(n,!be(n)),gO=n=>Ef(n,be(n));function OO(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function qs(n,e,t){let i=ae(n).resolveInner(e.head),s=t?L.closedBy:L.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;OO(n,h,s)?i=h:a=t?h.to:h.from}let r=i.type.prop(s),o,l;return r&&(o=t?et(n,i.from,1):et(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,b.cursor(l,t?-1:1)}const yO=n=>Fe(n,e=>qs(n.state,e,!be(n))),bO=n=>Fe(n,e=>qs(n.state,e,be(n)));function qf(n,e){return Fe(n,t=>{if(!t.empty)return Es(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const $f=n=>qf(n,!1),Bf=n=>qf(n,!0);function Wf(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):Es(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomLf(n,!1),uo=n=>Lf(n,!0);function Rt(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=b.cursor(i.from+r))}return s}const SO=n=>Fe(n,e=>Rt(n,e,!0)),xO=n=>Fe(n,e=>Rt(n,e,!1)),kO=n=>Fe(n,e=>Rt(n,e,!be(n))),wO=n=>Fe(n,e=>Rt(n,e,be(n))),vO=n=>Fe(n,e=>b.cursor(n.lineBlockAt(e.head).from,1)),TO=n=>Fe(n,e=>b.cursor(n.lineBlockAt(e.head).to,-1));function CO(n,e,t){let i=!1,s=Oi(n.selection,r=>{let o=et(n,r.head,-1)||et(n,r.head,1)||r.head>0&&et(n,r.head-1,1)||r.headCO(n,e);function Ie(n,e){let t=Oi(n.state.selection,i=>{let s=e(i);return b.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Xe(n.state,t)),!0)}function zf(n,e){return Ie(n,t=>n.moveByChar(t,e))}const If=n=>zf(n,!be(n)),Vf=n=>zf(n,be(n));function Nf(n,e){return Ie(n,t=>n.moveByGroup(t,e))}const QO=n=>Nf(n,!be(n)),AO=n=>Nf(n,be(n)),MO=n=>Ie(n,e=>qs(n.state,e,!be(n))),RO=n=>Ie(n,e=>qs(n.state,e,be(n)));function Xf(n,e){return Ie(n,t=>n.moveVertically(t,e))}const Ff=n=>Xf(n,!1),_f=n=>Xf(n,!0);function Uf(n,e){return Ie(n,t=>n.moveVertically(t,e,Wf(n).height))}const Ca=n=>Uf(n,!1),Pa=n=>Uf(n,!0),DO=n=>Ie(n,e=>Rt(n,e,!0)),EO=n=>Ie(n,e=>Rt(n,e,!1)),qO=n=>Ie(n,e=>Rt(n,e,!be(n))),$O=n=>Ie(n,e=>Rt(n,e,be(n))),BO=n=>Ie(n,e=>b.cursor(n.lineBlockAt(e.head).from)),WO=n=>Ie(n,e=>b.cursor(n.lineBlockAt(e.head).to)),Qa=({state:n,dispatch:e})=>(e(Xe(n,{anchor:0})),!0),Aa=({state:n,dispatch:e})=>(e(Xe(n,{anchor:n.doc.length})),!0),Ma=({state:n,dispatch:e})=>(e(Xe(n,{anchor:n.selection.main.anchor,head:0})),!0),Ra=({state:n,dispatch:e})=>(e(Xe(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),LO=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),zO=({state:n,dispatch:e})=>{let t=$s(n).map(({from:i,to:s})=>b.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:b.create(t),userEvent:"select"})),!0},IO=({state:n,dispatch:e})=>{let t=Oi(n.selection,i=>{let s=ae(n),r=s.resolveStack(i.from,1);if(i.empty){let o=s.resolveStack(i.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return b.range(l.to,l.from)}return i});return t.eq(n.selection)?!1:(e(Xe(n,t)),!0)};function Hf(n,e){let{state:t}=n,i=t.selection,s=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to0)for(let l=r;;){let a=n.moveVertically(l,e);if(a.heado.to){s.some(h=>h.head==a.head)||s.push(a);break}else{if(a.head==l.head)break;l=a}}}return s.length==i.ranges.length?!1:(n.dispatch(Xe(t,b.create(s,s.length-1))),!0)}const VO=n=>Hf(n,!1),NO=n=>Hf(n,!0),XO=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=b.create([t.main]):t.main.empty||(i=b.create([b.cursor(t.main.head)])),i?(e(Xe(n,i)),!0):!1};function dn(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=Bn(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Bn(n,o,!1),l=Bn(n,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:b.cursor(o,os(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const jf=(n,e,t)=>dn(n,i=>{let s=i.from,{state:r}=n,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&sjf(n,!1,!0),Gf=n=>jf(n,!0,!1),Zf=(n,e)=>dn(n,t=>{let i=t.head,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let a=pe(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),Yf=n=>Zf(n,!1),FO=n=>Zf(n,!0),_O=n=>dn(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headdn(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),HO=n=>dn(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:V.of(["",""])},range:b.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},GO=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:pe(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:pe(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:b.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function $s(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function Kf(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of $s(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let a of r.ranges)s.push(b.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let a of r.ranges)s.push(b.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:b.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const ZO=({state:n,dispatch:e})=>Kf(n,e,!1),YO=({state:n,dispatch:e})=>Kf(n,e,!0);function Jf(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of $s(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});return e(n.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const KO=({state:n,dispatch:e})=>Jf(n,e,!1),JO=({state:n,dispatch:e})=>Jf(n,e,!0),e0=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes($s(e).map(({from:s,to:r})=>(s>0?s--:r{let r;if(n.lineWrapping){let o=n.lineBlockAt(s.head),l=n.coordsAtPos(s.head,s.assoc||1);l&&(r=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(s,!0,r)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function t0(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=ae(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(L.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from&&!/\S/.test(n.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}const Da=eu(!1),i0=eu(!0);function eu(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),a=!n&&r==o&&t0(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new As(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=zo(h,r);for(c==null&&(c=gi(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:b.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const n0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new As(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=Uo(n,(r,o,l)=>{let a=zo(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=Hi(n,a);(h!=c||l.fromn.readOnly?!1:(e(n.update(Uo(n,(t,i)=>{i.push({from:t.from,insert:n.facet(cn)})}),{userEvent:"input.indent"})),!0),iu=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Uo(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=gi(s,n.tabSize),o=0,l=Hi(n,Math.max(0,r-Ut(n)));for(;o(n.setTabFocusMode(),!0),r0=[{key:"Ctrl-b",run:Rf,shift:If,preventDefault:!0},{key:"Ctrl-f",run:Df,shift:Vf},{key:"Ctrl-p",run:$f,shift:Ff},{key:"Ctrl-n",run:Bf,shift:_f},{key:"Ctrl-a",run:vO,shift:BO},{key:"Ctrl-e",run:TO,shift:WO},{key:"Ctrl-d",run:Gf},{key:"Ctrl-h",run:po},{key:"Ctrl-k",run:_O},{key:"Ctrl-Alt-h",run:Yf},{key:"Ctrl-o",run:jO},{key:"Ctrl-t",run:GO},{key:"Ctrl-v",run:uo}],o0=[{key:"ArrowLeft",run:Rf,shift:If,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mO,shift:QO,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:kO,shift:qO,preventDefault:!0},{key:"ArrowRight",run:Df,shift:Vf,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:gO,shift:AO,preventDefault:!0},{mac:"Cmd-ArrowRight",run:wO,shift:$O,preventDefault:!0},{key:"ArrowUp",run:$f,shift:Ff,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Qa,shift:Ma},{mac:"Ctrl-ArrowUp",run:Ta,shift:Ca},{key:"ArrowDown",run:Bf,shift:_f,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Aa,shift:Ra},{mac:"Ctrl-ArrowDown",run:uo,shift:Pa},{key:"PageUp",run:Ta,shift:Ca},{key:"PageDown",run:uo,shift:Pa},{key:"Home",run:xO,shift:EO,preventDefault:!0},{key:"Mod-Home",run:Qa,shift:Ma},{key:"End",run:SO,shift:DO,preventDefault:!0},{key:"Mod-End",run:Aa,shift:Ra},{key:"Enter",run:Da,shift:Da},{key:"Mod-a",run:LO},{key:"Backspace",run:po,shift:po,preventDefault:!0},{key:"Delete",run:Gf,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Yf,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:FO,preventDefault:!0},{mac:"Mod-Backspace",run:UO,preventDefault:!0},{mac:"Mod-Delete",run:HO,preventDefault:!0}].concat(r0.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),l0=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:yO,shift:MO},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:bO,shift:RO},{key:"Alt-ArrowUp",run:ZO},{key:"Shift-Alt-ArrowUp",run:KO},{key:"Alt-ArrowDown",run:YO},{key:"Shift-Alt-ArrowDown",run:JO},{key:"Mod-Alt-ArrowUp",run:VO},{key:"Mod-Alt-ArrowDown",run:NO},{key:"Escape",run:XO},{key:"Mod-Enter",run:i0},{key:"Alt-l",mac:"Ctrl-l",run:zO},{key:"Mod-i",run:IO,preventDefault:!0},{key:"Mod-[",run:iu},{key:"Mod-]",run:tu},{key:"Mod-Alt-\\",run:n0},{key:"Shift-Mod-k",run:e0},{key:"Shift-Mod-\\",run:PO},{key:"Mod-/",run:Zg},{key:"Alt-A",run:Kg},{key:"Ctrl-m",mac:"Shift-Alt-m",run:s0}].concat(o0),a0={key:"Tab",run:tu,shift:iu},Ea=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class pi{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(Ea(l)):Ea,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Te(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=bo(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Ye(e);let s=this.normalize(t);if(s.length)for(let r=0,o=i;;r++){let l=s.charCodeAt(r),a=this.match(l,o,this.bufferPos+this.bufferStart);if(r==s.length-1){if(a)return this.value=a,this;break}o==i&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=ms(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new si(t,e.sliceString(t,i));return lr.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this.matchPos=ms(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=si.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(su.prototype[Symbol.iterator]=ru.prototype[Symbol.iterator]=function(){return this});function h0(n){try{return new RegExp(n,Ho),!0}catch{return!1}}function ms(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function mo(n){let e=String(n.state.doc.lineAt(n.state.selection.main.head).number),t=U("input",{class:"cm-textfield",name:"line",value:e}),i=U("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),n.dispatch({effects:$i.of(!1)}),n.focus()):r.keyCode==13&&(r.preventDefault(),s())},onsubmit:r=>{r.preventDefault(),s()}},U("label",n.state.phrase("Go to line"),": ",t)," ",U("button",{class:"cm-button",type:"submit"},n.state.phrase("go")),U("button",{name:"close",onclick:()=>{n.dispatch({effects:$i.of(!1)}),n.focus()},"aria-label":n.state.phrase("close"),type:"button"},["×"]));function s(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=n,l=o.doc.lineAt(o.selection.main.head),[,a,h,c,f]=r,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),m=b.cursor(p.from+Math.max(0,Math.min(u,p.length)));n.dispatch({effects:[$i.of(!1),P.scrollIntoView(m.from,{y:"center"})],selection:m}),n.focus()}return{dom:i}}const $i=q.define(),qa=he.define({create(){return!0},update(n,e){for(let t of e.effects)t.is($i)&&(n=t.value);return n},provide:n=>Xi.from(n,e=>e?mo:null)}),c0=n=>{let e=Ni(n,mo);if(!e){let t=[$i.of(!0)];n.state.field(qa,!1)==null&&t.push(q.appendConfig.of([qa,f0])),n.dispatch({effects:t}),e=Ni(n,mo)}return e&&e.dom.querySelector("input").select(),!0},f0=P.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),u0={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},d0=A.define({combine(n){return rt(n,u0,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function p0(n){return[b0,y0]}const m0=R.mark({class:"cm-selectionMatch"}),g0=R.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function $a(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=Y.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=Y.Word)}function O0(n,e,t,i){return n(e.sliceDoc(t,t+1))==Y.Word&&n(e.sliceDoc(i-1,i))==Y.Word}const y0=J.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(d0),{state:t}=n,i=t.selection;if(i.ranges.length>1)return R.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return R.none;let a=t.wordAt(s.head);if(!a)return R.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a200)return R.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!($a(o,t,s.from,s.to)&&O0(o,t,s.from,s.to)))return R.none}else if(r=t.sliceDoc(s.from,s.to),!r)return R.none}let l=[];for(let a of n.visibleRanges){let h=new pi(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||$a(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(g0.range(c,f)):(c>=s.to||f<=s.from)&&l.push(m0.range(c,f)),l.length>e.maxMatches))return R.none}}return R.set(l)}},{decorations:n=>n.decorations}),b0=P.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),S0=({state:n,dispatch:e})=>{let{selection:t}=n,i=b.create(t.ranges.map(s=>n.wordAt(s.head)||b.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function x0(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new pi(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new pi(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const k0=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return S0({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=x0(n,i);return s?(e(n.update({selection:n.selection.addRange(b.range(s.from,s.to),!1),effects:P.scrollIntoView(s.to)})),!0):!1},yi=A.define({combine(n){return rt(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new q0(e),scrollToMatch:e=>P.scrollIntoView(e)})}});class ou{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||h0(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` -`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new C0(this):new v0(this)}getCursor(e,t=0,i){let s=e.doc?e:I.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?Yt(this,s,t,i):Zt(this,s,t,i)}}class lu{constructor(e){this.spec=e}}function Zt(n,e,t,i){return new pi(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),n.wholeWord?w0(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function w0(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Zt(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Yt(n,e,t,i){return new su(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?T0(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function gs(n,e){return n.slice(pe(n,e,!1),e)}function Os(n,e){return n.slice(e,pe(n,e))}function T0(n){return(e,t,i)=>!i[0].length||(n(gs(i.input,i.index))!=Y.Word||n(Os(i.input,i.index))!=Y.Word)&&(n(Os(i.input,i.index+i[0].length))!=Y.Word||n(gs(i.input,i.index+i[0].length))!=Y.Word)}class C0 extends lu{nextMatch(e,t,i){let s=Yt(this.spec,e,i,e.doc.length).next();return s.done&&(s=Yt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Yt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let r=+i.slice(0,s);if(r>0&&r=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Yt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Gi=q.define(),jo=q.define(),vt=he.define({create(n){return new ar(go(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Gi)?n=new ar(t.value.create(),n.panel):t.is(jo)&&(n=new ar(n.query,t.value?Go:null));return n},provide:n=>Xi.from(n,e=>e.panel)});class ar{constructor(e,t){this.query=e,this.panel=t}}const P0=R.mark({class:"cm-searchMatch"}),Q0=R.mark({class:"cm-searchMatch cm-searchMatch-selected"}),A0=J.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(vt))}update(n){let e=n.state.field(vt);(e!=n.startState.field(vt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return R.none;let{view:t}=this,i=new gt;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-500;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?Q0:P0)})}return i.finish()}},{decorations:n=>n.decorations});function pn(n){return e=>{let t=e.state.field(vt,!1);return t&&t.query.spec.valid?n(e,t):cu(e)}}const ys=pn((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=b.single(i.from,i.to),r=n.state.facet(yi);return n.dispatch({selection:s,effects:[Zo(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),hu(n),!0}),bs=pn((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=b.single(s.from,s.to),o=n.state.facet(yi);return n.dispatch({selection:r,effects:[Zo(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),hu(n),!0}),M0=pn((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:b.create(t.map(i=>b.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),R0=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new pi(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(b.range(l.value.from,l.value.to))}return e(n.update({selection:b.create(r,o),userEvent:"select.search.matches"})),!0},Ba=pn((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=r,l=[],a,h,c=[];o.from==i&&o.to==s&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(P.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+".")));let f=n.state.changes(l);return o&&(a=b.single(o.from,o.to).map(f),c.push(Zo(n,o)),c.push(t.facet(yi).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),D0=pn((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:P.announce.of(i),userEvent:"input.replace.all"}),!0});function Go(n){return n.state.facet(yi).createPanel(n)}function go(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(yi);return new ou({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function au(n){let e=Ni(n,Go);return e&&e.dom.querySelector("[main-field]")}function hu(n){let e=au(n);e&&e==n.root.activeElement&&e.select()}const cu=n=>{let e=n.state.field(vt,!1);if(e&&e.panel){let t=au(n);if(t&&t!=n.root.activeElement){let i=go(n.state,e.query.spec);i.valid&&n.dispatch({effects:Gi.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[jo.of(!0),e?Gi.of(go(n.state,e.query.spec)):q.appendConfig.of(B0)]});return!0},fu=n=>{let e=n.state.field(vt,!1);if(!e||!e.panel)return!1;let t=Ni(n,Go);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:jo.of(!1)}),!0},E0=[{key:"Mod-f",run:cu,scope:"editor search-panel"},{key:"F3",run:ys,shift:bs,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ys,shift:bs,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:fu,scope:"editor search-panel"},{key:"Mod-Shift-l",run:R0},{key:"Mod-Alt-g",run:c0},{key:"Mod-d",run:k0,preventDefault:!0}];class q0{constructor(e){this.view=e;let t=this.query=e.state.field(vt).query.spec;this.commit=this.commit.bind(this),this.searchField=U("input",{value:t.search,placeholder:Me(e,"Find"),"aria-label":Me(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=U("input",{value:t.replace,placeholder:Me(e,"Replace"),"aria-label":Me(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=U("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=U("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=U("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return U("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=U("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>ys(e),[Me(e,"next")]),i("prev",()=>bs(e),[Me(e,"previous")]),i("select",()=>M0(e),[Me(e,"all")]),U("label",null,[this.caseField,Me(e,"match case")]),U("label",null,[this.reField,Me(e,"regexp")]),U("label",null,[this.wordField,Me(e,"by word")]),...e.state.readOnly?[]:[U("br"),this.replaceField,i("replace",()=>Ba(e),[Me(e,"replace")]),i("replaceAll",()=>D0(e),[Me(e,"replace all")])],U("button",{name:"close",onclick:()=>fu(e),"aria-label":Me(e,"close"),type:"button"},["×"])])}commit(){let e=new ou({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Gi.of(e)}))}keydown(e){zp(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?bs:ys)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Ba(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Gi)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(yi).top}}function Me(n,e){return n.state.phrase(e)}const Wn=30,Ln=/[\s\.,:;?!]/;function Zo(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Wn),o=Math.min(s,t+Wn),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-Wn;a--)if(!Ln.test(l[a-1])&&Ln.test(l[a])){l=l.slice(0,a);break}}return P.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const $0=P.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),B0=[vt,Mt.low(A0),$0];class uu{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=ae(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(pu(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function Wa(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function W0(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:W0(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function L0(n,e){return t=>{for(let i=ae(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class La{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function Vt(n){return n.selection.main.from}function pu(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const Yo=st.define();function z0(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return{...n.changeByRange(l=>{if(l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:a},range:b.cursor(l.from+r+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const za=new WeakMap;function I0(n){if(!Array.isArray(n))return n;let e=za.get(n);return e||za.set(n,e=du(n)),e}const Ss=q.define(),Zi=q.define();class V0{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(v=bo(k))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!S||T==1&&g||w==0&&T!=0)&&(t[f]==k||i[f]==k&&(u=!0)?o[f++]=S:o.length&&(y=!1)),w=T,S+=Ye(k)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?Ye(Te(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}}class N0{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:X0,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>Ia(e(i),t(i)),optionClass:(e,t)=>i=>Ia(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Ia(n,e){return n?e?n+" "+e:n:e}function X0(n,e,t,i,s,r){let o=n.textDirection==Z.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||S>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function F0(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function hr(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class _0{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(le);this.optionContent=F0(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=hr(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(le).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Zi.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=hr(r.length,o,e.state.facet(le).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=hr(t.options.length,t.selected,this.view.state.facet(le).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>Pe(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&H0(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom{o.target==s&&o.preventDefault()});let r=null;for(let o=i.from;oi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew _0(t,n,e)}function H0(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function Va(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function j0(n,e){let t=[],i=null,s=null,r=c=>{t.push(c);let{section:f}=c.completion;if(f){i||(i=[]);let u=typeof f=="string"?f:f.name;i.some(d=>d.name==u)||i.push(typeof f=="string"?{name:u}:f)}},o=e.facet(le);for(let c of n)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)r(new La(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new N0(u):new V0(u);for(let m of c.result.options)if(d=p.match(m.label)){let g=m.displayLabel?f?f(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(r(new La(m,c.source,g,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:S}=m.section;s||(s=Object.create(null)),s[S]=Math.max(y,s[S]||-1e9)}}}}if(i){let c=Object.create(null),f=0,u=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.nameu.score-f.score||h(f.completion,u.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):Va(c.completion)>Va(a)&&(l[l.length-1]=c),a=c.completion}return l}class ei{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ei(this.options,Na(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r,o){if(s&&!o&&e.some(h=>h.isPending))return s.setDisabled();let l=j0(e,t);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let a=t.facet(le).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(h,c.from):h,1e8),create:ey,above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new ei(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ei(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class xs{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new xs(K0,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(le),r=(i.override||t.languageDataAt("autocomplete",Vt(t)).map(I0)).map(a=>(this.active.find(c=>c.source==a)||new We(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,h)=>a==this.active[h])&&(r=this.active);let o=this.open,l=e.effects.some(a=>a.is(Ko));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!G0(r,this.active)||l?o=ei.build(r,t,this.id,o,i,l):o&&o.disabled&&!r.some(a=>a.isPending)&&(o=null),!o&&r.every(a=>!a.isPending)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new We(a.source,0):a));for(let a of e.effects)a.is(gu)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new xs(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Z0:Y0}}function G0(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const K0=[];function mu(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(Yo);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class We{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=mu(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new We(s.source,0)),i&4&&s.state==0&&(s=new We(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(Ss))s=new We(s.source,1,r.value);else if(r.is(Zi))s=new We(s.source,0);else if(r.is(Ko))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Vt(e.state))}}class ri extends We{constructor(e,t,i,s,r,o){super(e,3,t),this.limit=i,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Vt(e.state);if(l>o||!s||t&2&&(Vt(e.startState)==this.from||lt.map(e))}}),gu=q.define(),Ce=he.define({create(){return xs.start()},update(n,e){return n.update(e)},provide:n=>[Eo.from(n,e=>e.tooltip),P.contentAttributes.from(n,e=>e.attrs)]});function Jo(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Ce).active.find(s=>s.source==e.source);return i instanceof ri?(typeof t=="string"?n.dispatch({...z0(n.state,t,i.from,i.to),annotations:Yo.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const ey=U0(Ce,Jo);function zn(n,e="option"){return t=>{let i=t.state.field(Ce,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:gu.of(l)}),!0}}const ty=n=>{let e=n.state.field(Ce,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(Ce,!1)?(n.dispatch({effects:Ss.of(!0)}),!0):!1,iy=n=>{let e=n.state.field(Ce,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Zi.of(null)}),!0)};class ny{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const sy=50,ry=1e3,oy=J.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(Ce).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Ce),t=n.state.facet(le);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Ce)==e)return;let i=n.transactions.some(r=>{let o=mu(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;rsy&&Date.now()-o.time>ry){for(let l of o.context.abortListeners)try{l()}catch(a){Pe(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(Ss)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(Ce);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(le).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Vt(e),i=new uu(e,t,n.explicit,this.view),s=new ny(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:Zi.of(null)}),Pe(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(le).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(le),i=this.view.state.field(Ce);for(let s=0;sl.source==r.active.source);if(o&&o.isPending)if(r.done==null){let l=new We(r.active.source,0);for(let a of r.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:Ko.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Ce,!1);if(e&&e.tooltip&&this.view.state.facet(le).closeOnBlur){let t=e.open&&Nc(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Zi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ss.of(!1)}),20),this.composing=0}}}),ly=typeof navigator=="object"&&/Win/.test(navigator.platform),ay=Mt.highest(P.domEventHandlers({keydown(n,e){let t=e.state.field(Ce,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(ly&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&Jo(e,i),!1}})),Ou=P.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class hy{constructor(e,t,i,s){this.field=e,this.line=t,this.from=i,this.to=s}}class el{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,de.TrackDel),i=e.mapPos(this.to,1,de.TrackDel);return t==null||i==null?null:new el(this.field,t,i)}}class tl{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew el(a.field,s[a.line]+a.from,s[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=r[1]?+r[1]:null,a=r[2]||r[3]||"",h=-1,c=a.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=h&&u.field++}for(let f of s)if(f.line==i.length&&f.from>r.index){let u=r[2]?3+(r[1]||"").length:2;f.from-=u,f.to-=u}s.push(new hy(h,i.length,r.index,r.index+c.length)),o=o.slice(0,r.index)+a+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(l,a,h)=>{for(let c of s)c.line==i.length&&c.from>h&&(c.from--,c.to--);return a}),i.push(o)}return new tl(i,s)}}let cy=R.widget({widget:new class extends ot{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),fy=R.mark({class:"cm-snippetField"});class bi{constructor(e,t){this.ranges=e,this.active=t,this.deco=R.set(e.map(i=>(i.from==i.to?cy:fy).range(i.from,i.to)),!0)}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new bi(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const mn=q.define({map(n,e){return n&&n.map(e)}}),uy=q.define(),Yi=he.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(mn))return t.value;if(t.is(uy)&&n)return new bi(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>P.decorations.from(n,e=>e?e.deco:R.none)});function il(n,e){return b.create(n.filter(t=>t.field==e).map(t=>b.range(t.from,t.to)))}function dy(n){let e=tl.parse(n);return(t,i,s,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,s),{main:a}=t.state.selection,h={changes:{from:s,to:r==a.from?a.to:r,insert:V.of(o)},scrollIntoView:!0,annotations:i?[Yo.of(i),ie.userEvent.of("input.complete")]:void 0};if(l.length&&(h.selection=il(l,0)),l.some(c=>c.field>0)){let c=new bi(l,0),f=h.effects=[mn.of(c)];t.state.field(Yi,!1)===void 0&&f.push(q.appendConfig.of([Yi,yy,by,Ou]))}t.dispatch(t.state.update(h))}}function yu(n){return({state:e,dispatch:t})=>{let i=e.field(Yi,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return t(e.update({selection:il(i.ranges,s),effects:mn.of(r?null:new bi(i.ranges,s)),scrollIntoView:!0})),!0}}const py=({state:n,dispatch:e})=>n.field(Yi,!1)?(e(n.update({effects:mn.of(null)})),!0):!1,my=yu(1),gy=yu(-1),Oy=[{key:"Tab",run:my,shift:gy},{key:"Escape",run:py}],Xa=A.define({combine(n){return n.length?n[0]:Oy}}),yy=Mt.highest(an.compute([Xa],n=>n.facet(Xa)));function lt(n,e){return{...e,apply:dy(n)}}const by=P.domEventHandlers({mousedown(n,e){let t=e.state.field(Yi,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==t.active?!1:(e.dispatch({selection:il(t.ranges,s.field),effects:mn.of(t.ranges.some(r=>r.field>s.field)?new bi(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ki={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},zt=q.define({map(n,e){let t=e.mapPos(n,-1,de.TrackAfter);return t??void 0}}),nl=new class extends Nt{};nl.startSide=1;nl.endSide=-1;const bu=he.define({create(){return N.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(zt)&&(n=n.update({add:[nl.range(t.value,t.value+1)]}));return n}});function Sy(){return[ky,bu]}const fr="()[]{}<>«»»«[]{}";function Su(n){for(let e=0;e{if((xy?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&Ye(Te(i,0))==1||e!=s.from||t!=s.to)return!1;let r=Ty(n.state,i);return r?(n.dispatch(r),!0):!1}),wy=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=xu(n,n.selection.main.head).brackets||Ki.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=Cy(n.doc,o.head);for(let a of i)if(a==l&&Bs(n.doc,o.head)==Su(Te(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},vy=[{key:"Backspace",run:wy}];function Ty(n,e){let t=xu(n,n.selection.main.head),i=t.brackets||Ki.brackets;for(let s of i){let r=Su(Te(s,0));if(e==s)return r==s?Ay(n,s,i.indexOf(s+s+s)>-1,t):Py(n,s,r,t.before||Ki.before);if(e==r&&ku(n,n.selection.main.from))return Qy(n,s,r)}return null}function ku(n,e){let t=!1;return n.field(bu).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Bs(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Ye(Te(t,0)))}function Cy(n,e){let t=n.sliceString(e-2,e);return Ye(Te(t,0))==t.length?t:t.slice(1)}function Py(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:zt.of(o.to+e.length),range:b.range(o.anchor+e.length,o.head+e.length)};let l=Bs(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:zt.of(o.head+e.length),range:b.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Qy(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&Bs(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:b.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Ay(n,e,t,i){let s=i.stringPrefixes||Ki.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:zt.of(l.to+e.length),range:b.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=Bs(n.doc,a),c;if(h==e){if(Fa(n,a))return{changes:{insert:e+e,from:a},effects:zt.of(a+e.length),range:b.cursor(a+e.length)};if(ku(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=_a(n,a-2*e.length,s))>-1&&Fa(n,c))return{changes:{insert:e+e+e+e,from:a},effects:zt.of(a+e.length),range:b.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=Y.Word&&_a(n,a,s)>-1&&!My(n,a,e,s))return{changes:{insert:e+e,from:a},effects:zt.of(a+e.length),range:b.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Fa(n,e){let t=ae(n).resolveInner(e+1);return t.parent&&t.from==e}function My(n,e,t,i){let s=ae(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function _a(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Y.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=Y.Word)return r}return-1}function Ry(n={}){return[ay,Ce,le.of(n),oy,Dy,Ou]}const wu=[{key:"Ctrl-Space",run:cr},{mac:"Alt-`",run:cr},{mac:"Alt-i",run:cr},{key:"Escape",run:iy},{key:"ArrowDown",run:zn(!0)},{key:"ArrowUp",run:zn(!1)},{key:"PageDown",run:zn(!0,"page")},{key:"PageUp",run:zn(!1,"page")},{key:"Enter",run:ty}],Dy=Mt.highest(an.computeN([le],n=>n.facet(le).defaultKeymap?[wu]:[]));class Ua{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Bt{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(Ji).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new gt,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let p=d==r.length?null:r[d];if(!p&&!l.length)break;let m,g;if(l.length)m=a,g=l.reduce((x,w)=>Math.min(x,w.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;g=p.to,l.push(p),d++}for(;dx.from||x.to==m))l.push(x),d++,g=Math.min(x.to,g);else{g=Math.min(x.from,g);break}}g=Math.min(g,f);let y=!1;if(l.some(x=>x.from==m&&(x.to==g||g==f))&&(y=m==g,!y&&g-m<10)){let x=m-(c+h.value.length);x>0&&(h.next(x),c=m);for(let w=m;;){if(w>=g){y=!0;break}if(!h.lineBreak&&c+h.value.length>w)break;w=c+h.value.length,c+=h.value.length,h.next()}}let S=_y(l);if(y)o.add(m,m,R.widget({widget:new Vy(S),diagnostics:l.slice()}));else{let x=l.reduce((w,k)=>k.markClass?w+" "+k.markClass:w,"");o.add(m,g,R.mark({class:"cm-lintRange cm-lintRange-"+S+x,diagnostics:l.slice(),inclusiveEnd:l.some(w=>w.to>g)}))}if(a=g,a==f)break;for(let x=0;x{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new Ua(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new Ua(i.from,r,i.diagnostic)}}),i}function Ey(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(Ji).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(vu))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function qy(n,e){return n.field(Ee,!1)?e:e.concat(q.appendConfig.of(Uy))}const vu=q.define(),sl=q.define(),Tu=q.define(),Ee=he.define({create(){return new Bt(R.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=mi(t,n.selected.diagnostic,r)||mi(t,null,r)}!t.size&&s&&e.state.facet(Ji).autoPanel&&(s=null),n=new Bt(t,s,i)}for(let t of e.effects)if(t.is(vu)){let i=e.state.facet(Ji).autoPanel?t.value.length?en.open:null:n.panel;n=Bt.init(t.value,i,e.state)}else t.is(sl)?n=new Bt(n.diagnostics,t.value?en.open:null,n.selected):t.is(Tu)&&(n=new Bt(n.diagnostics,n.panel,t.value));return n},provide:n=>[Xi.from(n,e=>e.panel),P.decorations.from(n,e=>e.diagnostics)]}),$y=R.mark({class:"cm-lintRange cm-lintRange-active"});function By(n,e,t){let{diagnostics:i}=n.state.field(Ee),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(ePu(n,t,!1)))}const Ly=n=>{let e=n.state.field(Ee,!1);(!e||!e.panel)&&n.dispatch({effects:qy(n.state,[sl.of(!0)])});let t=Ni(n,en.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Ha=n=>{let e=n.state.field(Ee,!1);return!e||!e.panel?!1:(n.dispatch({effects:sl.of(!1)}),!0)},zy=n=>{let e=n.state.field(Ee,!1);if(!e)return!1;let t=n.state.selection.main,i=e.diagnostics.iter(t.to+1);return!i.value&&(i=e.diagnostics.iter(0),!i.value||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},Iy=[{key:"Mod-Shift-m",run:Ly,preventDefault:!0},{key:"F8",run:zy}],Ji=A.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...rt(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:ja,tooltipFilter:ja,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function ja(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function Cu(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Pu(n,e,t){var i;let s=t?Cu(e.actions):[];return U("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},U("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=mi(n.state.field(Ee).diagnostics,e);p&&r.apply(n,p.from,p.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),U("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return U("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&U("div",{class:"cm-diagnosticSource"},e.source))}class Vy extends ot{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return U("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Ga{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Pu(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class en{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)Ha(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=Cu(r.actions);for(let l=0;l{for(let r=0;rHa(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ee).selected;if(!e)return-1;for(let t=0;t{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;di&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ee),i=mi(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:Tu.of(i)})}static open(e){return new en(e)}}function Ny(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function In(n){return Ny(``,'width="6" height="3"')}const Xy=P.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:In("#d11")},".cm-lintRange-warning":{backgroundImage:In("orange")},".cm-lintRange-info":{backgroundImage:In("#999")},".cm-lintRange-hint":{backgroundImage:In("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function Fy(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function _y(n){let e="hint",t=1;for(let i of n){let s=Fy(i.severity);s>t&&(t=s,e=i.severity)}return e}const Uy=[Ee,P.decorations.compute([Ee],n=>{let{selected:e,panel:t}=n.field(Ee);return!e||!t||e.from==e.to?R.none:R.set([$y.range(e.from,e.to)])}),Pm(By,{hideOn:Ey}),Xy];var Za=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,i=[];e.closeBracketsKeymap!==!1&&(i=i.concat(vy)),e.defaultKeymap!==!1&&(i=i.concat(l0)),e.searchKeymap!==!1&&(i=i.concat(E0)),e.historyKeymap!==!1&&(i=i.concat(pO)),e.foldKeymap!==!1&&(i=i.concat(vg)),e.completionKeymap!==!1&&(i=i.concat(wu)),e.lintKeymap!==!1&&(i=i.concat(Iy));var s=[];return e.lineNumbers!==!1&&s.push(Lm()),e.highlightActiveLineGutter!==!1&&s.push(Vm()),e.highlightSpecialChars!==!1&&s.push(im()),e.history!==!1&&s.push(rO()),e.foldGutter!==!1&&s.push(Qg()),e.drawSelection!==!1&&s.push(_p()),e.dropCursor!==!1&&s.push(Zp()),e.allowMultipleSelections!==!1&&s.push(I.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mg()),e.syntaxHighlighting!==!1&&s.push(df(Dg,{fallback:!0})),e.bracketMatching!==!1&&s.push(zg()),e.closeBrackets!==!1&&s.push(Sy()),e.autocompletion!==!1&&s.push(Ry()),e.rectangularSelection!==!1&&s.push(gm()),t!==!1&&s.push(bm()),e.highlightActiveLine!==!1&&s.push(am()),e.highlightSelectionMatches!==!1&&s.push(p0()),e.tabSize&&typeof e.tabSize=="number"&&s.push(cn.of(" ".repeat(e.tabSize))),s.concat([an.of(i.flat())]).filter(Boolean)};const Hy="#e5c07b",Ya="#e06c75",jy="#56b6c2",Gy="#ffffff",Kn="#abb2bf",Oo="#7d8799",Zy="#61afef",Yy="#98c379",Ka="#d19a66",Ky="#c678dd",Jy="#21252b",Ja="#2c313a",eh="#282c34",ur="#353a42",e1="#3E4451",th="#528bff",t1=P.theme({"&":{color:Kn,backgroundColor:eh},".cm-content":{caretColor:th},".cm-cursor, .cm-dropCursor":{borderLeftColor:th},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e1},".cm-panels":{backgroundColor:Jy,color:Kn},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:eh,color:Oo,border:"none"},".cm-activeLineGutter":{backgroundColor:Ja},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:ur},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:ur,borderBottomColor:ur},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Ja,color:Kn}}},{dark:!0}),i1=un.define([{tag:O.keyword,color:Ky},{tag:[O.name,O.deleted,O.character,O.propertyName,O.macroName],color:Ya},{tag:[O.function(O.variableName),O.labelName],color:Zy},{tag:[O.color,O.constant(O.name),O.standard(O.name)],color:Ka},{tag:[O.definition(O.name),O.separator],color:Kn},{tag:[O.typeName,O.className,O.number,O.changed,O.annotation,O.modifier,O.self,O.namespace],color:Hy},{tag:[O.operator,O.operatorKeyword,O.url,O.escape,O.regexp,O.link,O.special(O.string)],color:jy},{tag:[O.meta,O.comment],color:Oo},{tag:O.strong,fontWeight:"bold"},{tag:O.emphasis,fontStyle:"italic"},{tag:O.strikethrough,textDecoration:"line-through"},{tag:O.link,color:Oo,textDecoration:"underline"},{tag:O.heading,fontWeight:"bold",color:Ya},{tag:[O.atom,O.bool,O.special(O.variableName)],color:Ka},{tag:[O.processingInstruction,O.string,O.inserted],color:Yy},{tag:O.invalid,color:Gy}]),n1=[t1,df(i1)];var s1=P.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),r1=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:i=!0,readOnly:s=!1,theme:r="light",placeholder:o="",basicSetup:l=!0}=e,a=[];switch(t&&a.unshift(an.of([a0])),l&&(typeof l=="boolean"?a.unshift(Za()):a.unshift(Za(l))),o&&a.unshift(um(o)),r){case"light":a.push(s1);break;case"dark":a.push(n1);break;case"none":break;default:a.push(r);break}return i===!1&&a.push(P.editable.of(!1)),s&&a.push(I.readOnly.of(!0)),[...a]},o1=n=>({line:n.state.doc.lineAt(n.state.selection.main.from),lineCount:n.state.doc.lines,lineBreak:n.state.lineBreak,length:n.state.doc.length,readOnly:n.state.readOnly,tabSize:n.state.tabSize,selection:n.state.selection,selectionAsSingle:n.state.selection.asSingle().main,ranges:n.state.selection.ranges,selectionCode:n.state.sliceDoc(n.state.selection.main.from,n.state.selection.main.to),selections:n.state.selection.ranges.map(e=>n.state.sliceDoc(e.from,e.to)),selectedText:n.state.selection.ranges.some(e=>!e.empty)});class l1{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(t=>{try{t()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class ih{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var dr=null,a1=()=>typeof window>"u"?new ih:(dr||(dr=new ih),dr),nh=st.define(),h1=200,c1=[];function f1(n){var{value:e,selection:t,onChange:i,onStatistics:s,onCreateEditor:r,onUpdate:o,extensions:l=c1,autoFocus:a,theme:h="light",height:c=null,minHeight:f=null,maxHeight:u=null,width:d=null,minWidth:p=null,maxWidth:m=null,placeholder:g="",editable:y=!0,readOnly:S=!1,indentWithTab:x=!0,basicSetup:w=!0,root:k,initialState:v}=n,[T,E]=Se.useState(),[M,z]=Se.useState(),[$,D]=Se.useState(),B=Se.useState(()=>({current:null}))[0],W=Se.useState(()=>({current:null}))[0],X=P.theme({"&":{height:c,minHeight:f,maxHeight:u,width:d,minWidth:p,maxWidth:m},"& .cm-scroller":{height:"100% !important"}}),ne=P.updateListener.of(F=>{if(F.docChanged&&typeof i=="function"&&!F.transactions.some(ge=>ge.annotation(nh))){B.current?B.current.reset():(B.current=new l1(()=>{if(W.current){var ge=W.current;W.current=null,ge()}B.current=null},h1),a1().add(B.current));var ee=F.state.doc,ce=ee.toString();i(ce,F)}s&&s(o1(F))}),oe=r1({theme:h,editable:y,readOnly:S,placeholder:g,indentWithTab:x,basicSetup:w}),me=[ne,X,...oe];return o&&typeof o=="function"&&me.push(P.updateListener.of(o)),me=me.concat(l),Se.useLayoutEffect(()=>{if(T&&!$){var F={doc:e,selection:t,extensions:me},ee=v?I.fromJSON(v.json,F,v.fields):I.create(F);if(D(ee),!M){var ce=new P({state:ee,parent:T,root:k});z(ce),r&&r(ce,ee)}}return()=>{M&&(D(void 0),z(void 0))}},[T,$]),Se.useEffect(()=>{n.container&&E(n.container)},[n.container]),Se.useEffect(()=>()=>{M&&(M.destroy(),z(void 0)),B.current&&(B.current.cancel(),B.current=null)},[M]),Se.useEffect(()=>{a&&M&&M.focus()},[a,M]),Se.useEffect(()=>{M&&M.dispatch({effects:q.reconfigure.of(me)})},[h,l,c,f,u,d,p,m,g,y,S,x,w,i,o]),Se.useEffect(()=>{if(e!==void 0){var F=M?M.state.doc.toString():"";if(M&&e!==F){var ee=B.current&&!B.current.isDone,ce=()=>{M&&e!==M.state.doc.toString()&&M.dispatch({changes:{from:0,to:M.state.doc.toString().length,insert:e||""},annotations:[nh.of(!0)]})};ee?W.current=ce:ce()}}},[e,M]),{state:$,setState:D,view:M,setView:z,container:T,setContainer:E}}var u1=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],d1=Se.forwardRef((n,e)=>{var{className:t,value:i="",selection:s,extensions:r=[],onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:h,autoFocus:c,theme:f="light",height:u,minHeight:d,maxHeight:p,width:m,minWidth:g,maxWidth:y,basicSetup:S,placeholder:x,indentWithTab:w,editable:k,readOnly:v,root:T,initialState:E}=n,M=Lu(n,u1),z=Se.useRef(null),{state:$,view:D,container:B,setContainer:W}=f1({root:T,value:i,autoFocus:c,theme:f,height:u,minHeight:d,maxHeight:p,width:m,minWidth:g,maxWidth:y,basicSetup:S,placeholder:x,indentWithTab:w,editable:k,readOnly:v,selection:s,onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:h,extensions:r,initialState:E});Se.useImperativeHandle(e,()=>({editor:z.current,state:$,view:D}),[z,B,$,D]);var X=Se.useCallback(oe=>{z.current=oe,W(oe)},[W]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var ne=typeof f=="string"?"cm-theme-"+f:"cm-theme";return Iu.jsx("div",zu({ref:X,className:""+ne+(t?" "+t:"")},M))});d1.displayName="CodeMirror";var sh={};class ks{constructor(e,t,i,s,r,o,l,a,h,c=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=s,this.pos=r,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let s=e.parser.context;return new ks(e,[],t,i,i,0,[],0,s?new rh(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,s=e&65535,{parser:r}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,t,i,s=4,r=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==i)return;if(o.buffer[l-2]>=t){o.buffer[l-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(e,t,i,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(e,t,i,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let r=e,{parser:o}=this.p;(s>this.pos||t<=o.maxNode)&&(this.pos=s,o.stateFlag(r,1)||(this.reducePos=s)),this.pushState(r,i),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,s,4)}else this.pos=s,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,s,4)}apply(e,t,i,s){e&65536?this.reduce(e):this.shift(e,t,i,s)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new ks(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new p1(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let r=0,o;ra&1&&l==o)||s.push(t[r],o)}t=s}let i=[];for(let s=0;s>19,s=t&65535,r=this.stack.length-i*3;if(r<0||e.getGoto(this.stack[r],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(s,r)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-r;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,r+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class rh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class p1{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class ws{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ws(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ws(this.stack,this.pos,this.index)}}function Vn(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,s=0;i=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),r+=a,l)break;r*=46}t?t[s++]=r:t=new e(r)}return t}class Jn{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const oh=new Jn;class m1{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=oh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,s=this.rangeIndex,r=this.pos+e;for(;ri.to:r>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-i.to,i=o}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,s;if(t>=0&&t=this.chunk2Pos&&il.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=oh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return i}}class oi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;g1(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}oi.prototype.contextual=oi.prototype.fallback=oi.prototype.extend=!1;oi.prototype.fallback=oi.prototype.extend=!1;class Ws{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function g1(n,e,t,i,s,r){let o=0,l=1<0){let p=n[d];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||O1(p,e.token.value,s,r))){e.acceptToken(p);break}}let c=e.next,f=0,u=n[o+2];if(e.next<0&&u>f&&n[h+u*3-3]==65535){o=n[h+u*3-1];continue e}for(;f>1,p=h+d+(d<<1),m=n[p],g=n[p+1]||65536;if(c=g)f=d+1;else{o=n[p+2],e.advance();continue e}}break}}function lh(n,e,t){for(let i=e,s;(s=n[i])!=65535;i++)if(s==t)return i-e;return-1}function O1(n,e,t,i){let s=lh(t,i,e);return s<0||lh(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class y1{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?ah(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?ah(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof j){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class b1{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Jn)}getActions(e){let t=0,i=null,{parser:s}=e.p,{tokenizers:r}=s,o=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!c.extend&&(i=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Jn,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Jn,{pos:i,p:s}=e;return t.start=i,t.end=Math.min(i+1,s.stream.end),t.value=i==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(s,e),i),e.value>-1){let{parser:r}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,i,s){for(let r=0;re.bufferLength*4?new y1(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],s,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)i.push(l);else{if(this.advanceStack(l,i,e))continue;{s||(s=[],r=[]),s.push(l);let a=this.tokens.getMainToken(l);r.push(a.value,a.end)}}break}}if(!i.length){let o=s&&w1(s);if(o)return Re&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Re&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,i);if(o)return Re&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?r.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(L.contextHash)||0)==c))return e.useNode(f,u),Re&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(f.type.id)})`),!0;if(!(f instanceof j)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof j&&f.positions[0]==0)f=d;else break}}let l=r.stateSlot(e.state,4);if(l>0)return e.reduce(l),Re&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hs?t.push(p):i.push(p)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return hh(e,t),!0}}runRecovery(e,t,i){let s=null,r=!1;for(let o=0;o ":"";if(l.deadEnd&&(r||(r=!0,l.restart(),Re&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),u=c;for(let d=0;d<10&&f.forceReduce()&&(Re&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));d++)Re&&(u=this.stackID(f)+" -> ");for(let d of l.recoverByInsert(a))Re&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Re&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),hh(l,i)):(!s||s.scoren;class k1{constructor(e){this.start=e.start,this.shift=e.shift||mr,this.reduce=e.reduce||mr,this.reuse=e.reuse||mr,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class tn extends Wo{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),s=[];for(let l=0;l=0)r(c,a,l[h++]);else{let f=l[h+-c];for(let u=-c;u>0;u--)r(l[h++],a,f);h++}}}this.nodeSet=new Qs(t.map((l,a)=>ve.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:s[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Uc;let o=Vn(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new oi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let s=new S1(this,e,t,i);for(let r of this.wrappers)s=r(s,e,t,i);return s}getGoto(e,t,i=!1){let s=this.goto;if(t>=s[0])return-1;for(let r=s[t+1];;){let o=s[r++],l=o&1,a=s[r++];if(l&&i)return a;for(let h=r+(o>>1);r0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),s=i?t(i):void 0;for(let r=this.stateSlot(e,1);s==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=ut(this.data,r+2);else break;s=t(ut(this.data,r+1))}return s}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ut(this.data,i+2);else break;if((this.data[i+2]&1)==0){let s=this.data[i+1];t.some((r,o)=>o&1&&r==s)||t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(tn.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let s=e.tokenizers.find(r=>r.from==i);return s?s.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let r=e.specializers.find(l=>l.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return t.specializers[s]=ch(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);o>=0&&(i[o]=!0)}let s=null;for(let r=0;ri)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const v1=1,Qu=194,Au=195,T1=196,fh=197,C1=198,P1=199,Q1=200,A1=2,Mu=3,uh=201,M1=24,R1=25,D1=49,E1=50,q1=55,$1=56,B1=57,W1=59,L1=60,z1=61,I1=62,V1=63,N1=65,X1=238,F1=71,_1=241,U1=242,H1=243,j1=244,G1=245,Z1=246,Y1=247,K1=248,Ru=72,J1=249,eb=250,tb=251,ib=252,nb=253,sb=254,rb=255,ob=256,lb=73,ab=77,hb=263,cb=112,fb=130,ub=151,db=152,pb=155,jt=10,nn=13,rl=32,Ls=9,ol=35,mb=40,gb=46,yo=123,dh=125,Du=39,Eu=34,ph=92,Ob=111,yb=120,bb=78,Sb=117,xb=85,kb=new Set([R1,D1,E1,hb,N1,fb,$1,B1,X1,I1,V1,Ru,lb,ab,L1,z1,ub,db,pb,cb]);function gr(n){return n==jt||n==nn}function Or(n){return n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102}const wb=new Ws((n,e)=>{let t;if(n.next<0)n.acceptToken(P1);else if(e.context.flags&es)gr(n.next)&&n.acceptToken(C1,1);else if(((t=n.peek(-1))<0||gr(t))&&e.canShift(fh)){let i=0;for(;n.next==rl||n.next==Ls;)n.advance(),i++;(n.next==jt||n.next==nn||n.next==ol)&&n.acceptToken(fh,-i)}else gr(n.next)&&n.acceptToken(T1,1)},{contextual:!0}),vb=new Ws((n,e)=>{let t=e.context;if(t.flags)return;let i=n.peek(-1);if(i==jt||i==nn){let s=0,r=0;for(;;){if(n.next==rl)s++;else if(n.next==Ls)s+=8-s%8;else break;n.advance(),r++}s!=t.indent&&n.next!=jt&&n.next!=nn&&n.next!=ol&&(s[n,e|qu])),Pb=new k1({start:Tb,reduce(n,e,t,i){return n.flags&es&&kb.has(e)||(e==F1||e==Ru)&&n.flags&qu?n.parent:n},shift(n,e,t,i){return e==Qu?new ts(n,Cb(i.read(i.pos,t.pos)),0):e==Au?n.parent:e==M1||e==q1||e==W1||e==Mu?new ts(n,0,es):mh.has(e)?new ts(n,0,mh.get(e)|n.flags&es):n},hash(n){return n.hash}}),Qb=new Ws(n=>{for(let e=0;e<5;e++){if(n.next!="print".charCodeAt(e))return;n.advance()}if(!/\w/.test(String.fromCharCode(n.next)))for(let e=0;;e++){let t=n.peek(e);if(!(t==rl||t==Ls)){t!=mb&&t!=gb&&t!=jt&&t!=nn&&t!=ol&&n.acceptToken(v1);return}}}),Ab=new Ws((n,e)=>{let{flags:t}=e.context,i=t&at?Eu:Du,s=(t&ht)>0,r=!(t&ct),o=(t&ft)>0,l=n.pos;for(;!(n.next<0);)if(o&&n.next==yo)if(n.peek(1)==yo)n.advance(2);else{if(n.pos==l){n.acceptToken(Mu,1);return}break}else if(r&&n.next==ph){if(n.pos==l){n.advance();let a=n.next;a>=0&&(n.advance(),Mb(n,a)),n.acceptToken(A1);return}break}else if(n.next==ph&&!r&&n.peek(1)>-1)n.advance(2);else if(n.next==i&&(!s||n.peek(1)==i&&n.peek(2)==i)){if(n.pos==l){n.acceptToken(uh,s?3:1);return}break}else if(n.next==jt){if(s)n.advance();else if(n.pos==l){n.acceptToken(uh);return}break}else n.advance();n.pos>l&&n.acceptToken(Q1)});function Mb(n,e){if(e==Ob)for(let t=0;t<2&&n.next>=48&&n.next<=55;t++)n.advance();else if(e==yb)for(let t=0;t<2&&Or(n.next);t++)n.advance();else if(e==Sb)for(let t=0;t<4&&Or(n.next);t++)n.advance();else if(e==xb)for(let t=0;t<8&&Or(n.next);t++)n.advance();else if(e==bb&&n.next==yo){for(n.advance();n.next>=0&&n.next!=dh&&n.next!=Du&&n.next!=Eu&&n.next!=jt;)n.advance();n.next==dh&&n.advance()}}const Rb=Lo({'async "*" "**" FormatConversion FormatSpec':O.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":O.controlKeyword,"in not and or is del":O.operatorKeyword,"from def class global nonlocal lambda":O.definitionKeyword,import:O.moduleKeyword,"with as print":O.keyword,Boolean:O.bool,None:O.null,VariableName:O.variableName,"CallExpression/VariableName":O.function(O.variableName),"FunctionDefinition/VariableName":O.function(O.definition(O.variableName)),"ClassDefinition/VariableName":O.definition(O.className),PropertyName:O.propertyName,"CallExpression/MemberExpression/PropertyName":O.function(O.propertyName),Comment:O.lineComment,Number:O.number,String:O.string,FormatString:O.special(O.string),Escape:O.escape,UpdateOp:O.updateOperator,"ArithOp!":O.arithmeticOperator,BitOp:O.bitwiseOperator,CompareOp:O.compareOperator,AssignOp:O.definitionOperator,Ellipsis:O.punctuation,At:O.meta,"( )":O.paren,"[ ]":O.squareBracket,"{ }":O.brace,".":O.derefOperator,", ;":O.separator}),Db={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Eb=tn.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[Qb,vb,wb,Ab,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:n=>Db[n]||-1}],tokenPrec:7668}),gh=new jm,$u=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Nn(n){return(e,t,i)=>{if(i)return!1;let s=e.node.getChild("VariableName");return s&&t(s,n),!0}}const qb={FunctionDefinition:Nn("function"),ClassDefinition:Nn("class"),ForStatement(n,e,t){if(t){for(let i=n.node.firstChild;i;i=i.nextSibling)if(i.name=="VariableName")e(i,"variable");else if(i.name=="in")break}},ImportStatement(n,e){var t,i;let{node:s}=n,r=((t=s.firstChild)===null||t===void 0?void 0:t.name)=="from";for(let o=s.getChild("import");o;o=o.nextSibling)o.name=="VariableName"&&((i=o.nextSibling)===null||i===void 0?void 0:i.name)!="as"&&e(o,r?"variable":"namespace")},AssignStatement(n,e){for(let t=n.node.firstChild;t;t=t.nextSibling)if(t.name=="VariableName")e(t,"variable");else if(t.name==":"||t.name=="AssignOp")break},ParamList(n,e){for(let t=null,i=n.node.firstChild;i;i=i.nextSibling)i.name=="VariableName"&&(!t||!/\*|AssignOp/.test(t.name))&&e(i,"variable"),t=i},CapturePattern:Nn("variable"),AsPattern:Nn("variable"),__proto__:null};function Bu(n,e){let t=gh.get(e);if(t)return t;let i=[],s=!0;function r(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(re.IncludeAnonymous).iterate(o=>{if(o.name){let l=qb[o.name];if(l&&l(o,r,s)||!s&&$u.has(o.name))return!1;s=!1}else if(o.to-o.from>8192){for(let l of Bu(n,o.node))i.push(l);return!1}}),gh.set(e,i),i}const Oh=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Wu=["String","FormatString","Comment","PropertyName"];function $b(n){let e=ae(n.state).resolveInner(n.pos,-1);if(Wu.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Oh.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let s=e;s;s=s.parent)$u.has(s.name)&&(i=i.concat(Bu(n.state.doc,s)));return{options:i,from:t?e.from:n.pos,validFor:Oh}}const Bb=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(n=>({label:n,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(n=>({label:n,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(n=>({label:n,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(n=>({label:n,type:"function"}))),Wb=[lt("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),lt("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),lt("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),lt("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),lt(`if \${}: +`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(t,s,1),t+=s;let l=this.chunk.length;s=this.skipGapsTo(i,s,-1),i+=s,r+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&r==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=i:this.chunk.push(e,t,i,r),s}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new yf(t,e?e.state.tabSize:4,e?Ut(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=xf(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Fo=Object.create(null),ji=[ve.none],Hg=new Qs(ji),va=[],Ta=Object.create(null),kf=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])kf[n]=vf(Fo,e);class wf{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),kf)}resolve(e){return e?this.table[e]||(this.table[e]=vf(this.extra,e)):0}}const jg=new wf(Fo);function rr(n,e){va.indexOf(n)>-1||(va.push(n),console.warn(e))}function vf(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||O[h];c?typeof c=="function"?a.length?a=a.map(c):rr(h,`Modifier ${h} used at start of tag`):a.length?rr(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:rr(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id),r=Ta[s];if(r)return r.id;let o=Ta[s]=ve.define({id:ji.length,name:i,props:[zo({[i]:t})]});return ji.push(o),o.id}function Gg(n,e){let t=ve.define({id:ji.length,name:"Document",props:[Lt.add(()=>n),Ms.add(()=>i=>e.getIndent(i))],top:!0});return ji.push(t),t}Z.RTL,Z.LTR;const Zg=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Uo(n.state,t.from);return i.line?Yg(n):i.block?Jg(n):!1};function _o(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const Yg=_o(iO,0),Kg=_o(Tf,0),Jg=_o((n,e)=>Tf(n,e,tO(e)),0);function Uo(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const vi=50;function eO(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-vi,i),o=n.sliceDoc(s,s+vi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let c,f;s-i<=2*vi?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+vi),f=n.sliceDoc(s-vi,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function tO(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to);s.from>i.from&&s.from==t.to&&(s=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function Tf(n,e,t=e.selection.ranges){let i=t.map(r=>Uo(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>eO(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>f.from)){s=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,p=f.text.slice(u,u+h.length)==h?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}const fo=st.define(),nO=st.define(),sO=A.define(),Cf=A.define({combine(n){return rt(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}}),Pf=he.define({create(){return tt.empty},update(n,e){let t=e.state.facet(Cf),i=e.annotation(fo);if(i){let a=Qe.fromTransaction(e,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=ps(c,c.length,t.minDepth,a):c=Mf(c,e.startState.selection),new tt(h==0?i.rest:c,h==0?c:i.rest)}let s=e.annotation(nO);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(ie.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=Qe.fromTransaction(e),o=e.annotation(ie.time),l=e.annotation(ie.userEvent);return r?n=n.addChanges(r,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new tt(n.done.map(Qe.fromJSON),n.undone.map(Qe.fromJSON))}});function rO(n={}){return[Pf,Cf.of(n),P.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Qf:e.inputType=="historyRedo"?uo:null;return i?(e.preventDefault(),i(t)):!1}})]}function Ds(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(Pf,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const Qf=Ds(0,!1),uo=Ds(1,!1),oO=Ds(0,!0),lO=Ds(1,!0);class Qe{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new Qe(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Qe(e.changes&&se.fromJSON(e.changes),[],e.mapped&&it.fromJSON(e.mapped),e.startSelection&&b.fromJSON(e.startSelection),e.selectionsAfter.map(b.fromJSON))}static fromTransaction(e,t){let i=Be;for(let s of e.startState.facet(sO)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new Qe(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Be)}static selection(e){return new Qe(void 0,Be,void 0,void 0,e)}}function ps(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function aO(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function hO(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Af(n,e){return n.length?e.length?n.concat(e):n:e}const Be=[],cO=200;function Mf(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-cO));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),ps(n,n.length-1,1e9,t.setSelAfter(i)))}else return[Qe.selection([e])]}function fO(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function or(n,e){if(!n.length)return n;let t=n.length,i=Be;for(;t;){let s=uO(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[Qe.selection(i)]:Be}function uO(n,e,t){let i=Af(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Be,t);if(!n.changes)return Qe.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new Qe(s,q.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const dO=/^(input\.type|delete)($|\.)/;class tt{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new tt(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||dO.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):Es(t,e))}function be(n){return n.textDirectionAt(n.state.selection.main.head)==Z.LTR}const Df=n=>Rf(n,!be(n)),Ef=n=>Rf(n,be(n));function qf(n,e){return Fe(n,t=>t.empty?n.moveByGroup(t,e):Es(t,e))}const mO=n=>qf(n,!be(n)),gO=n=>qf(n,be(n));function OO(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function qs(n,e,t){let i=ae(n).resolveInner(e.head),s=t?L.closedBy:L.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;OO(n,h,s)?i=h:a=t?h.to:h.from}let r=i.type.prop(s),o,l;return r&&(o=t?et(n,i.from,1):et(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,b.cursor(l,t?-1:1)}const yO=n=>Fe(n,e=>qs(n.state,e,!be(n))),bO=n=>Fe(n,e=>qs(n.state,e,be(n)));function $f(n,e){return Fe(n,t=>{if(!t.empty)return Es(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const Bf=n=>$f(n,!1),Wf=n=>$f(n,!0);function Lf(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):Es(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomzf(n,!1),po=n=>zf(n,!0);function Rt(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=b.cursor(i.from+r))}return s}const SO=n=>Fe(n,e=>Rt(n,e,!0)),xO=n=>Fe(n,e=>Rt(n,e,!1)),kO=n=>Fe(n,e=>Rt(n,e,!be(n))),wO=n=>Fe(n,e=>Rt(n,e,be(n))),vO=n=>Fe(n,e=>b.cursor(n.lineBlockAt(e.head).from,1)),TO=n=>Fe(n,e=>b.cursor(n.lineBlockAt(e.head).to,-1));function CO(n,e,t){let i=!1,s=Oi(n.selection,r=>{let o=et(n,r.head,-1)||et(n,r.head,1)||r.head>0&&et(n,r.head-1,1)||r.headCO(n,e);function Ie(n,e){let t=Oi(n.state.selection,i=>{let s=e(i);return b.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Xe(n.state,t)),!0)}function If(n,e){return Ie(n,t=>n.moveByChar(t,e))}const Vf=n=>If(n,!be(n)),Nf=n=>If(n,be(n));function Xf(n,e){return Ie(n,t=>n.moveByGroup(t,e))}const QO=n=>Xf(n,!be(n)),AO=n=>Xf(n,be(n)),MO=n=>Ie(n,e=>qs(n.state,e,!be(n))),RO=n=>Ie(n,e=>qs(n.state,e,be(n)));function Ff(n,e){return Ie(n,t=>n.moveVertically(t,e))}const _f=n=>Ff(n,!1),Uf=n=>Ff(n,!0);function Hf(n,e){return Ie(n,t=>n.moveVertically(t,e,Lf(n).height))}const Pa=n=>Hf(n,!1),Qa=n=>Hf(n,!0),DO=n=>Ie(n,e=>Rt(n,e,!0)),EO=n=>Ie(n,e=>Rt(n,e,!1)),qO=n=>Ie(n,e=>Rt(n,e,!be(n))),$O=n=>Ie(n,e=>Rt(n,e,be(n))),BO=n=>Ie(n,e=>b.cursor(n.lineBlockAt(e.head).from)),WO=n=>Ie(n,e=>b.cursor(n.lineBlockAt(e.head).to)),Aa=({state:n,dispatch:e})=>(e(Xe(n,{anchor:0})),!0),Ma=({state:n,dispatch:e})=>(e(Xe(n,{anchor:n.doc.length})),!0),Ra=({state:n,dispatch:e})=>(e(Xe(n,{anchor:n.selection.main.anchor,head:0})),!0),Da=({state:n,dispatch:e})=>(e(Xe(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),LO=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),zO=({state:n,dispatch:e})=>{let t=$s(n).map(({from:i,to:s})=>b.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:b.create(t),userEvent:"select"})),!0},IO=({state:n,dispatch:e})=>{let t=Oi(n.selection,i=>{let s=ae(n),r=s.resolveStack(i.from,1);if(i.empty){let o=s.resolveStack(i.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return b.range(l.to,l.from)}return i});return t.eq(n.selection)?!1:(e(Xe(n,t)),!0)};function jf(n,e){let{state:t}=n,i=t.selection,s=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to0)for(let l=r;;){let a=n.moveVertically(l,e);if(a.heado.to){s.some(h=>h.head==a.head)||s.push(a);break}else{if(a.head==l.head)break;l=a}}}return s.length==i.ranges.length?!1:(n.dispatch(Xe(t,b.create(s,s.length-1))),!0)}const VO=n=>jf(n,!1),NO=n=>jf(n,!0),XO=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=b.create([t.main]):t.main.empty||(i=b.create([b.cursor(t.main.head)])),i?(e(Xe(n,i)),!0):!1};function dn(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=Bn(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Bn(n,o,!1),l=Bn(n,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:b.cursor(o,os(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const Gf=(n,e,t)=>dn(n,i=>{let s=i.from,{state:r}=n,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&sGf(n,!1,!0),Zf=n=>Gf(n,!0,!1),Yf=(n,e)=>dn(n,t=>{let i=t.head,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let a=pe(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),Kf=n=>Yf(n,!1),FO=n=>Yf(n,!0),_O=n=>dn(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headdn(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),HO=n=>dn(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:V.of(["",""])},range:b.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},GO=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:pe(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:pe(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:b.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function $s(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function Jf(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of $s(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let a of r.ranges)s.push(b.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let a of r.ranges)s.push(b.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:b.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const ZO=({state:n,dispatch:e})=>Jf(n,e,!1),YO=({state:n,dispatch:e})=>Jf(n,e,!0);function eu(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of $s(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});return e(n.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const KO=({state:n,dispatch:e})=>eu(n,e,!1),JO=({state:n,dispatch:e})=>eu(n,e,!0),e0=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes($s(e).map(({from:s,to:r})=>(s>0?s--:r{let r;if(n.lineWrapping){let o=n.lineBlockAt(s.head),l=n.coordsAtPos(s.head,s.assoc||1);l&&(r=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(s,!0,r)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function t0(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=ae(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(L.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from&&!/\S/.test(n.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}const Ea=tu(!1),i0=tu(!0);function tu(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),a=!n&&r==o&&t0(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new As(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=Io(h,r);for(c==null&&(c=gi(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:b.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const n0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new As(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=Ho(n,(r,o,l)=>{let a=Io(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=Hi(n,a);(h!=c||l.fromn.readOnly?!1:(e(n.update(Ho(n,(t,i)=>{i.push({from:t.from,insert:n.facet(cn)})}),{userEvent:"input.indent"})),!0),nu=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Ho(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=gi(s,n.tabSize),o=0,l=Hi(n,Math.max(0,r-Ut(n)));for(;o(n.setTabFocusMode(),!0),r0=[{key:"Ctrl-b",run:Df,shift:Vf,preventDefault:!0},{key:"Ctrl-f",run:Ef,shift:Nf},{key:"Ctrl-p",run:Bf,shift:_f},{key:"Ctrl-n",run:Wf,shift:Uf},{key:"Ctrl-a",run:vO,shift:BO},{key:"Ctrl-e",run:TO,shift:WO},{key:"Ctrl-d",run:Zf},{key:"Ctrl-h",run:mo},{key:"Ctrl-k",run:_O},{key:"Ctrl-Alt-h",run:Kf},{key:"Ctrl-o",run:jO},{key:"Ctrl-t",run:GO},{key:"Ctrl-v",run:po}],o0=[{key:"ArrowLeft",run:Df,shift:Vf,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mO,shift:QO,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:kO,shift:qO,preventDefault:!0},{key:"ArrowRight",run:Ef,shift:Nf,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:gO,shift:AO,preventDefault:!0},{mac:"Cmd-ArrowRight",run:wO,shift:$O,preventDefault:!0},{key:"ArrowUp",run:Bf,shift:_f,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Aa,shift:Ra},{mac:"Ctrl-ArrowUp",run:Ca,shift:Pa},{key:"ArrowDown",run:Wf,shift:Uf,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Ma,shift:Da},{mac:"Ctrl-ArrowDown",run:po,shift:Qa},{key:"PageUp",run:Ca,shift:Pa},{key:"PageDown",run:po,shift:Qa},{key:"Home",run:xO,shift:EO,preventDefault:!0},{key:"Mod-Home",run:Aa,shift:Ra},{key:"End",run:SO,shift:DO,preventDefault:!0},{key:"Mod-End",run:Ma,shift:Da},{key:"Enter",run:Ea,shift:Ea},{key:"Mod-a",run:LO},{key:"Backspace",run:mo,shift:mo,preventDefault:!0},{key:"Delete",run:Zf,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Kf,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:FO,preventDefault:!0},{mac:"Mod-Backspace",run:UO,preventDefault:!0},{mac:"Mod-Delete",run:HO,preventDefault:!0}].concat(r0.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),l0=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:yO,shift:MO},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:bO,shift:RO},{key:"Alt-ArrowUp",run:ZO},{key:"Shift-Alt-ArrowUp",run:KO},{key:"Alt-ArrowDown",run:YO},{key:"Shift-Alt-ArrowDown",run:JO},{key:"Mod-Alt-ArrowUp",run:VO},{key:"Mod-Alt-ArrowDown",run:NO},{key:"Escape",run:XO},{key:"Mod-Enter",run:i0},{key:"Alt-l",mac:"Ctrl-l",run:zO},{key:"Mod-i",run:IO,preventDefault:!0},{key:"Mod-[",run:nu},{key:"Mod-]",run:iu},{key:"Mod-Alt-\\",run:n0},{key:"Shift-Mod-k",run:e0},{key:"Shift-Mod-\\",run:PO},{key:"Mod-/",run:Zg},{key:"Alt-A",run:Kg},{key:"Ctrl-m",mac:"Shift-Alt-m",run:s0}].concat(o0),a0={key:"Tab",run:iu,shift:nu},qa=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class pi{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(qa(l)):qa,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Te(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=So(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Ye(e);let s=this.normalize(t);if(s.length)for(let r=0,o=i;;r++){let l=s.charCodeAt(r),a=this.match(l,o,this.bufferPos+this.bufferStart);if(r==s.length-1){if(a)return this.value=a,this;break}o==i&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=ms(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new si(t,e.sliceString(t,i));return lr.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this.matchPos=ms(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=si.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ru.prototype[Symbol.iterator]=ou.prototype[Symbol.iterator]=function(){return this});function h0(n){try{return new RegExp(n,jo),!0}catch{return!1}}function ms(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function go(n){let e=String(n.state.doc.lineAt(n.state.selection.main.head).number),t=U("input",{class:"cm-textfield",name:"line",value:e}),i=U("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),n.dispatch({effects:$i.of(!1)}),n.focus()):r.keyCode==13&&(r.preventDefault(),s())},onsubmit:r=>{r.preventDefault(),s()}},U("label",n.state.phrase("Go to line"),": ",t)," ",U("button",{class:"cm-button",type:"submit"},n.state.phrase("go")),U("button",{name:"close",onclick:()=>{n.dispatch({effects:$i.of(!1)}),n.focus()},"aria-label":n.state.phrase("close"),type:"button"},["×"]));function s(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=n,l=o.doc.lineAt(o.selection.main.head),[,a,h,c,f]=r,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),m=b.cursor(p.from+Math.max(0,Math.min(u,p.length)));n.dispatch({effects:[$i.of(!1),P.scrollIntoView(m.from,{y:"center"})],selection:m}),n.focus()}return{dom:i}}const $i=q.define(),$a=he.define({create(){return!0},update(n,e){for(let t of e.effects)t.is($i)&&(n=t.value);return n},provide:n=>Xi.from(n,e=>e?go:null)}),c0=n=>{let e=Ni(n,go);if(!e){let t=[$i.of(!0)];n.state.field($a,!1)==null&&t.push(q.appendConfig.of([$a,f0])),n.dispatch({effects:t}),e=Ni(n,go)}return e&&e.dom.querySelector("input").select(),!0},f0=P.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),u0={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},d0=A.define({combine(n){return rt(n,u0,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function p0(n){return[b0,y0]}const m0=R.mark({class:"cm-selectionMatch"}),g0=R.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ba(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=Y.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=Y.Word)}function O0(n,e,t,i){return n(e.sliceDoc(t,t+1))==Y.Word&&n(e.sliceDoc(i-1,i))==Y.Word}const y0=J.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(d0),{state:t}=n,i=t.selection;if(i.ranges.length>1)return R.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return R.none;let a=t.wordAt(s.head);if(!a)return R.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a200)return R.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Ba(o,t,s.from,s.to)&&O0(o,t,s.from,s.to)))return R.none}else if(r=t.sliceDoc(s.from,s.to),!r)return R.none}let l=[];for(let a of n.visibleRanges){let h=new pi(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||Ba(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(g0.range(c,f)):(c>=s.to||f<=s.from)&&l.push(m0.range(c,f)),l.length>e.maxMatches))return R.none}}return R.set(l)}},{decorations:n=>n.decorations}),b0=P.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),S0=({state:n,dispatch:e})=>{let{selection:t}=n,i=b.create(t.ranges.map(s=>n.wordAt(s.head)||b.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function x0(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new pi(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new pi(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const k0=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return S0({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=x0(n,i);return s?(e(n.update({selection:n.selection.addRange(b.range(s.from,s.to),!1),effects:P.scrollIntoView(s.to)})),!0):!1},yi=A.define({combine(n){return rt(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new q0(e),scrollToMatch:e=>P.scrollIntoView(e)})}});class lu{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||h0(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new C0(this):new v0(this)}getCursor(e,t=0,i){let s=e.doc?e:I.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?Yt(this,s,t,i):Zt(this,s,t,i)}}class au{constructor(e){this.spec=e}}function Zt(n,e,t,i){return new pi(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),n.wholeWord?w0(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function w0(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Zt(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Yt(n,e,t,i){return new ru(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?T0(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function gs(n,e){return n.slice(pe(n,e,!1),e)}function Os(n,e){return n.slice(e,pe(n,e))}function T0(n){return(e,t,i)=>!i[0].length||(n(gs(i.input,i.index))!=Y.Word||n(Os(i.input,i.index))!=Y.Word)&&(n(Os(i.input,i.index+i[0].length))!=Y.Word||n(gs(i.input,i.index+i[0].length))!=Y.Word)}class C0 extends au{nextMatch(e,t,i){let s=Yt(this.spec,e,i,e.doc.length).next();return s.done&&(s=Yt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Yt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let r=+i.slice(0,s);if(r>0&&r=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Yt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Gi=q.define(),Go=q.define(),vt=he.define({create(n){return new ar(Oo(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Gi)?n=new ar(t.value.create(),n.panel):t.is(Go)&&(n=new ar(n.query,t.value?Zo:null));return n},provide:n=>Xi.from(n,e=>e.panel)});class ar{constructor(e,t){this.query=e,this.panel=t}}const P0=R.mark({class:"cm-searchMatch"}),Q0=R.mark({class:"cm-searchMatch cm-searchMatch-selected"}),A0=J.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(vt))}update(n){let e=n.state.field(vt);(e!=n.startState.field(vt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return R.none;let{view:t}=this,i=new gt;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-500;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?Q0:P0)})}return i.finish()}},{decorations:n=>n.decorations});function pn(n){return e=>{let t=e.state.field(vt,!1);return t&&t.query.spec.valid?n(e,t):fu(e)}}const ys=pn((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=b.single(i.from,i.to),r=n.state.facet(yi);return n.dispatch({selection:s,effects:[Yo(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),cu(n),!0}),bs=pn((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=b.single(s.from,s.to),o=n.state.facet(yi);return n.dispatch({selection:r,effects:[Yo(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),cu(n),!0}),M0=pn((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:b.create(t.map(i=>b.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),R0=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new pi(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(b.range(l.value.from,l.value.to))}return e(n.update({selection:b.create(r,o),userEvent:"select.search.matches"})),!0},Wa=pn((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=r,l=[],a,h,c=[];o.from==i&&o.to==s&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(P.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+".")));let f=n.state.changes(l);return o&&(a=b.single(o.from,o.to).map(f),c.push(Yo(n,o)),c.push(t.facet(yi).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),D0=pn((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:P.announce.of(i),userEvent:"input.replace.all"}),!0});function Zo(n){return n.state.facet(yi).createPanel(n)}function Oo(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(yi);return new lu({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function hu(n){let e=Ni(n,Zo);return e&&e.dom.querySelector("[main-field]")}function cu(n){let e=hu(n);e&&e==n.root.activeElement&&e.select()}const fu=n=>{let e=n.state.field(vt,!1);if(e&&e.panel){let t=hu(n);if(t&&t!=n.root.activeElement){let i=Oo(n.state,e.query.spec);i.valid&&n.dispatch({effects:Gi.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Go.of(!0),e?Gi.of(Oo(n.state,e.query.spec)):q.appendConfig.of(B0)]});return!0},uu=n=>{let e=n.state.field(vt,!1);if(!e||!e.panel)return!1;let t=Ni(n,Zo);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Go.of(!1)}),!0},E0=[{key:"Mod-f",run:fu,scope:"editor search-panel"},{key:"F3",run:ys,shift:bs,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ys,shift:bs,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:uu,scope:"editor search-panel"},{key:"Mod-Shift-l",run:R0},{key:"Mod-Alt-g",run:c0},{key:"Mod-d",run:k0,preventDefault:!0}];class q0{constructor(e){this.view=e;let t=this.query=e.state.field(vt).query.spec;this.commit=this.commit.bind(this),this.searchField=U("input",{value:t.search,placeholder:Me(e,"Find"),"aria-label":Me(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=U("input",{value:t.replace,placeholder:Me(e,"Replace"),"aria-label":Me(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=U("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=U("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=U("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return U("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=U("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>ys(e),[Me(e,"next")]),i("prev",()=>bs(e),[Me(e,"previous")]),i("select",()=>M0(e),[Me(e,"all")]),U("label",null,[this.caseField,Me(e,"match case")]),U("label",null,[this.reField,Me(e,"regexp")]),U("label",null,[this.wordField,Me(e,"by word")]),...e.state.readOnly?[]:[U("br"),this.replaceField,i("replace",()=>Wa(e),[Me(e,"replace")]),i("replaceAll",()=>D0(e),[Me(e,"replace all")])],U("button",{name:"close",onclick:()=>uu(e),"aria-label":Me(e,"close"),type:"button"},["×"])])}commit(){let e=new lu({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Gi.of(e)}))}keydown(e){zp(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?bs:ys)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Wa(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Gi)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(yi).top}}function Me(n,e){return n.state.phrase(e)}const Wn=30,Ln=/[\s\.,:;?!]/;function Yo(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Wn),o=Math.min(s,t+Wn),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-Wn;a--)if(!Ln.test(l[a-1])&&Ln.test(l[a])){l=l.slice(0,a);break}}return P.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const $0=P.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),B0=[vt,Mt.low(A0),$0];class du{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=ae(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(mu(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function La(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function W0(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:W0(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function L0(n,e){return t=>{for(let i=ae(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class za{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function Vt(n){return n.selection.main.from}function mu(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const Ko=st.define();function z0(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return{...n.changeByRange(l=>{if(l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:a},range:b.cursor(l.from+r+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Ia=new WeakMap;function I0(n){if(!Array.isArray(n))return n;let e=Ia.get(n);return e||Ia.set(n,e=pu(n)),e}const Ss=q.define(),Zi=q.define();class V0{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(v=So(k))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!S||T==1&&g||w==0&&T!=0)&&(t[f]==k||i[f]==k&&(u=!0)?o[f++]=S:o.length&&(y=!1)),w=T,S+=Ye(k)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?Ye(Te(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}}class N0{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:X0,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>Va(e(i),t(i)),optionClass:(e,t)=>i=>Va(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Va(n,e){return n?e?n+" "+e:n:e}function X0(n,e,t,i,s,r){let o=n.textDirection==Z.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||S>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function F0(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function hr(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class _0{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(le);this.optionContent=F0(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=hr(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(le).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Zi.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=hr(r.length,o,e.state.facet(le).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=hr(t.options.length,t.selected,this.view.state.facet(le).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>Pe(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&H0(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom{o.target==s&&o.preventDefault()});let r=null;for(let o=i.from;oi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew _0(t,n,e)}function H0(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function Na(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function j0(n,e){let t=[],i=null,s=null,r=c=>{t.push(c);let{section:f}=c.completion;if(f){i||(i=[]);let u=typeof f=="string"?f:f.name;i.some(d=>d.name==u)||i.push(typeof f=="string"?{name:u}:f)}},o=e.facet(le);for(let c of n)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)r(new za(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new N0(u):new V0(u);for(let m of c.result.options)if(d=p.match(m.label)){let g=m.displayLabel?f?f(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(r(new za(m,c.source,g,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:S}=m.section;s||(s=Object.create(null)),s[S]=Math.max(y,s[S]||-1e9)}}}}if(i){let c=Object.create(null),f=0,u=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.nameu.score-f.score||h(f.completion,u.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):Na(c.completion)>Na(a)&&(l[l.length-1]=c),a=c.completion}return l}class ei{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ei(this.options,Xa(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r,o){if(s&&!o&&e.some(h=>h.isPending))return s.setDisabled();let l=j0(e,t);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let a=t.facet(le).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(h,c.from):h,1e8),create:ey,above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new ei(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ei(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class xs{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new xs(K0,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(le),r=(i.override||t.languageDataAt("autocomplete",Vt(t)).map(I0)).map(a=>(this.active.find(c=>c.source==a)||new We(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,h)=>a==this.active[h])&&(r=this.active);let o=this.open,l=e.effects.some(a=>a.is(Jo));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!G0(r,this.active)||l?o=ei.build(r,t,this.id,o,i,l):o&&o.disabled&&!r.some(a=>a.isPending)&&(o=null),!o&&r.every(a=>!a.isPending)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new We(a.source,0):a));for(let a of e.effects)a.is(Ou)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new xs(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Z0:Y0}}function G0(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const K0=[];function gu(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(Ko);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class We{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=gu(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new We(s.source,0)),i&4&&s.state==0&&(s=new We(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(Ss))s=new We(s.source,1,r.value);else if(r.is(Zi))s=new We(s.source,0);else if(r.is(Jo))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Vt(e.state))}}class ri extends We{constructor(e,t,i,s,r,o){super(e,3,t),this.limit=i,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Vt(e.state);if(l>o||!s||t&2&&(Vt(e.startState)==this.from||lt.map(e))}}),Ou=q.define(),Ce=he.define({create(){return xs.start()},update(n,e){return n.update(e)},provide:n=>[qo.from(n,e=>e.tooltip),P.contentAttributes.from(n,e=>e.attrs)]});function el(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Ce).active.find(s=>s.source==e.source);return i instanceof ri?(typeof t=="string"?n.dispatch({...z0(n.state,t,i.from,i.to),annotations:Ko.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const ey=U0(Ce,el);function zn(n,e="option"){return t=>{let i=t.state.field(Ce,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:Ou.of(l)}),!0}}const ty=n=>{let e=n.state.field(Ce,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(Ce,!1)?(n.dispatch({effects:Ss.of(!0)}),!0):!1,iy=n=>{let e=n.state.field(Ce,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Zi.of(null)}),!0)};class ny{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const sy=50,ry=1e3,oy=J.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(Ce).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Ce),t=n.state.facet(le);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Ce)==e)return;let i=n.transactions.some(r=>{let o=gu(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;rsy&&Date.now()-o.time>ry){for(let l of o.context.abortListeners)try{l()}catch(a){Pe(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(Ss)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(Ce);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(le).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Vt(e),i=new du(e,t,n.explicit,this.view),s=new ny(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:Zi.of(null)}),Pe(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(le).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(le),i=this.view.state.field(Ce);for(let s=0;sl.source==r.active.source);if(o&&o.isPending)if(r.done==null){let l=new We(r.active.source,0);for(let a of r.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:Jo.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Ce,!1);if(e&&e.tooltip&&this.view.state.facet(le).closeOnBlur){let t=e.open&&Xc(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Zi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ss.of(!1)}),20),this.composing=0}}}),ly=typeof navigator=="object"&&/Win/.test(navigator.platform),ay=Mt.highest(P.domEventHandlers({keydown(n,e){let t=e.state.field(Ce,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(ly&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&el(e,i),!1}})),yu=P.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class hy{constructor(e,t,i,s){this.field=e,this.line=t,this.from=i,this.to=s}}class tl{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,de.TrackDel),i=e.mapPos(this.to,1,de.TrackDel);return t==null||i==null?null:new tl(this.field,t,i)}}class il{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew tl(a.field,s[a.line]+a.from,s[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=r[1]?+r[1]:null,a=r[2]||r[3]||"",h=-1,c=a.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=h&&u.field++}for(let f of s)if(f.line==i.length&&f.from>r.index){let u=r[2]?3+(r[1]||"").length:2;f.from-=u,f.to-=u}s.push(new hy(h,i.length,r.index,r.index+c.length)),o=o.slice(0,r.index)+a+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(l,a,h)=>{for(let c of s)c.line==i.length&&c.from>h&&(c.from--,c.to--);return a}),i.push(o)}return new il(i,s)}}let cy=R.widget({widget:new class extends ot{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),fy=R.mark({class:"cm-snippetField"});class bi{constructor(e,t){this.ranges=e,this.active=t,this.deco=R.set(e.map(i=>(i.from==i.to?cy:fy).range(i.from,i.to)),!0)}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new bi(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const mn=q.define({map(n,e){return n&&n.map(e)}}),uy=q.define(),Yi=he.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(mn))return t.value;if(t.is(uy)&&n)return new bi(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>P.decorations.from(n,e=>e?e.deco:R.none)});function nl(n,e){return b.create(n.filter(t=>t.field==e).map(t=>b.range(t.from,t.to)))}function dy(n){let e=il.parse(n);return(t,i,s,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,s),{main:a}=t.state.selection,h={changes:{from:s,to:r==a.from?a.to:r,insert:V.of(o)},scrollIntoView:!0,annotations:i?[Ko.of(i),ie.userEvent.of("input.complete")]:void 0};if(l.length&&(h.selection=nl(l,0)),l.some(c=>c.field>0)){let c=new bi(l,0),f=h.effects=[mn.of(c)];t.state.field(Yi,!1)===void 0&&f.push(q.appendConfig.of([Yi,yy,by,yu]))}t.dispatch(t.state.update(h))}}function bu(n){return({state:e,dispatch:t})=>{let i=e.field(Yi,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return t(e.update({selection:nl(i.ranges,s),effects:mn.of(r?null:new bi(i.ranges,s)),scrollIntoView:!0})),!0}}const py=({state:n,dispatch:e})=>n.field(Yi,!1)?(e(n.update({effects:mn.of(null)})),!0):!1,my=bu(1),gy=bu(-1),Oy=[{key:"Tab",run:my,shift:gy},{key:"Escape",run:py}],Fa=A.define({combine(n){return n.length?n[0]:Oy}}),yy=Mt.highest(an.compute([Fa],n=>n.facet(Fa)));function lt(n,e){return{...e,apply:dy(n)}}const by=P.domEventHandlers({mousedown(n,e){let t=e.state.field(Yi,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==t.active?!1:(e.dispatch({selection:nl(t.ranges,s.field),effects:mn.of(t.ranges.some(r=>r.field>s.field)?new bi(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ki={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},zt=q.define({map(n,e){let t=e.mapPos(n,-1,de.TrackAfter);return t??void 0}}),sl=new class extends Nt{};sl.startSide=1;sl.endSide=-1;const Su=he.define({create(){return N.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(zt)&&(n=n.update({add:[sl.range(t.value,t.value+1)]}));return n}});function Sy(){return[ky,Su]}const fr="()[]{}<>«»»«[]{}";function xu(n){for(let e=0;e{if((xy?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&Ye(Te(i,0))==1||e!=s.from||t!=s.to)return!1;let r=Ty(n.state,i);return r?(n.dispatch(r),!0):!1}),wy=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=ku(n,n.selection.main.head).brackets||Ki.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=Cy(n.doc,o.head);for(let a of i)if(a==l&&Bs(n.doc,o.head)==xu(Te(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},vy=[{key:"Backspace",run:wy}];function Ty(n,e){let t=ku(n,n.selection.main.head),i=t.brackets||Ki.brackets;for(let s of i){let r=xu(Te(s,0));if(e==s)return r==s?Ay(n,s,i.indexOf(s+s+s)>-1,t):Py(n,s,r,t.before||Ki.before);if(e==r&&wu(n,n.selection.main.from))return Qy(n,s,r)}return null}function wu(n,e){let t=!1;return n.field(Su).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Bs(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Ye(Te(t,0)))}function Cy(n,e){let t=n.sliceString(e-2,e);return Ye(Te(t,0))==t.length?t:t.slice(1)}function Py(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:zt.of(o.to+e.length),range:b.range(o.anchor+e.length,o.head+e.length)};let l=Bs(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:zt.of(o.head+e.length),range:b.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Qy(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&Bs(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:b.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Ay(n,e,t,i){let s=i.stringPrefixes||Ki.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:zt.of(l.to+e.length),range:b.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=Bs(n.doc,a),c;if(h==e){if(_a(n,a))return{changes:{insert:e+e,from:a},effects:zt.of(a+e.length),range:b.cursor(a+e.length)};if(wu(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=Ua(n,a-2*e.length,s))>-1&&_a(n,c))return{changes:{insert:e+e+e+e,from:a},effects:zt.of(a+e.length),range:b.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=Y.Word&&Ua(n,a,s)>-1&&!My(n,a,e,s))return{changes:{insert:e+e,from:a},effects:zt.of(a+e.length),range:b.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function _a(n,e){let t=ae(n).resolveInner(e+1);return t.parent&&t.from==e}function My(n,e,t,i){let s=ae(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function Ua(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Y.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=Y.Word)return r}return-1}function Ry(n={}){return[ay,Ce,le.of(n),oy,Dy,yu]}const vu=[{key:"Ctrl-Space",run:cr},{mac:"Alt-`",run:cr},{mac:"Alt-i",run:cr},{key:"Escape",run:iy},{key:"ArrowDown",run:zn(!0)},{key:"ArrowUp",run:zn(!1)},{key:"PageDown",run:zn(!0,"page")},{key:"PageUp",run:zn(!1,"page")},{key:"Enter",run:ty}],Dy=Mt.highest(an.computeN([le],n=>n.facet(le).defaultKeymap?[vu]:[]));class Ha{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Bt{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(Ji).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new gt,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let p=d==r.length?null:r[d];if(!p&&!l.length)break;let m,g;if(l.length)m=a,g=l.reduce((x,w)=>Math.min(x,w.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;g=p.to,l.push(p),d++}for(;dx.from||x.to==m))l.push(x),d++,g=Math.min(x.to,g);else{g=Math.min(x.from,g);break}}g=Math.min(g,f);let y=!1;if(l.some(x=>x.from==m&&(x.to==g||g==f))&&(y=m==g,!y&&g-m<10)){let x=m-(c+h.value.length);x>0&&(h.next(x),c=m);for(let w=m;;){if(w>=g){y=!0;break}if(!h.lineBreak&&c+h.value.length>w)break;w=c+h.value.length,c+=h.value.length,h.next()}}let S=_y(l);if(y)o.add(m,m,R.widget({widget:new Vy(S),diagnostics:l.slice()}));else{let x=l.reduce((w,k)=>k.markClass?w+" "+k.markClass:w,"");o.add(m,g,R.mark({class:"cm-lintRange cm-lintRange-"+S+x,diagnostics:l.slice(),inclusiveEnd:l.some(w=>w.to>g)}))}if(a=g,a==f)break;for(let x=0;x{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new Ha(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new Ha(i.from,r,i.diagnostic)}}),i}function Ey(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(Ji).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(Tu))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function qy(n,e){return n.field(Ee,!1)?e:e.concat(q.appendConfig.of(Uy))}const Tu=q.define(),rl=q.define(),Cu=q.define(),Ee=he.define({create(){return new Bt(R.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=mi(t,n.selected.diagnostic,r)||mi(t,null,r)}!t.size&&s&&e.state.facet(Ji).autoPanel&&(s=null),n=new Bt(t,s,i)}for(let t of e.effects)if(t.is(Tu)){let i=e.state.facet(Ji).autoPanel?t.value.length?en.open:null:n.panel;n=Bt.init(t.value,i,e.state)}else t.is(rl)?n=new Bt(n.diagnostics,t.value?en.open:null,n.selected):t.is(Cu)&&(n=new Bt(n.diagnostics,n.panel,t.value));return n},provide:n=>[Xi.from(n,e=>e.panel),P.decorations.from(n,e=>e.diagnostics)]}),$y=R.mark({class:"cm-lintRange cm-lintRange-active"});function By(n,e,t){let{diagnostics:i}=n.state.field(Ee),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(eQu(n,t,!1)))}const Ly=n=>{let e=n.state.field(Ee,!1);(!e||!e.panel)&&n.dispatch({effects:qy(n.state,[rl.of(!0)])});let t=Ni(n,en.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},ja=n=>{let e=n.state.field(Ee,!1);return!e||!e.panel?!1:(n.dispatch({effects:rl.of(!1)}),!0)},zy=n=>{let e=n.state.field(Ee,!1);if(!e)return!1;let t=n.state.selection.main,i=e.diagnostics.iter(t.to+1);return!i.value&&(i=e.diagnostics.iter(0),!i.value||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},Iy=[{key:"Mod-Shift-m",run:Ly,preventDefault:!0},{key:"F8",run:zy}],Ji=A.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...rt(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Ga,tooltipFilter:Ga,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function Ga(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function Pu(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Qu(n,e,t){var i;let s=t?Pu(e.actions):[];return U("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},U("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=mi(n.state.field(Ee).diagnostics,e);p&&r.apply(n,p.from,p.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),U("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return U("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&U("div",{class:"cm-diagnosticSource"},e.source))}class Vy extends ot{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return U("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Za{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Qu(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class en{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)ja(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=Pu(r.actions);for(let l=0;l{for(let r=0;rja(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ee).selected;if(!e)return-1;for(let t=0;t{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;di&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ee),i=mi(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:Cu.of(i)})}static open(e){return new en(e)}}function Ny(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function In(n){return Ny(``,'width="6" height="3"')}const Xy=P.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:In("#d11")},".cm-lintRange-warning":{backgroundImage:In("orange")},".cm-lintRange-info":{backgroundImage:In("#999")},".cm-lintRange-hint":{backgroundImage:In("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function Fy(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function _y(n){let e="hint",t=1;for(let i of n){let s=Fy(i.severity);s>t&&(t=s,e=i.severity)}return e}const Uy=[Ee,P.decorations.compute([Ee],n=>{let{selected:e,panel:t}=n.field(Ee);return!e||!t||e.from==e.to?R.none:R.set([$y.range(e.from,e.to)])}),Pm(By,{hideOn:Ey}),Xy];var Ya=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,i=[];e.closeBracketsKeymap!==!1&&(i=i.concat(vy)),e.defaultKeymap!==!1&&(i=i.concat(l0)),e.searchKeymap!==!1&&(i=i.concat(E0)),e.historyKeymap!==!1&&(i=i.concat(pO)),e.foldKeymap!==!1&&(i=i.concat(vg)),e.completionKeymap!==!1&&(i=i.concat(vu)),e.lintKeymap!==!1&&(i=i.concat(Iy));var s=[];return e.lineNumbers!==!1&&s.push(Lm()),e.highlightActiveLineGutter!==!1&&s.push(Vm()),e.highlightSpecialChars!==!1&&s.push(im()),e.history!==!1&&s.push(rO()),e.foldGutter!==!1&&s.push(Qg()),e.drawSelection!==!1&&s.push(_p()),e.dropCursor!==!1&&s.push(Zp()),e.allowMultipleSelections!==!1&&s.push(I.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mg()),e.syntaxHighlighting!==!1&&s.push(pf(Dg,{fallback:!0})),e.bracketMatching!==!1&&s.push(zg()),e.closeBrackets!==!1&&s.push(Sy()),e.autocompletion!==!1&&s.push(Ry()),e.rectangularSelection!==!1&&s.push(gm()),t!==!1&&s.push(bm()),e.highlightActiveLine!==!1&&s.push(am()),e.highlightSelectionMatches!==!1&&s.push(p0()),e.tabSize&&typeof e.tabSize=="number"&&s.push(cn.of(" ".repeat(e.tabSize))),s.concat([an.of(i.flat())]).filter(Boolean)};const Hy="#e5c07b",Ka="#e06c75",jy="#56b6c2",Gy="#ffffff",Kn="#abb2bf",yo="#7d8799",Zy="#61afef",Yy="#98c379",Ja="#d19a66",Ky="#c678dd",Jy="#21252b",eh="#2c313a",th="#282c34",ur="#353a42",e1="#3E4451",ih="#528bff",t1=P.theme({"&":{color:Kn,backgroundColor:th},".cm-content":{caretColor:ih},".cm-cursor, .cm-dropCursor":{borderLeftColor:ih},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e1},".cm-panels":{backgroundColor:Jy,color:Kn},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:th,color:yo,border:"none"},".cm-activeLineGutter":{backgroundColor:eh},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:ur},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:ur,borderBottomColor:ur},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:eh,color:Kn}}},{dark:!0}),i1=un.define([{tag:O.keyword,color:Ky},{tag:[O.name,O.deleted,O.character,O.propertyName,O.macroName],color:Ka},{tag:[O.function(O.variableName),O.labelName],color:Zy},{tag:[O.color,O.constant(O.name),O.standard(O.name)],color:Ja},{tag:[O.definition(O.name),O.separator],color:Kn},{tag:[O.typeName,O.className,O.number,O.changed,O.annotation,O.modifier,O.self,O.namespace],color:Hy},{tag:[O.operator,O.operatorKeyword,O.url,O.escape,O.regexp,O.link,O.special(O.string)],color:jy},{tag:[O.meta,O.comment],color:yo},{tag:O.strong,fontWeight:"bold"},{tag:O.emphasis,fontStyle:"italic"},{tag:O.strikethrough,textDecoration:"line-through"},{tag:O.link,color:yo,textDecoration:"underline"},{tag:O.heading,fontWeight:"bold",color:Ka},{tag:[O.atom,O.bool,O.special(O.variableName)],color:Ja},{tag:[O.processingInstruction,O.string,O.inserted],color:Yy},{tag:O.invalid,color:Gy}]),n1=[t1,pf(i1)];var s1=P.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),r1=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:i=!0,readOnly:s=!1,theme:r="light",placeholder:o="",basicSetup:l=!0}=e,a=[];switch(t&&a.unshift(an.of([a0])),l&&(typeof l=="boolean"?a.unshift(Ya()):a.unshift(Ya(l))),o&&a.unshift(um(o)),r){case"light":a.push(s1);break;case"dark":a.push(n1);break;case"none":break;default:a.push(r);break}return i===!1&&a.push(P.editable.of(!1)),s&&a.push(I.readOnly.of(!0)),[...a]},o1=n=>({line:n.state.doc.lineAt(n.state.selection.main.from),lineCount:n.state.doc.lines,lineBreak:n.state.lineBreak,length:n.state.doc.length,readOnly:n.state.readOnly,tabSize:n.state.tabSize,selection:n.state.selection,selectionAsSingle:n.state.selection.asSingle().main,ranges:n.state.selection.ranges,selectionCode:n.state.sliceDoc(n.state.selection.main.from,n.state.selection.main.to),selections:n.state.selection.ranges.map(e=>n.state.sliceDoc(e.from,e.to)),selectedText:n.state.selection.ranges.some(e=>!e.empty)});class l1{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(t=>{try{t()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class nh{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var dr=null,a1=()=>typeof window>"u"?new nh:(dr||(dr=new nh),dr),sh=st.define(),h1=200,c1=[];function f1(n){var{value:e,selection:t,onChange:i,onStatistics:s,onCreateEditor:r,onUpdate:o,extensions:l=c1,autoFocus:a,theme:h="light",height:c=null,minHeight:f=null,maxHeight:u=null,width:d=null,minWidth:p=null,maxWidth:m=null,placeholder:g="",editable:y=!0,readOnly:S=!1,indentWithTab:x=!0,basicSetup:w=!0,root:k,initialState:v}=n,[T,E]=Se.useState(),[M,z]=Se.useState(),[$,D]=Se.useState(),B=Se.useState(()=>({current:null}))[0],W=Se.useState(()=>({current:null}))[0],X=P.theme({"&":{height:c,minHeight:f,maxHeight:u,width:d,minWidth:p,maxWidth:m},"& .cm-scroller":{height:"100% !important"}}),ne=P.updateListener.of(F=>{if(F.docChanged&&typeof i=="function"&&!F.transactions.some(ge=>ge.annotation(sh))){B.current?B.current.reset():(B.current=new l1(()=>{if(W.current){var ge=W.current;W.current=null,ge()}B.current=null},h1),a1().add(B.current));var ee=F.state.doc,ce=ee.toString();i(ce,F)}s&&s(o1(F))}),oe=r1({theme:h,editable:y,readOnly:S,placeholder:g,indentWithTab:x,basicSetup:w}),me=[ne,X,...oe];return o&&typeof o=="function"&&me.push(P.updateListener.of(o)),me=me.concat(l),Se.useLayoutEffect(()=>{if(T&&!$){var F={doc:e,selection:t,extensions:me},ee=v?I.fromJSON(v.json,F,v.fields):I.create(F);if(D(ee),!M){var ce=new P({state:ee,parent:T,root:k});z(ce),r&&r(ce,ee)}}return()=>{M&&(D(void 0),z(void 0))}},[T,$]),Se.useEffect(()=>{n.container&&E(n.container)},[n.container]),Se.useEffect(()=>()=>{M&&(M.destroy(),z(void 0)),B.current&&(B.current.cancel(),B.current=null)},[M]),Se.useEffect(()=>{a&&M&&M.focus()},[a,M]),Se.useEffect(()=>{M&&M.dispatch({effects:q.reconfigure.of(me)})},[h,l,c,f,u,d,p,m,g,y,S,x,w,i,o]),Se.useEffect(()=>{if(e!==void 0){var F=M?M.state.doc.toString():"";if(M&&e!==F){var ee=B.current&&!B.current.isDone,ce=()=>{M&&e!==M.state.doc.toString()&&M.dispatch({changes:{from:0,to:M.state.doc.toString().length,insert:e||""},annotations:[sh.of(!0)]})};ee?W.current=ce:ce()}}},[e,M]),{state:$,setState:D,view:M,setView:z,container:T,setContainer:E}}var u1=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],d1=Se.forwardRef((n,e)=>{var{className:t,value:i="",selection:s,extensions:r=[],onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:h,autoFocus:c,theme:f="light",height:u,minHeight:d,maxHeight:p,width:m,minWidth:g,maxWidth:y,basicSetup:S,placeholder:x,indentWithTab:w,editable:k,readOnly:v,root:T,initialState:E}=n,M=Iu(n,u1),z=Se.useRef(null),{state:$,view:D,container:B,setContainer:W}=f1({root:T,value:i,autoFocus:c,theme:f,height:u,minHeight:d,maxHeight:p,width:m,minWidth:g,maxWidth:y,basicSetup:S,placeholder:x,indentWithTab:w,editable:k,readOnly:v,selection:s,onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:h,extensions:r,initialState:E});Se.useImperativeHandle(e,()=>({editor:z.current,state:$,view:D}),[z,B,$,D]);var X=Se.useCallback(oe=>{z.current=oe,W(oe)},[W]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var ne=typeof f=="string"?"cm-theme-"+f:"cm-theme";return zu.jsx("div",xr({ref:X,className:""+ne+(t?" "+t:"")},M))});d1.displayName="CodeMirror";var rh={};class ks{constructor(e,t,i,s,r,o,l,a,h,c=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=s,this.pos=r,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let s=e.parser.context;return new ks(e,[],t,i,i,0,[],0,s?new oh(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,s=e&65535,{parser:r}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,t,i,s=4,r=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==i)return;if(o.buffer[l-2]>=t){o.buffer[l-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(e,t,i,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(e,t,i,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let r=e,{parser:o}=this.p;(s>this.pos||t<=o.maxNode)&&(this.pos=s,o.stateFlag(r,1)||(this.reducePos=s)),this.pushState(r,i),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,s,4)}else this.pos=s,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,s,4)}apply(e,t,i,s){e&65536?this.reduce(e):this.shift(e,t,i,s)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new ks(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new p1(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let r=0,o;ra&1&&l==o)||s.push(t[r],o)}t=s}let i=[];for(let s=0;s>19,s=t&65535,r=this.stack.length-i*3;if(r<0||e.getGoto(this.stack[r],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(s,r)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-r;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,r+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class oh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class p1{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class ws{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ws(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ws(this.stack,this.pos,this.index)}}function Vn(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,s=0;i=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),r+=a,l)break;r*=46}t?t[s++]=r:t=new e(r)}return t}class Jn{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const lh=new Jn;class m1{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=lh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,s=this.rangeIndex,r=this.pos+e;for(;ri.to:r>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-i.to,i=o}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,s;if(t>=0&&t=this.chunk2Pos&&il.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=lh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return i}}class oi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;g1(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}oi.prototype.contextual=oi.prototype.fallback=oi.prototype.extend=!1;oi.prototype.fallback=oi.prototype.extend=!1;class Ws{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function g1(n,e,t,i,s,r){let o=0,l=1<0){let p=n[d];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||O1(p,e.token.value,s,r))){e.acceptToken(p);break}}let c=e.next,f=0,u=n[o+2];if(e.next<0&&u>f&&n[h+u*3-3]==65535){o=n[h+u*3-1];continue e}for(;f>1,p=h+d+(d<<1),m=n[p],g=n[p+1]||65536;if(c=g)f=d+1;else{o=n[p+2],e.advance();continue e}}break}}function ah(n,e,t){for(let i=e,s;(s=n[i])!=65535;i++)if(s==t)return i-e;return-1}function O1(n,e,t,i){let s=ah(t,i,e);return s<0||ah(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class y1{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?hh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?hh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof j){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class b1{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Jn)}getActions(e){let t=0,i=null,{parser:s}=e.p,{tokenizers:r}=s,o=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!c.extend&&(i=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Jn,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Jn,{pos:i,p:s}=e;return t.start=i,t.end=Math.min(i+1,s.stream.end),t.value=i==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(s,e),i),e.value>-1){let{parser:r}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,i,s){for(let r=0;re.bufferLength*4?new y1(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],s,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)i.push(l);else{if(this.advanceStack(l,i,e))continue;{s||(s=[],r=[]),s.push(l);let a=this.tokens.getMainToken(l);r.push(a.value,a.end)}}break}}if(!i.length){let o=s&&w1(s);if(o)return Re&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Re&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,i);if(o)return Re&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?r.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(L.contextHash)||0)==c))return e.useNode(f,u),Re&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(f.type.id)})`),!0;if(!(f instanceof j)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof j&&f.positions[0]==0)f=d;else break}}let l=r.stateSlot(e.state,4);if(l>0)return e.reduce(l),Re&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hs?t.push(p):i.push(p)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return ch(e,t),!0}}runRecovery(e,t,i){let s=null,r=!1;for(let o=0;o ":"";if(l.deadEnd&&(r||(r=!0,l.restart(),Re&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),u=c;for(let d=0;d<10&&f.forceReduce()&&(Re&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));d++)Re&&(u=this.stackID(f)+" -> ");for(let d of l.recoverByInsert(a))Re&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Re&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),ch(l,i)):(!s||s.scoren;class k1{constructor(e){this.start=e.start,this.shift=e.shift||mr,this.reduce=e.reduce||mr,this.reuse=e.reuse||mr,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class tn extends Lo{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),s=[];for(let l=0;l=0)r(c,a,l[h++]);else{let f=l[h+-c];for(let u=-c;u>0;u--)r(l[h++],a,f);h++}}}this.nodeSet=new Qs(t.map((l,a)=>ve.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:s[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Hc;let o=Vn(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new oi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let s=new S1(this,e,t,i);for(let r of this.wrappers)s=r(s,e,t,i);return s}getGoto(e,t,i=!1){let s=this.goto;if(t>=s[0])return-1;for(let r=s[t+1];;){let o=s[r++],l=o&1,a=s[r++];if(l&&i)return a;for(let h=r+(o>>1);r0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),s=i?t(i):void 0;for(let r=this.stateSlot(e,1);s==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=ut(this.data,r+2);else break;s=t(ut(this.data,r+1))}return s}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ut(this.data,i+2);else break;if((this.data[i+2]&1)==0){let s=this.data[i+1];t.some((r,o)=>o&1&&r==s)||t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(tn.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let s=e.tokenizers.find(r=>r.from==i);return s?s.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let r=e.specializers.find(l=>l.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return t.specializers[s]=fh(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);o>=0&&(i[o]=!0)}let s=null;for(let r=0;ri)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const v1=1,Au=194,Mu=195,T1=196,uh=197,C1=198,P1=199,Q1=200,A1=2,Ru=3,dh=201,M1=24,R1=25,D1=49,E1=50,q1=55,$1=56,B1=57,W1=59,L1=60,z1=61,I1=62,V1=63,N1=65,X1=238,F1=71,_1=241,U1=242,H1=243,j1=244,G1=245,Z1=246,Y1=247,K1=248,Du=72,J1=249,eb=250,tb=251,ib=252,nb=253,sb=254,rb=255,ob=256,lb=73,ab=77,hb=263,cb=112,fb=130,ub=151,db=152,pb=155,jt=10,nn=13,ol=32,Ls=9,ll=35,mb=40,gb=46,bo=123,ph=125,Eu=39,qu=34,mh=92,Ob=111,yb=120,bb=78,Sb=117,xb=85,kb=new Set([R1,D1,E1,hb,N1,fb,$1,B1,X1,I1,V1,Du,lb,ab,L1,z1,ub,db,pb,cb]);function gr(n){return n==jt||n==nn}function Or(n){return n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102}const wb=new Ws((n,e)=>{let t;if(n.next<0)n.acceptToken(P1);else if(e.context.flags&es)gr(n.next)&&n.acceptToken(C1,1);else if(((t=n.peek(-1))<0||gr(t))&&e.canShift(uh)){let i=0;for(;n.next==ol||n.next==Ls;)n.advance(),i++;(n.next==jt||n.next==nn||n.next==ll)&&n.acceptToken(uh,-i)}else gr(n.next)&&n.acceptToken(T1,1)},{contextual:!0}),vb=new Ws((n,e)=>{let t=e.context;if(t.flags)return;let i=n.peek(-1);if(i==jt||i==nn){let s=0,r=0;for(;;){if(n.next==ol)s++;else if(n.next==Ls)s+=8-s%8;else break;n.advance(),r++}s!=t.indent&&n.next!=jt&&n.next!=nn&&n.next!=ll&&(s[n,e|$u])),Pb=new k1({start:Tb,reduce(n,e,t,i){return n.flags&es&&kb.has(e)||(e==F1||e==Du)&&n.flags&$u?n.parent:n},shift(n,e,t,i){return e==Au?new ts(n,Cb(i.read(i.pos,t.pos)),0):e==Mu?n.parent:e==M1||e==q1||e==W1||e==Ru?new ts(n,0,es):gh.has(e)?new ts(n,0,gh.get(e)|n.flags&es):n},hash(n){return n.hash}}),Qb=new Ws(n=>{for(let e=0;e<5;e++){if(n.next!="print".charCodeAt(e))return;n.advance()}if(!/\w/.test(String.fromCharCode(n.next)))for(let e=0;;e++){let t=n.peek(e);if(!(t==ol||t==Ls)){t!=mb&&t!=gb&&t!=jt&&t!=nn&&t!=ll&&n.acceptToken(v1);return}}}),Ab=new Ws((n,e)=>{let{flags:t}=e.context,i=t&at?qu:Eu,s=(t&ht)>0,r=!(t&ct),o=(t&ft)>0,l=n.pos;for(;!(n.next<0);)if(o&&n.next==bo)if(n.peek(1)==bo)n.advance(2);else{if(n.pos==l){n.acceptToken(Ru,1);return}break}else if(r&&n.next==mh){if(n.pos==l){n.advance();let a=n.next;a>=0&&(n.advance(),Mb(n,a)),n.acceptToken(A1);return}break}else if(n.next==mh&&!r&&n.peek(1)>-1)n.advance(2);else if(n.next==i&&(!s||n.peek(1)==i&&n.peek(2)==i)){if(n.pos==l){n.acceptToken(dh,s?3:1);return}break}else if(n.next==jt){if(s)n.advance();else if(n.pos==l){n.acceptToken(dh);return}break}else n.advance();n.pos>l&&n.acceptToken(Q1)});function Mb(n,e){if(e==Ob)for(let t=0;t<2&&n.next>=48&&n.next<=55;t++)n.advance();else if(e==yb)for(let t=0;t<2&&Or(n.next);t++)n.advance();else if(e==Sb)for(let t=0;t<4&&Or(n.next);t++)n.advance();else if(e==xb)for(let t=0;t<8&&Or(n.next);t++)n.advance();else if(e==bb&&n.next==bo){for(n.advance();n.next>=0&&n.next!=ph&&n.next!=Eu&&n.next!=qu&&n.next!=jt;)n.advance();n.next==ph&&n.advance()}}const Rb=zo({'async "*" "**" FormatConversion FormatSpec':O.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":O.controlKeyword,"in not and or is del":O.operatorKeyword,"from def class global nonlocal lambda":O.definitionKeyword,import:O.moduleKeyword,"with as print":O.keyword,Boolean:O.bool,None:O.null,VariableName:O.variableName,"CallExpression/VariableName":O.function(O.variableName),"FunctionDefinition/VariableName":O.function(O.definition(O.variableName)),"ClassDefinition/VariableName":O.definition(O.className),PropertyName:O.propertyName,"CallExpression/MemberExpression/PropertyName":O.function(O.propertyName),Comment:O.lineComment,Number:O.number,String:O.string,FormatString:O.special(O.string),Escape:O.escape,UpdateOp:O.updateOperator,"ArithOp!":O.arithmeticOperator,BitOp:O.bitwiseOperator,CompareOp:O.compareOperator,AssignOp:O.definitionOperator,Ellipsis:O.punctuation,At:O.meta,"( )":O.paren,"[ ]":O.squareBracket,"{ }":O.brace,".":O.derefOperator,", ;":O.separator}),Db={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Eb=tn.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[Qb,vb,wb,Ab,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:n=>Db[n]||-1}],tokenPrec:7668}),Oh=new jm,Bu=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Nn(n){return(e,t,i)=>{if(i)return!1;let s=e.node.getChild("VariableName");return s&&t(s,n),!0}}const qb={FunctionDefinition:Nn("function"),ClassDefinition:Nn("class"),ForStatement(n,e,t){if(t){for(let i=n.node.firstChild;i;i=i.nextSibling)if(i.name=="VariableName")e(i,"variable");else if(i.name=="in")break}},ImportStatement(n,e){var t,i;let{node:s}=n,r=((t=s.firstChild)===null||t===void 0?void 0:t.name)=="from";for(let o=s.getChild("import");o;o=o.nextSibling)o.name=="VariableName"&&((i=o.nextSibling)===null||i===void 0?void 0:i.name)!="as"&&e(o,r?"variable":"namespace")},AssignStatement(n,e){for(let t=n.node.firstChild;t;t=t.nextSibling)if(t.name=="VariableName")e(t,"variable");else if(t.name==":"||t.name=="AssignOp")break},ParamList(n,e){for(let t=null,i=n.node.firstChild;i;i=i.nextSibling)i.name=="VariableName"&&(!t||!/\*|AssignOp/.test(t.name))&&e(i,"variable"),t=i},CapturePattern:Nn("variable"),AsPattern:Nn("variable"),__proto__:null};function Wu(n,e){let t=Oh.get(e);if(t)return t;let i=[],s=!0;function r(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(re.IncludeAnonymous).iterate(o=>{if(o.name){let l=qb[o.name];if(l&&l(o,r,s)||!s&&Bu.has(o.name))return!1;s=!1}else if(o.to-o.from>8192){for(let l of Wu(n,o.node))i.push(l);return!1}}),Oh.set(e,i),i}const yh=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Lu=["String","FormatString","Comment","PropertyName"];function $b(n){let e=ae(n.state).resolveInner(n.pos,-1);if(Lu.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&yh.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let s=e;s;s=s.parent)Bu.has(s.name)&&(i=i.concat(Wu(n.state.doc,s)));return{options:i,from:t?e.from:n.pos,validFor:yh}}const Bb=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(n=>({label:n,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(n=>({label:n,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(n=>({label:n,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(n=>({label:n,type:"function"}))),Wb=[lt("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),lt("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),lt("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),lt("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),lt(`if \${}: -`,{label:"if",detail:"block",type:"keyword"}),lt("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),lt("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),lt("import ${module}",{label:"import",detail:"statement",type:"keyword"}),lt("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Lb=L0(Wu,du(Bb.concat(Wb)));function yr(n){let{node:e,pos:t}=n,i=n.lineIndent(t,-1),s=null;for(;;){let r=e.childBefore(t);if(r)if(r.name=="Comment")t=r.from;else if(r.name=="Body"||r.name=="MatchBody")n.baseIndentFor(r)+n.unit<=i&&(s=r),e=r;else if(r.name=="MatchClause")e=r;else if(r.type.is("Statement"))e=r;else break;else break}return s}function br(n,e){let t=n.baseIndentFor(e),i=n.lineAt(n.pos,-1),s=i.from+i.text.length;return/^\s*($|#)/.test(i.text)&&n.node.tot?null:t+n.unit}const Sr=Ui.define({name:"python",parser:Eb.configure({props:[Ms.add({Body:n=>{var e;let t=/^\s*(#|$)/.test(n.textAfter)&&yr(n)||n.node;return(e=br(n,t))!==null&&e!==void 0?e:n.continue()},MatchBody:n=>{var e;let t=yr(n);return(e=br(n,t||n.node))!==null&&e!==void 0?e:n.continue()},IfStatement:n=>/^\s*(else:|elif )/.test(n.textAfter)?n.baseIndent:n.continue(),"ForStatement WhileStatement":n=>/^\s*else:/.test(n.textAfter)?n.baseIndent:n.continue(),TryStatement:n=>/^\s*(except[ :]|finally:|else:)/.test(n.textAfter)?n.baseIndent:n.continue(),MatchStatement:n=>/^\s*case /.test(n.textAfter)?n.baseIndent+n.unit:n.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":ir({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":ir({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":ir({closing:"]"}),MemberExpression:n=>n.baseIndent+n.unit,"String FormatString":()=>null,Script:n=>{var e;let t=yr(n);return(e=t&&br(n,t))!==null&&e!==void 0?e:n.continue()}}),Vo.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":sf,Body:(n,e)=>({from:n.from+1,to:n.to-(n.to==e.doc.length?0:1)}),"String FormatString":(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function jb(){return new ef(Sr,[Sr.data.of({autocomplete:$b}),Sr.data.of({autocomplete:Lb})])}const zb=Lo({String:O.string,Number:O.number,"True False":O.bool,PropertyName:O.propertyName,Null:O.null,", :":O.separator,"[ ]":O.squareBracket,"{ }":O.brace}),Ib=tn.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[zb],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Gb=()=>n=>{try{JSON.parse(n.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=Vb(e,n.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function Vb(n,e){let t;return(t=n.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=n.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const Nb=Ui.define({name:"json",parser:Ib.configure({props:[Ms.add({Object:ya({except:/^\s*\}/}),Array:ya({except:/^\s*\]/})}),Vo.add({"Object Array":sf})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Zb(){return new ef(Nb)}export{P as E,d1 as R,yf as S,Gb as a,Zb as j,n1 as o,jb as p}; +`,{label:"if",detail:"block",type:"keyword"}),lt("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),lt("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),lt("import ${module}",{label:"import",detail:"statement",type:"keyword"}),lt("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Lb=L0(Lu,pu(Bb.concat(Wb)));function yr(n){let{node:e,pos:t}=n,i=n.lineIndent(t,-1),s=null;for(;;){let r=e.childBefore(t);if(r)if(r.name=="Comment")t=r.from;else if(r.name=="Body"||r.name=="MatchBody")n.baseIndentFor(r)+n.unit<=i&&(s=r),e=r;else if(r.name=="MatchClause")e=r;else if(r.type.is("Statement"))e=r;else break;else break}return s}function br(n,e){let t=n.baseIndentFor(e),i=n.lineAt(n.pos,-1),s=i.from+i.text.length;return/^\s*($|#)/.test(i.text)&&n.node.tot?null:t+n.unit}const Sr=Ui.define({name:"python",parser:Eb.configure({props:[Ms.add({Body:n=>{var e;let t=/^\s*(#|$)/.test(n.textAfter)&&yr(n)||n.node;return(e=br(n,t))!==null&&e!==void 0?e:n.continue()},MatchBody:n=>{var e;let t=yr(n);return(e=br(n,t||n.node))!==null&&e!==void 0?e:n.continue()},IfStatement:n=>/^\s*(else:|elif )/.test(n.textAfter)?n.baseIndent:n.continue(),"ForStatement WhileStatement":n=>/^\s*else:/.test(n.textAfter)?n.baseIndent:n.continue(),TryStatement:n=>/^\s*(except[ :]|finally:|else:)/.test(n.textAfter)?n.baseIndent:n.continue(),MatchStatement:n=>/^\s*case /.test(n.textAfter)?n.baseIndent+n.unit:n.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":ir({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":ir({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":ir({closing:"]"}),MemberExpression:n=>n.baseIndent+n.unit,"String FormatString":()=>null,Script:n=>{var e;let t=yr(n);return(e=t&&br(n,t))!==null&&e!==void 0?e:n.continue()}}),No.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":rf,Body:(n,e)=>({from:n.from+1,to:n.to-(n.to==e.doc.length?0:1)}),"String FormatString":(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function Hb(){return new tf(Sr,[Sr.data.of({autocomplete:$b}),Sr.data.of({autocomplete:Lb})])}const zb=zo({String:O.string,Number:O.number,"True False":O.bool,PropertyName:O.propertyName,Null:O.null,", :":O.separator,"[ ]":O.squareBracket,"{ }":O.brace}),Ib=tn.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[zb],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),jb=()=>n=>{try{JSON.parse(n.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=Vb(e,n.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function Vb(n,e){let t;return(t=n.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=n.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const Nb=Ui.define({name:"json",parser:Ib.configure({props:[Ms.add({Object:ba({except:/^\s*\}/}),Array:ba({except:/^\s*\]/})}),No.add({"Object Array":rf})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Gb(){return new tf(Nb)}export{P as E,d1 as R,bf as S,jb as a,Gb as j,n1 as o,Hb as p}; diff --git a/webui/dist/assets/dnd-Dyi3CnuX.js b/webui/dist/assets/dnd-CHfCzWUK.js similarity index 99% rename from webui/dist/assets/dnd-Dyi3CnuX.js rename to webui/dist/assets/dnd-CHfCzWUK.js index e0429073..48ee198e 100644 --- a/webui/dist/assets/dnd-Dyi3CnuX.js +++ b/webui/dist/assets/dnd-CHfCzWUK.js @@ -1,4 +1,4 @@ -import{r as c,R as P,b as Oe}from"./router-CWhjJi2n.js";function Rn(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(o=>o(r))},t)}const et=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function pt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:pt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function bt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Ut(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:pt(e)?bt(e)?e:Be(e)||Ut(e)?e.ownerDocument:document:document:document}const Q=et?c.useLayoutEffect:c.useEffect;function wt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ge(e){const t=wt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function dt(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let at={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=at[e]==null?0:at[e]+1;return at[e]=n,e+"-"+n},[e,t])}function Wt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o{const a=Object.entries(s);for(const[l,u]of a){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=Wt(1),ze=Wt(-1);function En(e){return"clientX"in e&&"clientY"in e}function mt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function Mn(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function ft(e){if(Mn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return En(e)?{x:e.clientX,y:e.clientY}:null}const Je=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Je.Translate.toString(e),Je.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Ot="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function In(e){return e.matches(Ot)?e:e.querySelector(Ot)}const An={display:"none"};function On(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:An},n)}function Tn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Nn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Ht=c.createContext(null);function Ln(e){const t=c.useContext(Ht);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function kn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const zn={draggable:` +import{r as c,R as P,b as Oe}from"./router-Bz250laD.js";function Rn(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(o=>o(r))},t)}const et=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function pt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:pt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function bt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Ut(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:pt(e)?bt(e)?e:Be(e)||Ut(e)?e.ownerDocument:document:document:document}const Q=et?c.useLayoutEffect:c.useEffect;function wt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ge(e){const t=wt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function dt(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let at={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=at[e]==null?0:at[e]+1;return at[e]=n,e+"-"+n},[e,t])}function Wt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o{const a=Object.entries(s);for(const[l,u]of a){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=Wt(1),ze=Wt(-1);function En(e){return"clientX"in e&&"clientY"in e}function mt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function Mn(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function ft(e){if(Mn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return En(e)?{x:e.clientX,y:e.clientY}:null}const Je=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Je.Translate.toString(e),Je.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Ot="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function In(e){return e.matches(Ot)?e:e.querySelector(Ot)}const An={display:"none"};function On(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:An},n)}function Tn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Nn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Ht=c.createContext(null);function Ln(e){const t=c.useContext(Ht);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function kn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const zn={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. diff --git a/webui/dist/assets/icons-BusT0Ku_.js b/webui/dist/assets/icons-CwAZotQh.js similarity index 97% rename from webui/dist/assets/icons-BusT0Ku_.js rename to webui/dist/assets/icons-CwAZotQh.js index 37e077ee..f0275a38 100644 --- a/webui/dist/assets/icons-BusT0Ku_.js +++ b/webui/dist/assets/icons-CwAZotQh.js @@ -1 +1 @@ -import{r as s}from"./router-CWhjJi2n.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const v=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:y="",children:n,iconNode:k,...h},i)=>s.createElement("svg",{ref:i,...m,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",y),...!n&&!x(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>s.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=s.forwardRef(({className:o,...y},n)=>s.createElement(v,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...y}));return c.displayName=d(t),c};const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],i2=e("activity",g);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],p2=e("arrow-left",u);const f=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],l2=e("arrow-right",f);const $=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_2=e("ban",$);const N=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],M2=e("book-open",N);const w=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],x2=e("bot",w);const z=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],m2=e("boxes",z);const b=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],v2=e("bug",b);const q=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],g2=e("calendar",q);const j=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],u2=e("chart-column",j);const C=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],f2=e("check",C);const V=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$2=e("chevron-down",V);const A=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],N2=e("chevron-left",A);const H=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],w2=e("chevron-right",H);const L=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],z2=e("chevron-up",L);const S=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],b2=e("chevrons-left",S);const P=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],q2=e("chevrons-right",P);const U=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],j2=e("chevrons-up-down",U);const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],C2=e("circle-alert",T);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],V2=e("circle-check",Z);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],A2=e("circle-question-mark",B);const D=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],H2=e("circle-user-round",D);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],L2=e("circle-user",E);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],S2=e("circle-x",R);const F=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],P2=e("circle",F);const O=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],U2=e("clipboard-list",O);const G=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],T2=e("clock",G);const I=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Z2=e("code-xml",I);const W=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],B2=e("container",W);const K=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],D2=e("copy",K);const Q=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],E2=e("database",Q);const X=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],R2=e("dollar-sign",X);const J=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],F2=e("download",J);const Y=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],O2=e("external-link",Y);const e1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],G2=e("eye-off",e1);const a1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],I2=e("eye",a1);const t1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],W2=e("file-question-mark",t1);const c1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],K2=e("file-search",c1);const o1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Q2=e("file-text",o1);const n1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],X2=e("folder-open",n1);const s1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],J2=e("funnel",s1);const y1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Y2=e("globe",y1);const h1=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],e0=e("graduation-cap",h1);const d1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],a0=e("grip-vertical",d1);const r1=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],t0=e("hard-drive",r1);const k1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],c0=e("hash",k1);const i1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],o0=e("house",i1);const p1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],n0=e("image",p1);const l1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],s0=e("info",l1);const _1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],y0=e("key",_1);const M1=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],h0=e("layout-grid",M1);const x1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],d0=e("loader-circle",x1);const m1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],r0=e("lock",m1);const v1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],k0=e("log-out",v1);const g1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],i0=e("menu",g1);const u1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],p0=e("message-circle",u1);const f1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],l0=e("message-square",f1);const $1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],_0=e("moon",$1);const N1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],M0=e("network",N1);const w1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],x0=e("package",w1);const z1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],m0=e("palette",z1);const b1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],v0=e("panels-top-left",b1);const q1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],g0=e("pause",q1);const j1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],u0=e("pen",j1);const C1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],f0=e("pencil",C1);const V1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],$0=e("play",V1);const A1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],N0=e("plus",A1);const H1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],w0=e("power",H1);const L1=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],z0=e("puzzle",L1);const S1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],b0=e("refresh-cw",S1);const P1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],q0=e("rotate-ccw",P1);const U1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],j0=e("save",U1);const T1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],C0=e("search",T1);const Z1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],V0=e("send",Z1);const B1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],A0=e("server",B1);const D1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],H0=e("settings-2",D1);const E1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],L0=e("settings",E1);const R1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],S0=e("shield",R1);const F1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],P0=e("skip-forward",F1);const O1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],U0=e("sliders-vertical",O1);const G1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],T0=e("smile",G1);const I1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Z0=e("sparkles",I1);const W1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],B0=e("square-pen",W1);const K1=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],D0=e("star",K1);const Q1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],E0=e("sun",Q1);const X1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],R0=e("terminal",X1);const J1=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],F0=e("thumbs-up",J1);const Y1=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],O0=e("thumbs-down",Y1);const e2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],G0=e("trash-2",e2);const a2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],I0=e("trending-up",a2);const t2=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],W0=e("triangle-alert",t2);const c2=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],K0=e("type",c2);const o2=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Q0=e("upload",o2);const n2=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],X0=e("user",n2);const s2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],J0=e("users",s2);const y2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Y0=e("wifi-off",y2);const h2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],ee=e("wifi",h2);const d2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ae=e("x",d2);const r2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],te=e("zap",r2);export{Z2 as $,i2 as A,x2 as B,V2 as C,R2 as D,G2 as E,Q2 as F,C0 as G,t0 as H,s0 as I,o0 as J,y0 as K,r0 as L,l0 as M,p2 as N,N0 as O,w0 as P,$2 as Q,b0 as R,L0 as S,I0 as T,Q0 as U,z2 as V,K2 as W,ae as X,j0 as Y,te as Z,v0 as _,C2 as a,f0 as a0,b2 as a1,N2 as a2,w2 as a3,q2 as a4,j2 as a5,a0 as a6,e0 as a7,B2 as a8,x0 as a9,A0 as aA,m2 as aB,L2 as aC,u2 as aD,U0 as aE,i0 as aF,M2 as aG,k0 as aH,v2 as aI,X2 as aa,n0 as ab,J2 as ac,B0 as ad,_2 as ae,c0 as af,p0 as ag,Y2 as ah,J0 as ai,M0 as aj,g2 as ak,g0 as al,$0 as am,K0 as an,D0 as ao,F0 as ap,O0 as aq,H0 as ar,h0 as as,H2 as at,ee as au,Y0 as av,u0 as aw,V0 as ax,P2 as ay,W2 as az,q0 as b,z0 as c,U2 as d,E2 as e,T2 as f,m0 as g,S0 as h,W0 as i,f2 as j,D2 as k,I2 as l,S2 as m,G0 as n,F2 as o,E0 as p,_0 as q,A2 as r,R0 as s,O2 as t,d0 as u,Z0 as v,X0 as w,T0 as x,P0 as y,l2 as z}; +import{r as s}from"./router-Bz250laD.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const v=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:y="",children:n,iconNode:k,...h},i)=>s.createElement("svg",{ref:i,...m,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",y),...!n&&!x(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>s.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=s.forwardRef(({className:o,...y},n)=>s.createElement(v,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...y}));return c.displayName=d(t),c};const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],i2=e("activity",g);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],p2=e("arrow-left",u);const f=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],l2=e("arrow-right",f);const $=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_2=e("ban",$);const N=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],M2=e("book-open",N);const w=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],x2=e("bot",w);const z=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],m2=e("boxes",z);const b=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],v2=e("bug",b);const q=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],g2=e("calendar",q);const j=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],u2=e("chart-column",j);const C=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],f2=e("check",C);const V=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$2=e("chevron-down",V);const A=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],N2=e("chevron-left",A);const H=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],w2=e("chevron-right",H);const L=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],z2=e("chevron-up",L);const S=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],b2=e("chevrons-left",S);const P=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],q2=e("chevrons-right",P);const U=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],j2=e("chevrons-up-down",U);const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],C2=e("circle-alert",T);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],V2=e("circle-check",Z);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],A2=e("circle-question-mark",B);const D=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],H2=e("circle-user-round",D);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],L2=e("circle-user",E);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],S2=e("circle-x",R);const F=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],P2=e("circle",F);const O=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],U2=e("clipboard-list",O);const G=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],T2=e("clock",G);const I=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Z2=e("code-xml",I);const W=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],B2=e("container",W);const K=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],D2=e("copy",K);const Q=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],E2=e("database",Q);const X=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],R2=e("dollar-sign",X);const J=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],F2=e("download",J);const Y=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],O2=e("external-link",Y);const e1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],G2=e("eye-off",e1);const a1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],I2=e("eye",a1);const t1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],W2=e("file-question-mark",t1);const c1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],K2=e("file-search",c1);const o1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Q2=e("file-text",o1);const n1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],X2=e("folder-open",n1);const s1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],J2=e("funnel",s1);const y1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Y2=e("globe",y1);const h1=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],e0=e("graduation-cap",h1);const d1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],a0=e("grip-vertical",d1);const r1=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],t0=e("hard-drive",r1);const k1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],c0=e("hash",k1);const i1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],o0=e("house",i1);const p1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],n0=e("image",p1);const l1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],s0=e("info",l1);const _1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],y0=e("key",_1);const M1=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],h0=e("layout-grid",M1);const x1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],d0=e("loader-circle",x1);const m1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],r0=e("lock",m1);const v1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],k0=e("log-out",v1);const g1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],i0=e("menu",g1);const u1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],p0=e("message-circle",u1);const f1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],l0=e("message-square",f1);const $1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],_0=e("moon",$1);const N1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],M0=e("network",N1);const w1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],x0=e("package",w1);const z1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],m0=e("palette",z1);const b1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],v0=e("panels-top-left",b1);const q1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],g0=e("pause",q1);const j1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],u0=e("pen",j1);const C1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],f0=e("pencil",C1);const V1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],$0=e("play",V1);const A1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],N0=e("plus",A1);const H1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],w0=e("power",H1);const L1=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],z0=e("puzzle",L1);const S1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],b0=e("refresh-cw",S1);const P1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],q0=e("rotate-ccw",P1);const U1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],j0=e("save",U1);const T1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],C0=e("search",T1);const Z1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],V0=e("send",Z1);const B1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],A0=e("server",B1);const D1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],H0=e("settings-2",D1);const E1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],L0=e("settings",E1);const R1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],S0=e("shield",R1);const F1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],P0=e("skip-forward",F1);const O1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],U0=e("sliders-vertical",O1);const G1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],T0=e("smile",G1);const I1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Z0=e("sparkles",I1);const W1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],B0=e("square-pen",W1);const K1=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],D0=e("star",K1);const Q1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],E0=e("sun",Q1);const X1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],R0=e("terminal",X1);const J1=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],F0=e("thumbs-down",J1);const Y1=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],O0=e("thumbs-up",Y1);const e2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],G0=e("trash-2",e2);const a2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],I0=e("trending-up",a2);const t2=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],W0=e("triangle-alert",t2);const c2=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],K0=e("type",c2);const o2=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Q0=e("upload",o2);const n2=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],X0=e("user",n2);const s2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],J0=e("users",s2);const y2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Y0=e("wifi-off",y2);const h2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],ee=e("wifi",h2);const d2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ae=e("x",d2);const r2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],te=e("zap",r2);export{Z2 as $,i2 as A,x2 as B,V2 as C,R2 as D,G2 as E,Q2 as F,C0 as G,t0 as H,s0 as I,o0 as J,y0 as K,r0 as L,l0 as M,p2 as N,N0 as O,w0 as P,$2 as Q,b0 as R,L0 as S,I0 as T,Q0 as U,z2 as V,K2 as W,ae as X,j0 as Y,te as Z,v0 as _,C2 as a,f0 as a0,b2 as a1,N2 as a2,w2 as a3,q2 as a4,j2 as a5,a0 as a6,e0 as a7,B2 as a8,x0 as a9,A0 as aA,m2 as aB,L2 as aC,u2 as aD,U0 as aE,i0 as aF,M2 as aG,k0 as aH,v2 as aI,X2 as aa,n0 as ab,J2 as ac,B0 as ad,_2 as ae,c0 as af,p0 as ag,Y2 as ah,J0 as ai,M0 as aj,g2 as ak,g0 as al,$0 as am,K0 as an,D0 as ao,O0 as ap,F0 as aq,H0 as ar,h0 as as,H2 as at,ee as au,Y0 as av,u0 as aw,V0 as ax,P2 as ay,W2 as az,q0 as b,z0 as c,U2 as d,E2 as e,T2 as f,m0 as g,S0 as h,W0 as i,f2 as j,D2 as k,I2 as l,S2 as m,G0 as n,F2 as o,E0 as p,_0 as q,A2 as r,R0 as s,O2 as t,d0 as u,Z0 as v,X0 as w,T0 as x,P0 as y,l2 as z}; diff --git a/webui/dist/assets/index-Bt4pqUpI.js b/webui/dist/assets/index-Bt4pqUpI.js deleted file mode 100644 index 8201f775..00000000 --- a/webui/dist/assets/index-Bt4pqUpI.js +++ /dev/null @@ -1,54 +0,0 @@ -import{r as u,j as e,L as Xn,e as ga,R as gt,b as Hb,f as qb,g as Gb,h as Fb,k as lt,l as Vb,m as $b,O as Tp,n as Qb}from"./router-CWhjJi2n.js";import{a as Ib,b as Yb,g as Xb}from"./react-vendor-Dtc2IqVY.js";import{I as Kb,c as Jb,J as ti,K as Oc,L as bu,M as Pb,N as Zi,O as Wi,P as Zb,n as Nu}from"./utils-CCeOswSm.js";import{L as Ep,T as zp,C as Mp,R as Wb,a as Ap,V as eN,b as sN,S as Dp,c as tN,d as Op,I as aN,e as Rp,f as lN,g as Lp,h as nN,i as iN,j as rN,O as Up,P as cN,k as Bp,l as Hp,D as qp,A as Gp,m as Fp,n as oN,o as dN,p as Vp,q as uN,r as $p,s as mN,t as xN,u as hN,v as fN,w as pN,x as Qp,y as Ip,F as Yp,z as Xp,B as gN,E as jN}from"./radix-extra-DnIxMvW0.js";import{aj as vN,ak as bN,al as NN,am as yN,an as Rc,ao as Lc,ap as er,aq as wN,ar as yu,as as Uc,at as _N,au as SN,av as CN}from"./charts-Dhri-zxi.js";import{S as kN,G as Kp,O as Jp,o as TN,C as Pp,p as EN,T as Zp,D as Wp,R as zN,q as MN,H as eg,I as AN,J as sg,K as tg,L as DN,M as ag,V as ON,N as lg,Q as ng,U as RN,X as LN,Y as ig,Z as UN,_ as BN,$ as rg,a0 as HN,e as qN,f as GN,c as cg,P as Zc,d as Iu,b as Lu,h as FN,l as VN,m as $N,a1 as QN,a2 as og,a3 as IN,a4 as YN,a5 as XN,a6 as dg,a7 as ug,a8 as mg,a9 as xg,aa as hg,ab as fg,ac as KN}from"./radix-core-C3XKqQJw.js";import{R as Tt,P as gr,C as ta,a as zt,Z as tn,b as Qc,F as Sa,c as JN,S as ai,d as PN,M as Ol,A as ZN,D as WN,e as Ic,f as Zn,T as ey,X as il,g as sy,h as ty,I as Ra,i as Ca,j as Vt,k as Yc,E as dr,l as Ot,m as pg,H as ay,n as Je,o as nl,U as ur,p as gg,q as jg,L as Wf,K as vg,r as bg,s as ly,t as Fc,u as Ks,v as ny,B as lr,w as Xc,x as Yu,y as iy,z as ry,G as Mt,J as Wc,N as ei,O as rt,Q as Rl,V as mr,W as Xu,Y as jr,_ as cy,$ as oy,a0 as ln,a1 as li,a2 as rl,a3 as Ba,a4 as ni,a5 as Ku,a6 as dy,a7 as uy,a8 as my,a9 as an,aa as xy,ab as Ng,ac as Uu,ad as nn,ae as hy,af as si,ag as fy,ah as Bu,ai as Hu,aj as yg,ak as ep,al as py,am as gy,an as jy,ao as ll,ap as wu,aq as sp,ar as vy,as as _u,at as by,au as Ny,av as yy,aw as wy,ax as _y,ay as wg,az as _g,aA as Sg,aB as Cg,aC as Sy,aD as tp,aE as Cy,aF as ky,aG as Ty,aH as Ey}from"./icons-Dkibu3bQ.js";import{S as zy,p as My,j as Ay,a as Dy,E as ap,R as Oy,o as Ry}from"./codemirror-BHeANvwm.js";import{_ as It,c as Ly,g as kg,D as Uy}from"./misc-DyBU7ISD.js";import{u as By,a as lp,D as Hy,c as qy,S as Gy,h as Fy,b as Vy,s as $y,K as Qy,P as Iy,d as Yy,C as Xy}from"./dnd-Dyi3CnuX.js";import{D as Ky,U as Jy}from"./uppy-DUr9_tfX.js";import{M as Py,r as Zy,a as Wy,b as e0}from"./markdown-A1ShuLvG.js";import{r as s0,H as Kc,P as Jc,u as t0,a as a0,R as l0,B as n0,b as i0,C as r0,M as c0,c as o0}from"./reactflow-B3n3_Vkw.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))d(m);new MutationObserver(m=>{for(const x of m)if(x.type==="childList")for(const f of x.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&d(f)}).observe(document,{childList:!0,subtree:!0});function r(m){const x={};return m.integrity&&(x.integrity=m.integrity),m.referrerPolicy&&(x.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?x.credentials="include":m.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function d(m){if(m.ep)return;m.ep=!0;const x=r(m);fetch(m.href,x)}})();var Su={exports:{}},sr={},Cu={exports:{}},ku={};var np;function d0(){return np||(np=1,(function(n){function i(O,F){var q=O.length;O.push(F);e:for(;0>>1,v=O[se];if(0>>1;sem(oe,q))xem(ye,oe)?(O[se]=ye,O[xe]=q,se=xe):(O[se]=oe,O[me]=q,se=me);else if(xem(ye,q))O[se]=ye,O[xe]=q,se=xe;else break e}}return F}function m(O,F){var q=O.sortIndex-F.sortIndex;return q!==0?q:O.id-F.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;n.unstable_now=function(){return x.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var g=[],N=[],j=1,w=null,y=3,T=!1,_=!1,L=!1,D=!1,U=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function z(O){for(var F=r(N);F!==null;){if(F.callback===null)d(N);else if(F.startTime<=O)d(N),F.sortIndex=F.expirationTime,i(g,F);else break;F=r(N)}}function Y(O){if(L=!1,z(O),!_)if(r(g)!==null)_=!0,Q||(Q=!0,ve());else{var F=r(N);F!==null&&Se(Y,F.startTime-O)}}var Q=!1,E=-1,M=5,te=-1;function fe(){return D?!0:!(n.unstable_now()-teO&&fe());){var se=w.callback;if(typeof se=="function"){w.callback=null,y=w.priorityLevel;var v=se(w.expirationTime<=O);if(O=n.unstable_now(),typeof v=="function"){w.callback=v,z(O),F=!0;break s}w===r(g)&&d(g),z(O)}else d(g);w=r(g)}if(w!==null)F=!0;else{var K=r(N);K!==null&&Se(Y,K.startTime-O),F=!1}}break e}finally{w=null,y=q,T=!1}F=void 0}}finally{F?ve():Q=!1}}}var ve;if(typeof R=="function")ve=function(){R(je)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,be=ge.port2;ge.port1.onmessage=je,ve=function(){be.postMessage(null)}}else ve=function(){U(je,0)};function Se(O,F){E=U(function(){O(n.unstable_now())},F)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(O){O.callback=null},n.unstable_forceFrameRate=function(O){0>O||125se?(O.sortIndex=q,i(N,O),r(g)===null&&O===r(N)&&(L?(I(E),E=-1):L=!0,Se(Y,q-se))):(O.sortIndex=v,i(g,O),_||T||(_=!0,Q||(Q=!0,ve()))),O},n.unstable_shouldYield=fe,n.unstable_wrapCallback=function(O){var F=y;return function(){var q=y;y=F;try{return O.apply(this,arguments)}finally{y=q}}}})(ku)),ku}var ip;function u0(){return ip||(ip=1,Cu.exports=d0()),Cu.exports}var rp;function m0(){if(rp)return sr;rp=1;var n=u0(),i=Ib(),r=Yb();function d(s){var t="https://react.dev/errors/"+s;if(1v||(s.current=se[v],se[v]=null,v--)}function oe(s,t){v++,se[v]=s.current,s.current=t}var xe=K(null),ye=K(null),de=K(null),W=K(null);function ae(s,t){switch(oe(de,t),oe(ye,s),oe(xe,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?yf(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=yf(t),s=wf(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}me(xe),oe(xe,s)}function $(){me(xe),me(ye),me(de)}function Z(s){s.memoizedState!==null&&oe(W,s);var t=xe.current,a=wf(t,s.type);t!==a&&(oe(ye,s),oe(xe,a))}function ke(s){ye.current===s&&(me(xe),me(ye)),W.current===s&&(me(W),Xi._currentValue=q)}var He,pe;function Te(s){if(He===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);He=t&&t[1]||"",pe=-1)":-1c||A[l]!==P[c]){var ce=` -`+A[l].replace(" at new "," at ");return s.displayName&&ce.includes("")&&(ce=ce.replace("",s.displayName)),ce}while(1<=l&&0<=c);break}}}finally{Qs=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?Te(a):""}function ie(s,t){switch(s.tag){case 26:case 27:case 5:return Te(s.type);case 16:return Te("Lazy");case 13:return s.child!==t&&t!==null?Te("Suspense Fallback"):Te("Suspense");case 19:return Te("SuspenseList");case 0:case 15:return vt(s.type,!1);case 11:return vt(s.type.render,!1);case 1:return vt(s.type,!0);case 31:return Te("Activity");default:return""}}function qe(s){try{var t="",a=null;do t+=ie(s,a),a=s,s=s.return;while(s);return t}catch(l){return` -Error generating stack: `+l.message+` -`+l.stack}}var gs=Object.prototype.hasOwnProperty,Ys=n.unstable_scheduleCallback,Ls=n.unstable_cancelCallback,ft=n.unstable_shouldYield,ps=n.unstable_requestPaint,Us=n.unstable_now,ja=n.unstable_getCurrentPriorityLevel,va=n.unstable_ImmediatePriority,X=n.unstable_UserBlockingPriority,Ue=n.unstable_NormalPriority,Ee=n.unstable_LowPriority,Qe=n.unstable_IdlePriority,qs=n.log,Ne=n.unstable_setDisableYieldValue,bs=null,Ie=null;function Ps(s){if(typeof qs=="function"&&Ne(s),Ie&&typeof Ie.setStrictMode=="function")try{Ie.setStrictMode(bs,s)}catch{}}var Me=Math.clz32?Math.clz32:Bs,Gs=Math.log,ot=Math.LN2;function Bs(s){return s>>>=0,s===0?32:31-(Gs(s)/ot|0)|0}var Ze=256,Fs=262144,Yt=4194304;function Et(s){var t=s&42;if(t!==0)return t;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ol(s,t,a){var l=s.pendingLanes;if(l===0)return 0;var c=0,o=s.suspendedLanes,h=s.pingedLanes;s=s.warmLanes;var b=l&134217727;return b!==0?(l=b&~o,l!==0?c=Et(l):(h&=b,h!==0?c=Et(h):a||(a=b&~s,a!==0&&(c=Et(a))))):(b=l&~o,b!==0?c=Et(b):h!==0?c=Et(h):a||(a=l&~s,a!==0&&(c=Et(a)))),c===0?0:t!==0&&t!==c&&(t&o)===0&&(o=c&-c,a=t&-t,o>=a||o===32&&(a&4194048)!==0)?t:c}function ba(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function S(s,t){switch(s){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function H(){var s=Yt;return Yt<<=1,(Yt&62914560)===0&&(Yt=4194304),s}function we(s){for(var t=[],a=0;31>a;a++)t.push(s);return t}function Ss(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function At(s,t,a,l,c,o){var h=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var b=s.entanglements,A=s.expirationTimes,P=s.hiddenUpdates;for(a=h&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Dj=/[\n"\\]/g;function la(s){return s.replace(Dj,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ho(s,t,a,l,c,o,h,b){s.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?s.type=h:s.removeAttribute("type"),t!=null?h==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+aa(t)):s.value!==""+aa(t)&&(s.value=""+aa(t)):h!=="submit"&&h!=="reset"||s.removeAttribute("value"),t!=null?fo(s,h,aa(t)):a!=null?fo(s,h,aa(a)):l!=null&&s.removeAttribute("value"),c==null&&o!=null&&(s.defaultChecked=!!o),c!=null&&(s.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?s.name=""+aa(b):s.removeAttribute("name")}function fm(s,t,a,l,c,o,h,b){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(s.type=o),t!=null||a!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){xo(s);return}a=a!=null?""+aa(a):"",t=t!=null?""+aa(t):a,b||t===s.value||(s.value=t),s.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,s.checked=b?s.checked:!!l,s.defaultChecked=!!l,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(s.name=h),xo(s)}function fo(s,t,a){t==="number"&&_r(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function fn(s,t,a,l){if(s=s.options,t){t={};for(var c=0;c"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bo=!1;if(Ga)try{var mi={};Object.defineProperty(mi,"passive",{get:function(){bo=!0}}),window.addEventListener("test",mi,mi),window.removeEventListener("test",mi,mi)}catch{bo=!1}var ul=null,No=null,Cr=null;function ym(){if(Cr)return Cr;var s,t=No,a=t.length,l,c="value"in ul?ul.value:ul.textContent,o=c.length;for(s=0;s=fi),Tm=" ",Em=!1;function zm(s,t){switch(s){case"keyup":return rv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mm(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var vn=!1;function ov(s,t){switch(s){case"compositionend":return Mm(t);case"keypress":return t.which!==32?null:(Em=!0,Tm);case"textInput":return s=t.data,s===Tm&&Em?null:s;default:return null}}function dv(s,t){if(vn)return s==="compositionend"||!Co&&zm(s,t)?(s=ym(),Cr=No=ul=null,vn=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-s};s=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Hm(a)}}function Gm(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?Gm(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function Fm(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=_r(s.document);t instanceof s.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)s=t.contentWindow;else break;t=_r(s.document)}return t}function Eo(s){var t=s&&s.nodeName&&s.nodeName.toLowerCase();return t&&(t==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||t==="textarea"||s.contentEditable==="true")}var jv=Ga&&"documentMode"in document&&11>=document.documentMode,bn=null,zo=null,vi=null,Mo=!1;function Vm(s,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Mo||bn==null||bn!==_r(l)||(l=bn,"selectionStart"in l&&Eo(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),vi&&ji(vi,l)||(vi=l,l=vc(zo,"onSelect"),0>=h,c-=h,Ea=1<<32-Me(t)+c|a<Pe?(xs=ze,ze=null):xs=ze.sibling;var vs=ee(V,ze,J[Pe],ue);if(vs===null){ze===null&&(ze=xs);break}s&&ze&&vs.alternate===null&&t(V,ze),B=o(vs,B,Pe),js===null?Le=vs:js.sibling=vs,js=vs,ze=xs}if(Pe===J.length)return a(V,ze),fs&&Va(V,Pe),Le;if(ze===null){for(;PePe?(xs=ze,ze=null):xs=ze.sibling;var Dl=ee(V,ze,vs.value,ue);if(Dl===null){ze===null&&(ze=xs);break}s&&ze&&Dl.alternate===null&&t(V,ze),B=o(Dl,B,Pe),js===null?Le=Dl:js.sibling=Dl,js=Dl,ze=xs}if(vs.done)return a(V,ze),fs&&Va(V,Pe),Le;if(ze===null){for(;!vs.done;Pe++,vs=J.next())vs=he(V,vs.value,ue),vs!==null&&(B=o(vs,B,Pe),js===null?Le=vs:js.sibling=vs,js=vs);return fs&&Va(V,Pe),Le}for(ze=l(ze);!vs.done;Pe++,vs=J.next())vs=le(ze,V,Pe,vs.value,ue),vs!==null&&(s&&vs.alternate!==null&&ze.delete(vs.key===null?Pe:vs.key),B=o(vs,B,Pe),js===null?Le=vs:js.sibling=vs,js=vs);return s&&ze.forEach(function(Bb){return t(V,Bb)}),fs&&Va(V,Pe),Le}function Ts(V,B,J,ue){if(typeof J=="object"&&J!==null&&J.type===L&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case T:e:{for(var Le=J.key;B!==null;){if(B.key===Le){if(Le=J.type,Le===L){if(B.tag===7){a(V,B.sibling),ue=c(B,J.props.children),ue.return=V,V=ue;break e}}else if(B.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===M&&Xl(Le)===B.type){a(V,B.sibling),ue=c(B,J.props),Si(ue,J),ue.return=V,V=ue;break e}a(V,B);break}else t(V,B);B=B.sibling}J.type===L?(ue=Vl(J.props.children,V.mode,ue,J.key),ue.return=V,V=ue):(ue=Lr(J.type,J.key,J.props,null,V.mode,ue),Si(ue,J),ue.return=V,V=ue)}return h(V);case _:e:{for(Le=J.key;B!==null;){if(B.key===Le)if(B.tag===4&&B.stateNode.containerInfo===J.containerInfo&&B.stateNode.implementation===J.implementation){a(V,B.sibling),ue=c(B,J.children||[]),ue.return=V,V=ue;break e}else{a(V,B);break}else t(V,B);B=B.sibling}ue=Bo(J,V.mode,ue),ue.return=V,V=ue}return h(V);case M:return J=Xl(J),Ts(V,B,J,ue)}if(Se(J))return Ce(V,B,J,ue);if(ve(J)){if(Le=ve(J),typeof Le!="function")throw Error(d(150));return J=Le.call(J),Ve(V,B,J,ue)}if(typeof J.then=="function")return Ts(V,B,Vr(J),ue);if(J.$$typeof===R)return Ts(V,B,Hr(V,J),ue);$r(V,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,B!==null&&B.tag===6?(a(V,B.sibling),ue=c(B,J),ue.return=V,V=ue):(a(V,B),ue=Uo(J,V.mode,ue),ue.return=V,V=ue),h(V)):a(V,B)}return function(V,B,J,ue){try{_i=0;var Le=Ts(V,B,J,ue);return Mn=null,Le}catch(ze){if(ze===zn||ze===Gr)throw ze;var js=Kt(29,ze,null,V.mode);return js.lanes=ue,js.return=V,js}finally{}}}var Jl=mx(!0),xx=mx(!1),pl=!1;function Jo(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Po(s,t){s=s.updateQueue,t.updateQueue===s&&(t.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function gl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function jl(s,t,a){var l=s.updateQueue;if(l===null)return null;if(l=l.shared,(Ns&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=Rr(s),Jm(s,null,a),t}return Or(s,l,t,a),Rr(s)}function Ci(s,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=s.pendingLanes,a|=l,t.lanes=a,ci(s,a)}}function Zo(s,t){var a=s.updateQueue,l=s.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var c=null,o=null;if(a=a.firstBaseUpdate,a!==null){do{var h={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};o===null?c=o=h:o=o.next=h,a=a.next}while(a!==null);o===null?c=o=t:o=o.next=t}else c=o=t;a={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:o,shared:l.shared,callbacks:l.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=t:s.next=t,a.lastBaseUpdate=t}var Wo=!1;function ki(){if(Wo){var s=En;if(s!==null)throw s}}function Ti(s,t,a,l){Wo=!1;var c=s.updateQueue;pl=!1;var o=c.firstBaseUpdate,h=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var A=b,P=A.next;A.next=null,h===null?o=P:h.next=P,h=A;var ce=s.alternate;ce!==null&&(ce=ce.updateQueue,b=ce.lastBaseUpdate,b!==h&&(b===null?ce.firstBaseUpdate=P:b.next=P,ce.lastBaseUpdate=A))}if(o!==null){var he=c.baseState;h=0,ce=P=A=null,b=o;do{var ee=b.lane&-536870913,le=ee!==b.lane;if(le?(ms&ee)===ee:(l&ee)===ee){ee!==0&&ee===Tn&&(Wo=!0),ce!==null&&(ce=ce.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var Ce=s,Ve=b;ee=t;var Ts=a;switch(Ve.tag){case 1:if(Ce=Ve.payload,typeof Ce=="function"){he=Ce.call(Ts,he,ee);break e}he=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=Ve.payload,ee=typeof Ce=="function"?Ce.call(Ts,he,ee):Ce,ee==null)break e;he=w({},he,ee);break e;case 2:pl=!0}}ee=b.callback,ee!==null&&(s.flags|=64,le&&(s.flags|=8192),le=c.callbacks,le===null?c.callbacks=[ee]:le.push(ee))}else le={lane:ee,tag:b.tag,payload:b.payload,callback:b.callback,next:null},ce===null?(P=ce=le,A=he):ce=ce.next=le,h|=ee;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;le=b,b=le.next,le.next=null,c.lastBaseUpdate=le,c.shared.pending=null}}while(!0);ce===null&&(A=he),c.baseState=A,c.firstBaseUpdate=P,c.lastBaseUpdate=ce,o===null&&(c.shared.lanes=0),wl|=h,s.lanes=h,s.memoizedState=he}}function hx(s,t){if(typeof s!="function")throw Error(d(191,s));s.call(t)}function fx(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;so?o:8;var h=O.T,b={};O.T=b,jd(s,!1,t,a);try{var A=c(),P=O.S;if(P!==null&&P(b,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var ce=kv(A,l);Mi(s,t,ce,ea(s))}else Mi(s,t,l,ea(s))}catch(he){Mi(s,t,{then:function(){},status:"rejected",reason:he},ea())}finally{F.p=o,h!==null&&b.types!==null&&(h.types=b.types),O.T=h}}function Dv(){}function pd(s,t,a,l){if(s.tag!==5)throw Error(d(476));var c=Yx(s).queue;Ix(s,c,t,q,a===null?Dv:function(){return Xx(s),a(l)})}function Yx(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:q,baseState:q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ya,lastRenderedState:q},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ya,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function Xx(s){var t=Yx(s);t.next===null&&(t=s.alternate.memoizedState),Mi(s,t.next.queue,{},ea())}function gd(){return _t(Xi)}function Kx(){return it().memoizedState}function Jx(){return it().memoizedState}function Ov(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=ea();s=gl(a);var l=jl(t,s,a);l!==null&&(Gt(l,t,a),Ci(l,t,a)),t={cache:Io()},s.payload=t;return}t=t.return}}function Rv(s,t,a){var l=ea();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ec(s)?Zx(t,a):(a=Ro(s,t,a,l),a!==null&&(Gt(a,s,l),Wx(a,t,l)))}function Px(s,t,a){var l=ea();Mi(s,t,a,l)}function Mi(s,t,a,l){var c={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(ec(s))Zx(t,c);else{var o=s.alternate;if(s.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var h=t.lastRenderedState,b=o(h,a);if(c.hasEagerState=!0,c.eagerState=b,Xt(b,h))return Or(s,t,c,0),zs===null&&Dr(),!1}catch{}finally{}if(a=Ro(s,t,c,l),a!==null)return Gt(a,s,l),Wx(a,t,l),!0}return!1}function jd(s,t,a,l){if(l={lane:2,revertLane:Jd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ec(s)){if(t)throw Error(d(479))}else t=Ro(s,a,l,2),t!==null&&Gt(t,s,2)}function ec(s){var t=s.alternate;return s===Xe||t!==null&&t===Xe}function Zx(s,t){Dn=Yr=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function Wx(s,t,a){if((a&4194048)!==0){var l=t.lanes;l&=s.pendingLanes,a|=l,t.lanes=a,ci(s,a)}}var Ai={readContext:_t,use:Jr,useCallback:Zs,useContext:Zs,useEffect:Zs,useImperativeHandle:Zs,useLayoutEffect:Zs,useInsertionEffect:Zs,useMemo:Zs,useReducer:Zs,useRef:Zs,useState:Zs,useDebugValue:Zs,useDeferredValue:Zs,useTransition:Zs,useSyncExternalStore:Zs,useId:Zs,useHostTransitionStatus:Zs,useFormState:Zs,useActionState:Zs,useOptimistic:Zs,useMemoCache:Zs,useCacheRefresh:Zs};Ai.useEffectEvent=Zs;var eh={readContext:_t,use:Jr,useCallback:function(s,t){return Dt().memoizedState=[s,t===void 0?null:t],s},useContext:_t,useEffect:Ux,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,Zr(4194308,4,Gx.bind(null,t,s),a)},useLayoutEffect:function(s,t){return Zr(4194308,4,s,t)},useInsertionEffect:function(s,t){Zr(4,2,s,t)},useMemo:function(s,t){var a=Dt();t=t===void 0?null:t;var l=s();if(Pl){Ps(!0);try{s()}finally{Ps(!1)}}return a.memoizedState=[l,t],l},useReducer:function(s,t,a){var l=Dt();if(a!==void 0){var c=a(t);if(Pl){Ps(!0);try{a(t)}finally{Ps(!1)}}}else c=t;return l.memoizedState=l.baseState=c,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:c},l.queue=s,s=s.dispatch=Rv.bind(null,Xe,s),[l.memoizedState,s]},useRef:function(s){var t=Dt();return s={current:s},t.memoizedState=s},useState:function(s){s=ud(s);var t=s.queue,a=Px.bind(null,Xe,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:hd,useDeferredValue:function(s,t){var a=Dt();return fd(a,s,t)},useTransition:function(){var s=ud(!1);return s=Ix.bind(null,Xe,s.queue,!0,!1),Dt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var l=Xe,c=Dt();if(fs){if(a===void 0)throw Error(d(407));a=a()}else{if(a=t(),zs===null)throw Error(d(349));(ms&127)!==0||Nx(l,t,a)}c.memoizedState=a;var o={value:a,getSnapshot:t};return c.queue=o,Ux(wx.bind(null,l,o,s),[s]),l.flags|=2048,Rn(9,{destroy:void 0},yx.bind(null,l,o,a,t),null),a},useId:function(){var s=Dt(),t=zs.identifierPrefix;if(fs){var a=za,l=Ea;a=(l&~(1<<32-Me(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Xr++,0<\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof l.is=="string"?h.createElement("select",{is:l.is}):h.createElement("select"),l.multiple?o.multiple=!0:l.size&&(o.size=l.size);break;default:o=typeof l.is=="string"?h.createElement(c,{is:l.is}):h.createElement(c)}}o[yt]=t,o[Rt]=l;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)o.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=o;e:switch(Ct(o,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Ka(t)}}return $s(t),Ad(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==l&&Ka(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(d(166));if(s=de.current,Cn(t)){if(s=t.stateNode,a=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}s[yt]=t,s=!!(s.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||bf(s.nodeValue,a)),s||hl(t,!0)}else s=bc(s).createTextNode(l),s[yt]=t,t.stateNode=s}return $s(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(l=Cn(t),a!==null){if(s===null){if(!l)throw Error(d(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(d(557));s[yt]=t}else $l(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;$s(t),s=!1}else a=Fo(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(Pt(t),t):(Pt(t),null);if((t.flags&128)!==0)throw Error(d(558))}return $s(t),null;case 13:if(l=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(c=Cn(t),l!==null&&l.dehydrated!==null){if(s===null){if(!c)throw Error(d(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(d(317));c[yt]=t}else $l(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;$s(t),c=!1}else c=Fo(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Pt(t),t):(Pt(t),null)}return Pt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,s=s!==null&&s.memoizedState!==null,a&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==c&&(l.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),nc(t,t.updateQueue),$s(t),null);case 4:return $(),s===null&&eu(t.stateNode.containerInfo),$s(t),null;case 10:return Qa(t.type),$s(t),null;case 19:if(me(nt),l=t.memoizedState,l===null)return $s(t),null;if(c=(t.flags&128)!==0,o=l.rendering,o===null)if(c)Oi(l,!1);else{if(Ws!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(o=Ir(s),o!==null){for(t.flags|=128,Oi(l,!1),s=o.updateQueue,t.updateQueue=s,nc(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)Pm(a,s),a=a.sibling;return oe(nt,nt.current&1|2),fs&&Va(t,l.treeForkCount),t.child}s=s.sibling}l.tail!==null&&Us()>dc&&(t.flags|=128,c=!0,Oi(l,!1),t.lanes=4194304)}else{if(!c)if(s=Ir(o),s!==null){if(t.flags|=128,c=!0,s=s.updateQueue,t.updateQueue=s,nc(t,s),Oi(l,!0),l.tail===null&&l.tailMode==="hidden"&&!o.alternate&&!fs)return $s(t),null}else 2*Us()-l.renderingStartTime>dc&&a!==536870912&&(t.flags|=128,c=!0,Oi(l,!1),t.lanes=4194304);l.isBackwards?(o.sibling=t.child,t.child=o):(s=l.last,s!==null?s.sibling=o:t.child=o,l.last=o)}return l.tail!==null?(s=l.tail,l.rendering=s,l.tail=s.sibling,l.renderingStartTime=Us(),s.sibling=null,a=nt.current,oe(nt,c?a&1|2:a&1),fs&&Va(t,l.treeForkCount),s):($s(t),null);case 22:case 23:return Pt(t),sd(),l=t.memoizedState!==null,s!==null?s.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&($s(t),t.subtreeFlags&6&&(t.flags|=8192)):$s(t),a=t.updateQueue,a!==null&&nc(t,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),s!==null&&me(Yl),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Qa(dt),$s(t),null;case 25:return null;case 30:return null}throw Error(d(156,t.tag))}function qv(s,t){switch(qo(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return Qa(dt),$(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return ke(t),null;case 31:if(t.memoizedState!==null){if(Pt(t),t.alternate===null)throw Error(d(340));$l()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(Pt(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(d(340));$l()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return me(nt),null;case 4:return $(),null;case 10:return Qa(t.type),null;case 22:case 23:return Pt(t),sd(),s!==null&&me(Yl),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return Qa(dt),null;case 25:return null;default:return null}}function _h(s,t){switch(qo(t),t.tag){case 3:Qa(dt),$();break;case 26:case 27:case 5:ke(t);break;case 4:$();break;case 31:t.memoizedState!==null&&Pt(t);break;case 13:Pt(t);break;case 19:me(nt);break;case 10:Qa(t.type);break;case 22:case 23:Pt(t),sd(),s!==null&&me(Yl);break;case 24:Qa(dt)}}function Ri(s,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var c=l.next;a=c;do{if((a.tag&s)===s){l=void 0;var o=a.create,h=a.inst;l=o(),h.destroy=l}a=a.next}while(a!==c)}}catch(b){_s(t,t.return,b)}}function Nl(s,t,a){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var o=c.next;l=o;do{if((l.tag&s)===s){var h=l.inst,b=h.destroy;if(b!==void 0){h.destroy=void 0,c=t;var A=a,P=b;try{P()}catch(ce){_s(c,A,ce)}}}l=l.next}while(l!==o)}}catch(ce){_s(t,t.return,ce)}}function Sh(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{fx(t,a)}catch(l){_s(s,s.return,l)}}}function Ch(s,t,a){a.props=Zl(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(l){_s(s,t,l)}}function Li(s,t){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var l=s.stateNode;break;case 30:l=s.stateNode;break;default:l=s.stateNode}typeof a=="function"?s.refCleanup=a(l):a.current=l}}catch(c){_s(s,t,c)}}function Ma(s,t){var a=s.ref,l=s.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(c){_s(s,t,c)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){_s(s,t,c)}else a.current=null}function kh(s){var t=s.type,a=s.memoizedProps,l=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(c){_s(s,s.return,c)}}function Dd(s,t,a){try{var l=s.stateNode;cb(l,s.type,a,t),l[Rt]=t}catch(c){_s(s,s.return,c)}}function Th(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Tl(s.type)||s.tag===4}function Od(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Th(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Tl(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Rd(s,t,a){var l=s.tag;if(l===5||l===6)s=s.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(s),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=qa));else if(l!==4&&(l===27&&Tl(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(Rd(s,t,a),s=s.sibling;s!==null;)Rd(s,t,a),s=s.sibling}function ic(s,t,a){var l=s.tag;if(l===5||l===6)s=s.stateNode,t?a.insertBefore(s,t):a.appendChild(s);else if(l!==4&&(l===27&&Tl(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(ic(s,t,a),s=s.sibling;s!==null;)ic(s,t,a),s=s.sibling}function Eh(s){var t=s.stateNode,a=s.memoizedProps;try{for(var l=s.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Ct(t,l,a),t[yt]=s,t[Rt]=a}catch(o){_s(s,s.return,o)}}var Ja=!1,xt=!1,Ld=!1,zh=typeof WeakSet=="function"?WeakSet:Set,Nt=null;function Gv(s,t){if(s=s.containerInfo,au=kc,s=Fm(s),Eo(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var c=l.anchorOffset,o=l.focusNode;l=l.focusOffset;try{a.nodeType,o.nodeType}catch{a=null;break e}var h=0,b=-1,A=-1,P=0,ce=0,he=s,ee=null;s:for(;;){for(var le;he!==a||c!==0&&he.nodeType!==3||(b=h+c),he!==o||l!==0&&he.nodeType!==3||(A=h+l),he.nodeType===3&&(h+=he.nodeValue.length),(le=he.firstChild)!==null;)ee=he,he=le;for(;;){if(he===s)break s;if(ee===a&&++P===c&&(b=h),ee===o&&++ce===l&&(A=h),(le=he.nextSibling)!==null)break;he=ee,ee=he.parentNode}he=le}a=b===-1||A===-1?null:{start:b,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for(lu={focusedElem:s,selectionRange:a},kc=!1,Nt=t;Nt!==null;)if(t=Nt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Nt=s;else for(;Nt!==null;){switch(t=Nt,o=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(a=0;a title"))),Ct(o,l,a),o[yt]=s,bt(o),l=o;break e;case"link":var h=Uf("link","href",c).get(l+(a.href||""));if(h){for(var b=0;bTs&&(h=Ts,Ts=Ve,Ve=h);var V=qm(b,Ve),B=qm(b,Ts);if(V&&B&&(le.rangeCount!==1||le.anchorNode!==V.node||le.anchorOffset!==V.offset||le.focusNode!==B.node||le.focusOffset!==B.offset)){var J=he.createRange();J.setStart(V.node,V.offset),le.removeAllRanges(),Ve>Ts?(le.addRange(J),le.extend(B.node,B.offset)):(J.setEnd(B.node,B.offset),le.addRange(J))}}}}for(he=[],le=b;le=le.parentNode;)le.nodeType===1&&he.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;ba?32:a,O.T=null,a=Vd,Vd=null;var o=Sl,h=sl;if(pt=0,qn=Sl=null,sl=0,(Ns&6)!==0)throw Error(d(331));var b=Ns;if(Ns|=4,Gh(o.current),Bh(o,o.current,h,a),Ns=b,Fi(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot=="function")try{Ie.onPostCommitFiberRoot(bs,o)}catch{}return!0}finally{F.p=c,O.T=l,nf(s,t)}}function cf(s,t,a){t=ia(a,t),t=yd(s.stateNode,t,2),s=jl(s,t,2),s!==null&&(Ss(s,2),Aa(s))}function _s(s,t,a){if(s.tag===3)cf(s,s,a);else for(;t!==null;){if(t.tag===3){cf(t,s,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(_l===null||!_l.has(l))){s=ia(a,s),a=ch(2),l=jl(t,a,2),l!==null&&(oh(a,l,t,s),Ss(l,2),Aa(l));break}}t=t.return}}function Yd(s,t,a){var l=s.pingCache;if(l===null){l=s.pingCache=new $v;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(a)||(Hd=!0,c.add(a),s=Kv.bind(null,s,t,a),t.then(s,s))}function Kv(s,t,a){var l=s.pingCache;l!==null&&l.delete(t),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,zs===s&&(ms&a)===a&&(Ws===4||Ws===3&&(ms&62914560)===ms&&300>Us()-oc?(Ns&2)===0&&Gn(s,0):qd|=a,Hn===ms&&(Hn=0)),Aa(s)}function of(s,t){t===0&&(t=H()),s=Fl(s,t),s!==null&&(Ss(s,t),Aa(s))}function Jv(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),of(s,a)}function Pv(s,t){var a=0;switch(s.tag){case 31:case 13:var l=s.stateNode,c=s.memoizedState;c!==null&&(a=c.retryLane);break;case 19:l=s.stateNode;break;case 22:l=s.stateNode._retryCache;break;default:throw Error(d(314))}l!==null&&l.delete(t),of(s,a)}function Zv(s,t){return Ys(s,t)}var pc=null,Vn=null,Xd=!1,gc=!1,Kd=!1,kl=0;function Aa(s){s!==Vn&&s.next===null&&(Vn===null?pc=Vn=s:Vn=Vn.next=s),gc=!0,Xd||(Xd=!0,eb())}function Fi(s,t){if(!Kd&&gc){Kd=!0;do for(var a=!1,l=pc;l!==null;){if(s!==0){var c=l.pendingLanes;if(c===0)var o=0;else{var h=l.suspendedLanes,b=l.pingedLanes;o=(1<<31-Me(42|s)+1)-1,o&=c&~(h&~b),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(a=!0,xf(l,o))}else o=ms,o=ol(l,l===zs?o:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(o&3)===0||ba(l,o)||(a=!0,xf(l,o));l=l.next}while(a);Kd=!1}}function Wv(){df()}function df(){gc=Xd=!1;var s=0;kl!==0&&db()&&(s=kl);for(var t=Us(),a=null,l=pc;l!==null;){var c=l.next,o=uf(l,t);o===0?(l.next=null,a===null?pc=c:a.next=c,c===null&&(Vn=a)):(a=l,(s!==0||(o&3)!==0)&&(gc=!0)),l=c}pt!==0&&pt!==5||Fi(s),kl!==0&&(kl=0)}function uf(s,t){for(var a=s.suspendedLanes,l=s.pingedLanes,c=s.expirationTimes,o=s.pendingLanes&-62914561;0b)break;var ce=A.transferSize,he=A.initiatorType;ce&&Nf(he)&&(A=A.responseEnd,h+=ce*(A"u"?null:document;function Df(s,t,a){var l=$n;if(l&&typeof t=="string"&&t){var c=la(t);c='link[rel="'+s+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),Af.has(c)||(Af.add(c),s={rel:s,crossOrigin:a,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),Ct(t,"link",s),bt(t),l.head.appendChild(t)))}}function vb(s){tl.D(s),Df("dns-prefetch",s,null)}function bb(s,t){tl.C(s,t),Df("preconnect",s,t)}function Nb(s,t,a){tl.L(s,t,a);var l=$n;if(l&&s&&t){var c='link[rel="preload"][as="'+la(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+la(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+la(a.imageSizes)+'"]')):c+='[href="'+la(s)+'"]';var o=c;switch(t){case"style":o=Qn(s);break;case"script":o=In(s)}ma.has(o)||(s=w({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),ma.set(o,s),l.querySelector(c)!==null||t==="style"&&l.querySelector(Ii(o))||t==="script"&&l.querySelector(Yi(o))||(t=l.createElement("link"),Ct(t,"link",s),bt(t),l.head.appendChild(t)))}}function yb(s,t){tl.m(s,t);var a=$n;if(a&&s){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+la(l)+'"][href="'+la(s)+'"]',o=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=In(s)}if(!ma.has(o)&&(s=w({rel:"modulepreload",href:s},t),ma.set(o,s),a.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Yi(o)))return}l=a.createElement("link"),Ct(l,"link",s),bt(l),a.head.appendChild(l)}}}function wb(s,t,a){tl.S(s,t,a);var l=$n;if(l&&s){var c=xn(l).hoistableStyles,o=Qn(s);t=t||"default";var h=c.get(o);if(!h){var b={loading:0,preload:null};if(h=l.querySelector(Ii(o)))b.loading=5;else{s=w({rel:"stylesheet",href:s,"data-precedence":t},a),(a=ma.get(o))&&uu(s,a);var A=h=l.createElement("link");bt(A),Ct(A,"link",s),A._p=new Promise(function(P,ce){A.onload=P,A.onerror=ce}),A.addEventListener("load",function(){b.loading|=1}),A.addEventListener("error",function(){b.loading|=2}),b.loading|=4,yc(h,t,l)}h={type:"stylesheet",instance:h,count:1,state:b},c.set(o,h)}}}function _b(s,t){tl.X(s,t);var a=$n;if(a&&s){var l=xn(a).hoistableScripts,c=In(s),o=l.get(c);o||(o=a.querySelector(Yi(c)),o||(s=w({src:s,async:!0},t),(t=ma.get(c))&&mu(s,t),o=a.createElement("script"),bt(o),Ct(o,"link",s),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(c,o))}}function Sb(s,t){tl.M(s,t);var a=$n;if(a&&s){var l=xn(a).hoistableScripts,c=In(s),o=l.get(c);o||(o=a.querySelector(Yi(c)),o||(s=w({src:s,async:!0,type:"module"},t),(t=ma.get(c))&&mu(s,t),o=a.createElement("script"),bt(o),Ct(o,"link",s),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(c,o))}}function Of(s,t,a,l){var c=(c=de.current)?Nc(c):null;if(!c)throw Error(d(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Qn(a.href),a=xn(c).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=Qn(a.href);var o=xn(c).hoistableStyles,h=o.get(s);if(h||(c=c.ownerDocument||c,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(s,h),(o=c.querySelector(Ii(s)))&&!o._p&&(h.instance=o,h.state.loading=5),ma.has(s)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ma.set(s,a),o||Cb(c,s,a,h.state))),t&&l===null)throw Error(d(528,""));return h}if(t&&l!==null)throw Error(d(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=In(a),a=xn(c).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(d(444,s))}}function Qn(s){return'href="'+la(s)+'"'}function Ii(s){return'link[rel="stylesheet"]['+s+"]"}function Rf(s){return w({},s,{"data-precedence":s.precedence,precedence:null})}function Cb(s,t,a,l){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=s.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),Ct(t,"link",a),bt(t),s.head.appendChild(t))}function In(s){return'[src="'+la(s)+'"]'}function Yi(s){return"script[async]"+s}function Lf(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=s.querySelector('style[data-href~="'+la(a.href)+'"]');if(l)return t.instance=l,bt(l),l;var c=w({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(s.ownerDocument||s).createElement("style"),bt(l),Ct(l,"style",c),yc(l,a.precedence,s),t.instance=l;case"stylesheet":c=Qn(a.href);var o=s.querySelector(Ii(c));if(o)return t.state.loading|=4,t.instance=o,bt(o),o;l=Rf(a),(c=ma.get(c))&&uu(l,c),o=(s.ownerDocument||s).createElement("link"),bt(o);var h=o;return h._p=new Promise(function(b,A){h.onload=b,h.onerror=A}),Ct(o,"link",l),t.state.loading|=4,yc(o,a.precedence,s),t.instance=o;case"script":return o=In(a.src),(c=s.querySelector(Yi(o)))?(t.instance=c,bt(c),c):(l=a,(c=ma.get(o))&&(l=w({},a),mu(l,c)),s=s.ownerDocument||s,c=s.createElement("script"),bt(c),Ct(c,"link",l),s.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(d(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,yc(l,a.precedence,s));return t.instance}function yc(s,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,o=c,h=0;h title"):null)}function kb(s,t,a){if(a===1||t.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return s=t.disabled,typeof t.precedence=="string"&&s==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Hf(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Tb(s,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var c=Qn(l.href),o=t.querySelector(Ii(c));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=_c.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=o,bt(o);return}o=t.ownerDocument||t,l=Rf(l),(c=ma.get(c))&&uu(l,c),o=o.createElement("link"),bt(o);var h=o;h._p=new Promise(function(b,A){h.onload=b,h.onerror=A}),Ct(o,"link",l),a.instance=o}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=_c.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var xu=0;function Eb(s,t){return s.stylesheets&&s.count===0&&Cc(s,s.stylesheets),0xu?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function _c(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cc(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Sc=null;function Cc(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Sc=new Map,t.forEach(zb,s),Sc=null,_c.call(s))}function zb(s,t){if(!(t.state.loading&4)){var a=Sc.get(s);if(a)var l=a.get(null);else{a=new Map,Sc.set(s,a);for(var c=s.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Su.exports=m0(),Su.exports}var h0=x0();function G(...n){return Kb(Jb(n))}const $e=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:G("rounded-xl border bg-card text-card-foreground shadow",n),...i}));$e.displayName="Card";const We=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:G("flex flex-col space-y-1.5 p-6",n),...i}));We.displayName="CardHeader";const es=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:G("font-semibold leading-none tracking-tight",n),...i}));es.displayName="CardTitle";const st=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:G("text-sm text-muted-foreground",n),...i}));st.displayName="CardDescription";const hs=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:G("p-6 pt-0",n),...i}));hs.displayName="CardContent";const Tg=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:G("flex items-center p-6 pt-0",n),...i}));Tg.displayName="CardFooter";const ka=Wb,fa=u.forwardRef(({className:n,...i},r)=>e.jsx(Ep,{ref:r,className:G("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",n),...i}));fa.displayName=Ep.displayName;const ss=u.forwardRef(({className:n,...i},r)=>e.jsx(zp,{ref:r,className:G("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",n),...i}));ss.displayName=zp.displayName;const ys=u.forwardRef(({className:n,...i},r)=>e.jsx(Mp,{ref:r,className:G("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",n),...i}));ys.displayName=Mp.displayName;const Ke=u.forwardRef(({className:n,children:i,viewportRef:r,...d},m)=>e.jsxs(Ap,{ref:m,className:G("relative overflow-hidden",n),...d,children:[e.jsx(eN,{ref:r,className:"h-full w-full rounded-[inherit]",children:i}),e.jsx(qu,{}),e.jsx(qu,{orientation:"horizontal"}),e.jsx(sN,{})]}));Ke.displayName=Ap.displayName;const qu=u.forwardRef(({className:n,orientation:i="vertical",...r},d)=>e.jsx(Dp,{ref:d,orientation:i,className:G("flex touch-none select-none transition-colors",i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",n),...r,children:e.jsx(tN,{className:"relative flex-1 rounded-full bg-border"})}));qu.displayName=Dp.displayName;function Eg({className:n,...i}){return e.jsx("div",{className:G("animate-pulse rounded-md bg-primary/10",n),...i})}const ii=u.forwardRef(({className:n,value:i,...r},d)=>e.jsx(Op,{ref:d,className:G("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...r,children:e.jsx(aN,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(i||0)}%)`}})}));ii.displayName=Op.displayName;const f0={light:"",dark:".dark"},zg=u.createContext(null);function Mg(){const n=u.useContext(zg);if(!n)throw new Error("useChart must be used within a ");return n}const Kn=u.forwardRef(({id:n,className:i,children:r,config:d,...m},x)=>{const f=u.useId(),p=`chart-${n||f.replace(/:/g,"")}`;return e.jsx(zg.Provider,{value:{config:d},children:e.jsxs("div",{"data-chart":p,ref:x,className:G("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",i),...m,children:[e.jsx(p0,{id:p,config:d}),e.jsx(vN,{children:r})]})})});Kn.displayName="Chart";const p0=({id:n,config:i})=>{const r=Object.entries(i).filter(([,d])=>d.theme||d.color);return r.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(f0).map(([d,m])=>` -${m} [data-chart=${n}] { -${r.map(([x,f])=>{const p=f.theme?.[d]||f.color;return p?` --color-${x}: ${p};`:null}).join(` -`)} -} -`).join(` -`)}}):null},tr=bN,Jn=u.forwardRef(({active:n,payload:i,className:r,indicator:d="dot",hideLabel:m=!1,hideIndicator:x=!1,label:f,labelFormatter:p,labelClassName:g,formatter:N,color:j,nameKey:w,labelKey:y},T)=>{const{config:_}=Mg(),L=u.useMemo(()=>{if(m||!i?.length)return null;const[U]=i,I=`${y||U?.dataKey||U?.name||"value"}`,R=Gu(_,U,I),z=!y&&typeof f=="string"?_[f]?.label||f:R?.label;return p?e.jsx("div",{className:G("font-medium",g),children:p(z,i)}):z?e.jsx("div",{className:G("font-medium",g),children:z}):null},[f,p,i,m,g,_,y]);if(!n||!i?.length)return null;const D=i.length===1&&d!=="dot";return e.jsxs("div",{ref:T,className:G("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[D?null:L,e.jsx("div",{className:"grid gap-1.5",children:i.filter(U=>U.type!=="none").map((U,I)=>{const R=`${w||U.name||U.dataKey||"value"}`,z=Gu(_,U,R),Y=j||U.payload.fill||U.color;return e.jsx("div",{className:G("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",d==="dot"&&"items-center"),children:N&&U?.value!==void 0&&U.name?N(U.value,U.name,U,I,U.payload):e.jsxs(e.Fragment,{children:[z?.icon?e.jsx(z.icon,{}):!x&&e.jsx("div",{className:G("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":d==="dot","w-1":d==="line","w-0 border-[1.5px] border-dashed bg-transparent":d==="dashed","my-0.5":D&&d==="dashed"}),style:{"--color-bg":Y,"--color-border":Y}}),e.jsxs("div",{className:G("flex flex-1 justify-between leading-none",D?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[D?L:null,e.jsx("span",{className:"text-muted-foreground",children:z?.label||U.name})]}),U.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:U.value.toLocaleString()})]})]})},U.dataKey)})})]})});Jn.displayName="ChartTooltip";const g0=NN,Ag=u.forwardRef(({className:n,hideIcon:i=!1,payload:r,verticalAlign:d="bottom",nameKey:m},x)=>{const{config:f}=Mg();return r?.length?e.jsx("div",{ref:x,className:G("flex items-center justify-center gap-4",d==="top"?"pb-3":"pt-3",n),children:r.filter(p=>p.type!=="none").map(p=>{const g=`${m||p.dataKey||"value"}`,N=Gu(f,p,g);return e.jsxs("div",{className:G("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[N?.icon&&!i?e.jsx(N.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:p.color}}),N?.label]},p.value)})}):null});Ag.displayName="ChartLegend";function Gu(n,i,r){if(typeof i!="object"||i===null)return;const d="payload"in i&&typeof i.payload=="object"&&i.payload!==null?i.payload:void 0;let m=r;return r in i&&typeof i[r]=="string"?m=i[r]:d&&r in d&&typeof d[r]=="string"&&(m=d[r]),m in n?n[m]:n[r]}const xr=ti("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),C=u.forwardRef(({className:n,variant:i,size:r,asChild:d=!1,...m},x)=>{const f=d?kN:"button";return e.jsx(f,{className:G(xr({variant:i,size:r,className:n})),ref:x,...m})});C.displayName="Button";const j0=ti("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Fe({className:n,variant:i,...r}){return e.jsx("div",{className:G(j0({variant:i}),n),...r})}const v0=5,b0=5e3;let Tu=0;function N0(){return Tu=(Tu+1)%Number.MAX_SAFE_INTEGER,Tu.toString()}const Eu=new Map,op=n=>{if(Eu.has(n))return;const i=setTimeout(()=>{Eu.delete(n),or({type:"REMOVE_TOAST",toastId:n})},b0);Eu.set(n,i)},y0=(n,i)=>{switch(i.type){case"ADD_TOAST":return{...n,toasts:[i.toast,...n.toasts].slice(0,v0)};case"UPDATE_TOAST":return{...n,toasts:n.toasts.map(r=>r.id===i.toast.id?{...r,...i.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=i;return r?op(r):n.toasts.forEach(d=>{op(d.id)}),{...n,toasts:n.toasts.map(d=>d.id===r||r===void 0?{...d,open:!1}:d)}}case"REMOVE_TOAST":return i.toastId===void 0?{...n,toasts:[]}:{...n,toasts:n.toasts.filter(r=>r.id!==i.toastId)}}},Vc=[];let $c={toasts:[]};function or(n){$c=y0($c,n),Vc.forEach(i=>{i($c)})}function w0({...n}){const i=N0(),r=m=>or({type:"UPDATE_TOAST",toast:{...m,id:i}}),d=()=>or({type:"DISMISS_TOAST",toastId:i});return or({type:"ADD_TOAST",toast:{...n,id:i,open:!0,onOpenChange:m=>{m||d()}}}),{id:i,dismiss:d,update:r}}function Rs(){const[n,i]=u.useState($c);return u.useEffect(()=>(Vc.push(i),()=>{const r=Vc.indexOf(i);r>-1&&Vc.splice(r,1)}),[n]),{...n,toast:w0,dismiss:r=>or({type:"DISMISS_TOAST",toastId:r})}}const _0=n=>{const i=[];for(let r=0;r{try{T(!0);const v=await Oc.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");w({hitokoto:v.data.hitokoto,from:v.data.from||v.data.from_who||"未知"})}catch(v){console.error("获取一言失败:",v),w({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{T(!1)}},[]),z=u.useCallback(async()=>{try{const v=localStorage.getItem("access-token"),K=await Oc.get("/api/webui/system/status",{headers:{Authorization:`Bearer ${v}`}});L(K.data)}catch(v){console.error("获取机器人状态失败:",v),L(null)}},[]),Y=async()=>{if(!D)try{U(!0);const v=localStorage.getItem("access-token");await Oc.post("/api/webui/system/restart",{},{headers:{Authorization:`Bearer ${v}`}}),I({title:"重启中",description:"麦麦正在重启,请稍候..."}),setTimeout(()=>{z(),U(!1)},3e3)}catch(v){console.error("重启失败:",v),I({title:"重启失败",description:"无法重启麦麦,请检查控制台",variant:"destructive"}),U(!1)}},Q=u.useCallback(async()=>{try{const v=localStorage.getItem("access-token"),K=await Oc.get(`/api/webui/statistics/dashboard?hours=${f}`,{headers:{Authorization:`Bearer ${v}`}});i(K.data),d(!1),x(100)}catch(v){console.error("Failed to fetch dashboard data:",v),d(!1),x(100)}},[f]);if(u.useEffect(()=>{if(!r)return;x(0);const v=setTimeout(()=>x(15),200),K=setTimeout(()=>x(30),800),me=setTimeout(()=>x(45),2e3),oe=setTimeout(()=>x(60),4e3),xe=setTimeout(()=>x(75),6500),ye=setTimeout(()=>x(85),9e3),de=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(v),clearTimeout(K),clearTimeout(me),clearTimeout(oe),clearTimeout(xe),clearTimeout(ye),clearTimeout(de)}},[r]),u.useEffect(()=>{Q(),R(),z()},[Q,R,z]),u.useEffect(()=>{if(!g)return;const v=setInterval(()=>{Q(),z()},3e4);return()=>clearInterval(v)},[g,Q,z]),r||!n)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(Tt,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ii,{value:m,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m,"%"]})]})]})});const{summary:E,model_stats:M=[],hourly_data:te=[],daily_data:fe=[],recent_activity:je=[]}=n,ve=E??{total_requests:0,total_cost:0,total_tokens:0,online_time:0,total_messages:0,total_replies:0,avg_response_time:0,cost_per_hour:0,tokens_per_hour:0},ge=v=>{const K=Math.floor(v/3600),me=Math.floor(v%3600/60);return`${K}小时${me}分钟`},be=v=>{const K=v.toLocaleString("zh-CN");return v>=1e9?{display:`${(v/1e9).toFixed(2)}B`,exact:K,needsExact:!0}:v>=1e6?{display:`${(v/1e6).toFixed(2)}M`,exact:K,needsExact:!0}:v>=1e4?{display:`${(v/1e3).toFixed(1)}K`,exact:K,needsExact:!0}:v>=1e3?{display:`${(v/1e3).toFixed(2)}K`,exact:K,needsExact:!0}:{display:K,exact:K,needsExact:!1}},Se=v=>{const K=`¥${v.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return v>=1e6?{display:`¥${(v/1e6).toFixed(2)}M`,exact:K,needsExact:!0}:v>=1e4?{display:`¥${(v/1e3).toFixed(1)}K`,exact:K,needsExact:!0}:v>=1e3?{display:`¥${(v/1e3).toFixed(2)}K`,exact:K,needsExact:!0}:{display:K,exact:K,needsExact:!1}},O=v=>new Date(v).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),F=_0(M.length),q=M.map((v,K)=>({name:v.model_name,value:v.request_count,fill:F[K]})),se={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(Ke,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ka,{value:f.toString(),onValueChange:v=>p(Number(v)),children:e.jsxs(fa,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(ss,{value:"24",children:"24小时"}),e.jsx(ss,{value:"168",children:"7天"}),e.jsx(ss,{value:"720",children:"30天"})]})}),e.jsxs(C,{variant:g?"default":"outline",size:"sm",onClick:()=>N(!g),className:"gap-2",children:[e.jsx(Tt,{className:`h-4 w-4 ${g?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:Q,children:e.jsx(Tt,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[y?e.jsx(Eg,{className:"h-5 flex-1"}):j?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',j.hitokoto,'" —— ',j.from]}):null,e.jsx(C,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:R,disabled:y,children:e.jsx(Tt,{className:`h-3.5 w-3.5 ${y?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs($e,{className:"lg:col-span-1",children:[e.jsx(We,{className:"pb-3",children:e.jsxs(es,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(gr,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(hs,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:_?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs(Fe,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(ta,{className:"h-3 w-3 mr-1"}),"运行中"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-500"}),e.jsxs(Fe,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(zt,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),_&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",_.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["运行 ",ge(_.uptime)]})]})]})})]}),e.jsxs($e,{children:[e.jsx(We,{className:"pb-3",children:e.jsxs(es,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(tn,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(hs,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:Y,disabled:D,className:"gap-2",children:[e.jsx(Qc,{className:`h-4 w-4 ${D?"animate-spin":""}`}),D?"重启中...":"重启麦麦"]}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Xn,{to:"/logs",children:[e.jsx(Sa,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Xn,{to:"/plugins",children:[e.jsx(JN,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Xn,{to:"/settings",children:[e.jsx(ai,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs($e,{children:[e.jsxs(We,{className:"pb-3",children:[e.jsxs(es,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(PN,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(st,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(hs,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Xn,{to:"/survey/webui-feedback",children:[e.jsx(Sa,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Xn,{to:"/survey/maibot-feedback",children:[e.jsx(Ol,{className:"h-4 w-4"}),"麦麦反馈"]})})]})})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[e.jsxs($e,{children:[e.jsxs(We,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(ZN,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[be(ve.total_requests).display,be(ve.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",be(ve.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",f<48?f+"小时":Math.floor(f/24)+"天"]})]})]}),e.jsxs($e,{children:[e.jsxs(We,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"总花费"}),e.jsx(WN,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Se(ve.total_cost).display,Se(ve.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Se(ve.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ve.cost_per_hour>0?`¥${ve.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs($e,{children:[e.jsxs(We,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(Ic,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[be(ve.total_tokens).display,be(ve.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",be(ve.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ve.tokens_per_hour>0?`${be(ve.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs($e,{children:[e.jsxs(We,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(tn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ve.avg_response_time.toFixed(2),"s"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[e.jsxs($e,{children:[e.jsxs(We,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(Zn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(hs,{children:e.jsxs("div",{className:"text-xl font-bold",children:[ge(ve.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ve.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs($e,{children:[e.jsxs(We,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(Ol,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[be(ve.total_messages).display,be(ve.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",be(ve.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",be(ve.total_replies).display,be(ve.total_replies).needsExact&&e.jsxs("span",{children:["(",be(ve.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs($e,{children:[e.jsxs(We,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(ey,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsx("div",{className:"text-xl font-bold",children:ve.total_messages>0?`¥${(ve.total_cost/ve.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(ka,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(fa,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(ss,{value:"trends",children:"趋势"}),e.jsx(ss,{value:"models",children:"模型"}),e.jsx(ss,{value:"activity",children:"活动"}),e.jsx(ss,{value:"daily",children:"日统计"})]}),e.jsxs(ys,{value:"trends",className:"space-y-4",children:[e.jsxs($e,{children:[e.jsxs(We,{children:[e.jsx(es,{children:"请求趋势"}),e.jsxs(st,{children:["最近",f,"小时的请求量变化"]})]}),e.jsx(hs,{children:e.jsx(Kn,{config:se,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(yN,{data:te,children:[e.jsx(Rc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Lc,{dataKey:"timestamp",tickFormatter:v=>O(v),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(er,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(tr,{content:e.jsx(Jn,{labelFormatter:v=>O(v)})}),e.jsx(wN,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs($e,{children:[e.jsxs(We,{children:[e.jsx(es,{children:"花费趋势"}),e.jsx(st,{children:"API调用成本变化"})]}),e.jsx(hs,{children:e.jsx(Kn,{config:se,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(yu,{data:te,children:[e.jsx(Rc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Lc,{dataKey:"timestamp",tickFormatter:v=>O(v),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(er,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(tr,{content:e.jsx(Jn,{labelFormatter:v=>O(v)})}),e.jsx(Uc,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs($e,{children:[e.jsxs(We,{children:[e.jsx(es,{children:"Token消耗"}),e.jsx(st,{children:"Token使用量变化"})]}),e.jsx(hs,{children:e.jsx(Kn,{config:se,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(yu,{data:te,children:[e.jsx(Rc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Lc,{dataKey:"timestamp",tickFormatter:v=>O(v),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(er,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(tr,{content:e.jsx(Jn,{labelFormatter:v=>O(v)})}),e.jsx(Uc,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(ys,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs($e,{children:[e.jsxs(We,{children:[e.jsx(es,{children:"模型请求分布"}),e.jsxs(st,{children:["各模型使用占比 (共 ",M.length," 个模型)"]})]}),e.jsx(hs,{children:e.jsx(Kn,{config:Object.fromEntries(M.map((v,K)=>[v.model_name,{label:v.model_name,color:F[K]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(_N,{children:[e.jsx(tr,{content:e.jsx(Jn,{})}),e.jsx(SN,{data:q,cx:"50%",cy:"50%",labelLine:!1,label:({name:v,percent:K})=>K&&K<.05?"":`${v} ${K?(K*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:q.map((v,K)=>e.jsx(CN,{fill:v.fill},`cell-${K}`))})]})})})]}),e.jsxs($e,{children:[e.jsxs(We,{children:[e.jsx(es,{children:"模型详细统计"}),e.jsx(st,{children:"请求数、花费和性能"})]}),e.jsx(hs,{children:e.jsx(Ke,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:M.map((v,K)=>e.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:v.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${K%5+1}))`}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),e.jsx("span",{className:"ml-1 font-medium",children:v.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",v.total_cost.toFixed(2)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[(v.total_tokens/1e3).toFixed(1),"K"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[v.avg_response_time.toFixed(2),"s"]})]})]})]},K))})})})]})]})}),e.jsx(ys,{value:"activity",children:e.jsxs($e,{children:[e.jsxs(We,{children:[e.jsx(es,{children:"最近活动"}),e.jsx(st,{children:"最新的API调用记录"})]}),e.jsx(hs,{children:e.jsx(Ke,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:je.map((v,K)=>e.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:v.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:v.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:O(v.timestamp)})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsx("span",{className:"ml-1",children:v.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",v.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[v.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${v.status==="success"?"text-green-600":"text-red-600"}`,children:v.status})]})]})]},K))})})})]})}),e.jsx(ys,{value:"daily",children:e.jsxs($e,{children:[e.jsxs(We,{children:[e.jsx(es,{children:"每日统计"}),e.jsx(st,{children:"最近7天的数据汇总"})]}),e.jsx(hs,{children:e.jsx(Kn,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:e.jsxs(yu,{data:fe,children:[e.jsx(Rc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Lc,{dataKey:"timestamp",tickFormatter:v=>{const K=new Date(v);return`${K.getMonth()+1}/${K.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(er,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(er,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(tr,{content:e.jsx(Jn,{labelFormatter:v=>new Date(v).toLocaleDateString("zh-CN")})}),e.jsx(g0,{content:e.jsx(Ag,{})}),e.jsx(Uc,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Uc,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]})]})})}const C0={theme:"system",setTheme:()=>null},Dg=u.createContext(C0),Ju=()=>{const n=u.useContext(Dg);if(n===void 0)throw new Error("useTheme must be used within a ThemeProvider");return n},k0=(n,i,r)=>{const d=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||d){i(n);return}const m=r.clientX,x=r.clientY,f=Math.hypot(Math.max(m,innerWidth-m),Math.max(x,innerHeight-x));document.startViewTransition(()=>{i(n)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${m}px ${x}px)`,`circle(${f}px at ${m}px ${x}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Og=u.createContext(void 0),Rg=()=>{const n=u.useContext(Og);if(n===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return n},Be=u.forwardRef(({className:n,...i},r)=>e.jsx(Rp,{className:G("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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",n),...i,ref:r,children:e.jsx(lN,{className:G("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Be.displayName=Rp.displayName;const T0=ti("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),k=u.forwardRef(({className:n,...i},r)=>e.jsx(Kp,{ref:r,className:G(T0(),n),...i}));k.displayName=Kp.displayName;const re=u.forwardRef(({className:n,type:i,...r},d)=>e.jsx("input",{type:i,className:G("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:d,...r}));re.displayName="Input";const E0=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:n=>n.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:n=>/[A-Z]/.test(n)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:n=>/[a-z]/.test(n)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:n=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(n)}];function z0(n){const i=E0.map(d=>({id:d.id,label:d.label,description:d.description,passed:d.validate(n)}));return{isValid:i.every(d=>d.passed),rules:i}}const eo="0.11.7 Beta",Pu="MaiBot Dashboard",M0=`${Pu} v${eo}`,A0=(n="v")=>`${n}${eo}`,Ft={THEME:"maibot-ui-theme",ACCENT_COLOR:"accent-color",ENABLE_ANIMATIONS:"maibot-animations",ENABLE_WAVES_BACKGROUND:"maibot-waves-background",LOG_CACHE_SIZE:"maibot-log-cache-size",LOG_AUTO_SCROLL:"maibot-log-auto-scroll",LOG_FONT_SIZE:"maibot-log-font-size",LOG_LINE_SPACING:"maibot-log-line-spacing",DATA_SYNC_INTERVAL:"maibot-data-sync-interval",WS_RECONNECT_INTERVAL:"maibot-ws-reconnect-interval",WS_MAX_RECONNECT_ATTEMPTS:"maibot-ws-max-reconnect-attempts",COMPLETED_TOURS:"maibot-completed-tours"},Oa={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function et(n){const i=Lg(n),r=localStorage.getItem(i);if(r===null)return Oa[n];const d=Oa[n];if(typeof d=="boolean")return r==="true";if(typeof d=="number"){const m=parseFloat(r);return isNaN(m)?d:m}return r}function Pn(n,i){const r=Lg(n);localStorage.setItem(r,String(i)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:n,value:i}}))}function D0(){return{theme:et("theme"),accentColor:et("accentColor"),enableAnimations:et("enableAnimations"),enableWavesBackground:et("enableWavesBackground"),logCacheSize:et("logCacheSize"),logAutoScroll:et("logAutoScroll"),logFontSize:et("logFontSize"),logLineSpacing:et("logLineSpacing"),dataSyncInterval:et("dataSyncInterval"),wsReconnectInterval:et("wsReconnectInterval"),wsMaxReconnectAttempts:et("wsMaxReconnectAttempts")}}function O0(){const n=D0(),i=localStorage.getItem(Ft.COMPLETED_TOURS),r=i?JSON.parse(i):[];return{...n,completedTours:r}}function R0(n){const i=[],r=[];for(const[d,m]of Object.entries(n)){if(d==="completedTours"){Array.isArray(m)?(localStorage.setItem(Ft.COMPLETED_TOURS,JSON.stringify(m)),i.push("completedTours")):r.push("completedTours");continue}if(d in Oa){const x=d,f=Oa[x];if(typeof m==typeof f){if(x==="theme"&&!["light","dark","system"].includes(m)){r.push(d);continue}if(x==="logFontSize"&&!["xs","sm","base"].includes(m)){r.push(d);continue}Pn(x,m),i.push(d)}else r.push(d)}else r.push(d)}return{success:i.length>0,imported:i,skipped:r}}function L0(){for(const n of Object.keys(Oa))Pn(n,Oa[n]);localStorage.removeItem(Ft.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function U0(){const n=[],i=[],r=[];for(let d=0;dd.size-r.size),{used:n,items:localStorage.length,details:i}}function B0(n){if(n===0)return"0 B";const i=1024,r=["B","KB","MB"],d=Math.floor(Math.log(n)/Math.log(i));return parseFloat((n/Math.pow(i,d)).toFixed(2))+" "+r[d]}function Lg(n){return{theme:Ft.THEME,accentColor:Ft.ACCENT_COLOR,enableAnimations:Ft.ENABLE_ANIMATIONS,enableWavesBackground:Ft.ENABLE_WAVES_BACKGROUND,logCacheSize:Ft.LOG_CACHE_SIZE,logAutoScroll:Ft.LOG_AUTO_SCROLL,logFontSize:Ft.LOG_FONT_SIZE,logLineSpacing:Ft.LOG_LINE_SPACING,dataSyncInterval:Ft.DATA_SYNC_INTERVAL,wsReconnectInterval:Ft.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:Ft.WS_MAX_RECONNECT_ATTEMPTS}[n]}const ha=u.forwardRef(({className:n,...i},r)=>e.jsxs(Lp,{ref:r,className:G("relative flex w-full touch-none select-none items-center",n),...i,children:[e.jsx(nN,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(iN,{className:"absolute h-full bg-primary"})}),e.jsx(rN,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));ha.displayName=Lp.displayName;class H0{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return et("logCacheSize")}getMaxReconnectAttempts(){return et("wsMaxReconnectAttempts")}getReconnectInterval(){return et("wsReconnectInterval")}getWebSocketUrl(){{const i=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host;return`${i}//${r}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const i=this.getWebSocketUrl();try{this.ws=new WebSocket(i),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=r=>{try{if(r.data==="pong")return;const d=JSON.parse(r.data);this.notifyLog(d)}catch(d){console.error("解析日志消息失败:",d)}},this.ws.onerror=r=>{console.error("❌ WebSocket 错误:",r),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(r){console.error("创建 WebSocket 连接失败:",r),this.attemptReconnect()}}attemptReconnect(){const i=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=i)return;this.reconnectAttempts+=1;const r=this.getReconnectInterval(),d=Math.min(r*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},d)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(i){return this.logCallbacks.add(i),()=>this.logCallbacks.delete(i)}onConnectionChange(i){return this.connectionCallbacks.add(i),i(this.isConnected),()=>this.connectionCallbacks.delete(i)}notifyLog(i){if(!this.logCache.some(d=>d.id===i.id)){this.logCache.push(i);const d=this.getMaxCacheSize();this.logCache.length>d&&(this.logCache=this.logCache.slice(-d)),this.logCallbacks.forEach(m=>{try{m(i)}catch(x){console.error("日志回调执行失败:",x)}})}}notifyConnection(i){this.connectionCallbacks.forEach(r=>{try{r(i)}catch(d){console.error("连接状态回调执行失败:",d)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const sn=new H0;typeof window<"u"&&sn.connect();const Hs=zN,Zu=MN,q0=TN,Ug=u.forwardRef(({className:n,...i},r)=>e.jsx(Jp,{ref:r,className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...i}));Ug.displayName=Jp.displayName;const As=u.forwardRef(({className:n,children:i,preventOutsideClose:r=!1,...d},m)=>e.jsxs(q0,{children:[e.jsx(Ug,{}),e.jsxs(Pp,{ref:m,className:G("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),onPointerDownOutside:r?x=>x.preventDefault():void 0,onInteractOutside:r?x=>x.preventDefault():void 0,...d,children:[i,e.jsxs(EN,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(il,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));As.displayName=Pp.displayName;const Ds=({className:n,...i})=>e.jsx("div",{className:G("flex flex-col space-y-1.5 text-center sm:text-left",n),...i});Ds.displayName="DialogHeader";const at=({className:n,...i})=>e.jsx("div",{className:G("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...i});at.displayName="DialogFooter";const Os=u.forwardRef(({className:n,...i},r)=>e.jsx(Zp,{ref:r,className:G("text-lg font-semibold leading-none tracking-tight",n),...i}));Os.displayName=Zp.displayName;const Js=u.forwardRef(({className:n,...i},r)=>e.jsx(Wp,{ref:r,className:G("text-sm text-muted-foreground",n),...i}));Js.displayName=Wp.displayName;const us=oN,tt=dN,G0=cN,Bg=u.forwardRef(({className:n,...i},r)=>e.jsx(Up,{className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...i,ref:r}));Bg.displayName=Up.displayName;const ts=u.forwardRef(({className:n,...i},r)=>e.jsxs(G0,{children:[e.jsx(Bg,{}),e.jsx(Bp,{ref:r,className:G("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...i})]}));ts.displayName=Bp.displayName;const as=({className:n,...i})=>e.jsx("div",{className:G("flex flex-col space-y-2 text-center sm:text-left",n),...i});as.displayName="AlertDialogHeader";const ls=({className:n,...i})=>e.jsx("div",{className:G("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...i});ls.displayName="AlertDialogFooter";const ns=u.forwardRef(({className:n,...i},r)=>e.jsx(Hp,{ref:r,className:G("text-lg font-semibold",n),...i}));ns.displayName=Hp.displayName;const is=u.forwardRef(({className:n,...i},r)=>e.jsx(qp,{ref:r,className:G("text-sm text-muted-foreground",n),...i}));is.displayName=qp.displayName;const rs=u.forwardRef(({className:n,...i},r)=>e.jsx(Gp,{ref:r,className:G(xr(),n),...i}));rs.displayName=Gp.displayName;const cs=u.forwardRef(({className:n,...i},r)=>e.jsx(Fp,{ref:r,className:G(xr({variant:"outline"}),"mt-2 sm:mt-0",n),...i}));cs.displayName=Fp.displayName;function F0(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),e.jsxs(ka,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(fa,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(ss,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(sy,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(ss,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ty,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(ss,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ai,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(ss,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Ra,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(Ke,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(ys,{value:"appearance",className:"mt-0",children:e.jsx(V0,{})}),e.jsx(ys,{value:"security",className:"mt-0",children:e.jsx($0,{})}),e.jsx(ys,{value:"other",className:"mt-0",children:e.jsx(Q0,{})}),e.jsx(ys,{value:"about",className:"mt-0",children:e.jsx(I0,{})})]})]})]})}function up(n){const i=document.documentElement,d={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[n];if(d)i.style.setProperty("--primary",d.hsl),d.gradient?(i.style.setProperty("--primary-gradient",d.gradient),i.classList.add("has-gradient")):(i.style.removeProperty("--primary-gradient"),i.classList.remove("has-gradient"));else if(n.startsWith("#")){const m=x=>{x=x.replace("#","");const f=parseInt(x.substring(0,2),16)/255,p=parseInt(x.substring(2,4),16)/255,g=parseInt(x.substring(4,6),16)/255,N=Math.max(f,p,g),j=Math.min(f,p,g);let w=0,y=0;const T=(N+j)/2;if(N!==j){const _=N-j;switch(y=T>.5?_/(2-N-j):_/(N+j),N){case f:w=((p-g)/_+(plocalStorage.getItem("accent-color")||"blue");u.useEffect(()=>{const N=localStorage.getItem("accent-color")||"blue";up(N)},[]);const g=N=>{p(N),localStorage.setItem("accent-color",N),up(N)};return e.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[e.jsx(zu,{value:"light",current:n,onChange:i,label:"浅色",description:"始终使用浅色主题"}),e.jsx(zu,{value:"dark",current:n,onChange:i,label:"深色",description:"始终使用深色主题"}),e.jsx(zu,{value:"system",current:n,onChange:i,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(xa,{value:"blue",current:f,onChange:g,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(xa,{value:"purple",current:f,onChange:g,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(xa,{value:"green",current:f,onChange:g,label:"绿色",colorClass:"bg-green-500"}),e.jsx(xa,{value:"orange",current:f,onChange:g,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(xa,{value:"pink",current:f,onChange:g,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(xa,{value:"red",current:f,onChange:g,label:"红色",colorClass:"bg-red-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(xa,{value:"gradient-sunset",current:f,onChange:g,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(xa,{value:"gradient-ocean",current:f,onChange:g,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(xa,{value:"gradient-forest",current:f,onChange:g,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(xa,{value:"gradient-aurora",current:f,onChange:g,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(xa,{value:"gradient-fire",current:f,onChange:g,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(xa,{value:"gradient-twilight",current:f,onChange:g,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"color",value:f.startsWith("#")?f:"#3b82f6",onChange:N=>g(N.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),e.jsx("div",{className:"flex-1",children:e.jsx(re,{type:"text",value:f,onChange:N=>g(N.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),e.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[e.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(k,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx(Be,{id:"animations",checked:r,onCheckedChange:d})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(k,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx(Be,{id:"waves-background",checked:m,onCheckedChange:x})]})})]})]})]})}function $0(){const n=ga(),[i,r]=u.useState(""),[d,m]=u.useState(""),[x,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),[w,y]=u.useState(!1),[T,_]=u.useState(!1),[L,D]=u.useState(!1),[U,I]=u.useState(""),[R,z]=u.useState(!1),{toast:Y}=Rs(),Q=u.useMemo(()=>z0(d),[d]),E=async ge=>{if(!i){Y({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(ge),_(!0),Y({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>_(!1),2e3)}catch{Y({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},M=async()=>{if(!d.trim()){Y({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!Q.isValid){const ge=Q.rules.filter(be=>!be.passed).map(be=>be.label).join(", ");Y({title:"格式错误",description:`Token 不符合要求: ${ge}`,variant:"destructive"});return}j(!0);try{const ge=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:d.trim()})}),be=await ge.json();ge.ok&&be.success?(m(""),r(d.trim()),Y({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{n({to:"/auth"})},1500)):Y({title:"更新失败",description:be.message||"无法更新 Token",variant:"destructive"})}catch(ge){console.error("更新 Token 错误:",ge),Y({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{j(!1)}},te=async()=>{y(!0);try{const ge=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),be=await ge.json();ge.ok&&be.success?(r(be.token),I(be.token),D(!0),z(!1),Y({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):Y({title:"生成失败",description:be.message||"无法生成新 Token",variant:"destructive"})}catch(ge){console.error("生成 Token 错误:",ge),Y({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},fe=async()=>{try{await navigator.clipboard.writeText(U),z(!0),Y({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},je=()=>{D(!1),setTimeout(()=>{I(""),z(!1)},300),setTimeout(()=>{n({to:"/auth"})},500)},ve=ge=>{ge||je()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Hs,{open:L,onOpenChange:ve,children:e.jsxs(As,{className:"sm:max-w-md",children:[e.jsxs(Ds,{children:[e.jsxs(Os,{className:"flex items-center gap-2",children:[e.jsx(Ca,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(Js,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[e.jsx(k,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),e.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:U})]}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ca,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"重要提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),e.jsx("li",{children:"请立即复制并保存到安全的位置"}),e.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),e.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),e.jsxs(at,{className:"gap-2 sm:gap-0",children:[e.jsx(C,{variant:"outline",onClick:fe,className:"gap-2",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Vt,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(Yc,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(C,{onClick:je,children:"我已保存,关闭"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(re,{id:"current-token",type:x?"text":"password",value:i||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{i?f(!x):Y({title:"无法查看",description:'Token 存储在安全 Cookie 中,如需新 Token 请点击"重新生成"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:x?"隐藏":"显示",children:x?e.jsx(dr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Ot,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(C,{variant:"outline",size:"icon",onClick:()=>E(i),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!i,children:T?e.jsx(Vt,{className:"h-4 w-4 text-green-500"}):e.jsx(Yc,{className:"h-4 w-4"})}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsxs(C,{variant:"outline",disabled:w,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(Tt,{className:G("h-4 w-4",w&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认重新生成 Token"}),e.jsx(is,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:te,children:"确认生成"})]})]})]})]})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{id:"new-token",type:p?"text":"password",value:d,onChange:ge=>m(ge.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),e.jsx("button",{onClick:()=>g(!p),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:p?"隐藏":"显示",children:p?e.jsx(dr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Ot,{className:"h-4 w-4 text-muted-foreground"})})]}),d&&e.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),e.jsx("div",{className:"space-y-1.5",children:Q.rules.map(ge=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[ge.passed?e.jsx(ta,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(pg,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:G(ge.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:ge.label})]},ge.id))}),Q.isValid&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(C,{onClick:M,disabled:N||!Q.isValid||!d,className:"w-full sm:w-auto",children:N?"更新中...":"更新自定义 Token"})]})]}),e.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[e.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),e.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),e.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),e.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),e.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),e.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),e.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function Q0(){const n=ga(),{toast:i}=Rs(),[r,d]=u.useState(!1),[m,x]=u.useState(!1),[f,p]=u.useState(()=>et("logCacheSize")),[g,N]=u.useState(()=>et("wsReconnectInterval")),[j,w]=u.useState(()=>et("wsMaxReconnectAttempts")),[y,T]=u.useState(()=>et("dataSyncInterval")),[_,L]=u.useState(()=>dp()),[D,U]=u.useState(!1),[I,R]=u.useState(!1),z=u.useRef(null);if(m)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const Y=()=>{L(dp())},Q=O=>{const F=O[0];p(F),Pn("logCacheSize",F)},E=O=>{const F=O[0];N(F),Pn("wsReconnectInterval",F)},M=O=>{const F=O[0];w(F),Pn("wsMaxReconnectAttempts",F)},te=O=>{const F=O[0];T(F),Pn("dataSyncInterval",F)},fe=()=>{sn.clearLogs(),i({title:"日志已清除",description:"日志缓存已清空"})},je=()=>{const O=U0();Y(),i({title:"缓存已清除",description:`已清除 ${O.clearedKeys.length} 项缓存数据`})},ve=()=>{U(!0);try{const O=O0(),F=JSON.stringify(O,null,2),q=new Blob([F],{type:"application/json"}),se=URL.createObjectURL(q),v=document.createElement("a");v.href=se,v.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(v),v.click(),document.body.removeChild(v),URL.revokeObjectURL(se),i({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(O){console.error("导出设置失败:",O),i({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{U(!1)}},ge=O=>{const F=O.target.files?.[0];if(!F)return;R(!0);const q=new FileReader;q.onload=se=>{try{const v=se.target?.result,K=JSON.parse(v),me=R0(K);me.success?(p(et("logCacheSize")),N(et("wsReconnectInterval")),w(et("wsMaxReconnectAttempts")),T(et("dataSyncInterval")),Y(),i({title:"导入成功",description:`成功导入 ${me.imported.length} 项设置${me.skipped.length>0?`,跳过 ${me.skipped.length} 项`:""}`}),(me.imported.includes("theme")||me.imported.includes("accentColor"))&&i({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):i({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(v){console.error("导入设置失败:",v),i({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{R(!1),z.current&&(z.current.value="")}},q.readAsText(F)},be=()=>{L0(),p(Oa.logCacheSize),N(Oa.wsReconnectInterval),w(Oa.wsMaxReconnectAttempts),T(Oa.dataSyncInterval),Y(),i({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},Se=async()=>{d(!0);try{const O=localStorage.getItem("access-token"),F=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${O}`}}),q=await F.json();F.ok&&q.success?(i({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{n({to:"/setup"})},1e3)):i({title:"重置失败",description:q.message||"无法重置配置状态",variant:"destructive"})}catch(O){console.error("重置配置状态错误:",O),i({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{d(!1)}};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Ic,{className:"h-5 w-5"}),"性能与存储"]}),e.jsxs("div",{className:"space-y-4 sm:space-y-5",children:[e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ay,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(C,{variant:"ghost",size:"sm",onClick:Y,className:"h-7 px-2",children:e.jsx(Tt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:B0(_.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[_.items," 个存储项"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[f," 条"]})]}),e.jsx(ha,{value:[f],onValueChange:Q,min:100,max:5e3,step:100,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制日志查看器最多缓存的日志条数,较大的值会占用更多内存"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[y," 秒"]})]}),e.jsx(ha,{value:[y],onValueChange:te,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制首页统计数据的自动刷新间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[g/1e3," 秒"]})]}),e.jsx(ha,{value:[g],onValueChange:E,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"日志 WebSocket 连接断开后的重连基础间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[j," 次"]})]}),e.jsx(ha,{value:[j],onValueChange:M,min:3,max:30,step:1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"连接失败后的最大重连尝试次数"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:fe,className:"gap-2",children:[e.jsx(Je,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(Je,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认清除本地缓存"}),e.jsx(is,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:je,children:"确认清除"})]})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(nl,{className:"h-5 w-5"}),"导入/导出设置"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"导出当前的界面设置以便备份,或从之前导出的文件中恢复设置。"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(C,{variant:"outline",onClick:ve,disabled:D,className:"gap-2",children:[e.jsx(nl,{className:"h-4 w-4"}),D?"导出中...":"导出设置"]}),e.jsx("input",{ref:z,type:"file",accept:".json",onChange:ge,className:"hidden"}),e.jsxs(C,{variant:"outline",onClick:()=>z.current?.click(),disabled:I,className:"gap-2",children:[e.jsx(ur,{className:"h-4 w-4"}),I?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(Qc,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认重置所有设置"}),e.jsx(is,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:be,children:"确认重置"})]})]})]})})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsxs(C,{variant:"outline",disabled:r,className:"gap-2",children:[e.jsx(Qc,{className:G("h-4 w-4",r&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认重新配置"}),e.jsx(is,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:Se,children:"确认重置"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Ca,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsxs(C,{variant:"destructive",className:"gap-2",children:[e.jsx(Ca,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认触发错误"}),e.jsx(is,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>x(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function I0(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:e.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),e.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:G("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",Pu]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",eo]}),e.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",e.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"React 19.2.0"}),e.jsx("li",{children:"TypeScript 5.7.2"}),e.jsx("li",{children:"Vite 6.0.7"}),e.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"shadcn/ui"}),e.jsx("li",{children:"Radix UI"}),e.jsx("li",{children:"Tailwind CSS 3.4.17"}),e.jsx("li",{children:"Lucide Icons"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"后端"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Python 3.12+"}),e.jsx("li",{children:"FastAPI"}),e.jsx("li",{children:"Uvicorn"}),e.jsx("li",{children:"WebSocket"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Bun / npm"}),e.jsx("li",{children:"ESLint 9.17.0"}),e.jsx("li",{children:"PostCSS"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),e.jsx(Ke,{className:"h-[300px] sm:h-[400px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Xs,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(Xs,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(Xs,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(Xs,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(Xs,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Xs,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(Xs,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Xs,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(Xs,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Xs,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(Xs,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(Xs,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(Xs,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Xs,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(Xs,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Xs,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(Xs,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(Xs,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(Xs,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Xs,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(Xs,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(Xs,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(Xs,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:e.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Xs({name:n,description:i,license:r}){return e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:n}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:i})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:r})]})}function zu({value:n,current:i,onChange:r,label:d,description:m}){const x=i===n;return e.jsxs("button",{onClick:()=>r(n),className:G("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:d}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:m})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[n==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),n==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),n==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function xa({value:n,current:i,onChange:r,label:d,colorClass:m}){const x=i===n;return e.jsxs("button",{onClick:()=>r(n),className:G("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:G("h-8 w-8 sm:h-10 sm:w-10 rounded-full",m)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:d})]})]})}class Y0{grad3;p;perm;constructor(i=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let r=0;r<256;r++)this.p[r]=Math.floor(Math.random()*256);this.perm=[];for(let r=0;r<512;r++)this.perm[r]=this.p[r&255]}dot(i,r,d){return i[0]*r+i[1]*d}mix(i,r,d){return(1-d)*i+d*r}fade(i){return i*i*i*(i*(i*6-15)+10)}perlin2(i,r){const d=Math.floor(i)&255,m=Math.floor(r)&255;i-=Math.floor(i),r-=Math.floor(r);const x=this.fade(i),f=this.fade(r),p=this.perm[d]+m,g=this.perm[p],N=this.perm[p+1],j=this.perm[d+1]+m,w=this.perm[j],y=this.perm[j+1];return this.mix(this.mix(this.dot(this.grad3[g%12],i,r),this.dot(this.grad3[w%12],i-1,r),x),this.mix(this.dot(this.grad3[N%12],i,r-1),this.dot(this.grad3[y%12],i-1,r-1),x),f)}}function mp(){const n=u.useRef(null),i=u.useRef(null),r=u.useRef(void 0),d=u.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new Y0(Math.random()),bounding:null});return u.useEffect(()=>{const m=i.current,x=n.current;if(!m||!x)return;const f=d.current,p=()=>{const L=m.getBoundingClientRect();f.bounding=L,x.style.width=`${L.width}px`,x.style.height=`${L.height}px`},g=()=>{if(!f.bounding)return;const{width:L,height:D}=f.bounding;f.lines=[],f.paths.forEach(te=>te.remove()),f.paths=[];const U=10,I=32,R=L+200,z=D+30,Y=Math.ceil(R/U),Q=Math.ceil(z/I),E=(L-U*Y)/2,M=(D-I*Q)/2;for(let te=0;te<=Y;te++){const fe=[];for(let ve=0;ve<=Q;ve++){const ge={x:E+U*te,y:M+I*ve,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};fe.push(ge)}const je=document.createElementNS("http://www.w3.org/2000/svg","path");x.appendChild(je),f.paths.push(je),f.lines.push(fe)}},N=L=>{const{lines:D,mouse:U,noise:I}=f;D.forEach(R=>{R.forEach(z=>{const Y=I.perlin2((z.x+L*.0125)*.002,(z.y+L*.005)*.0015)*12;z.wave.x=Math.cos(Y)*32,z.wave.y=Math.sin(Y)*16;const Q=z.x-U.sx,E=z.y-U.sy,M=Math.hypot(Q,E),te=Math.max(175,U.vs);if(M{const U={x:L.x+L.wave.x+(D?L.cursor.x:0),y:L.y+L.wave.y+(D?L.cursor.y:0)};return U.x=Math.round(U.x*10)/10,U.y=Math.round(U.y*10)/10,U},w=()=>{const{lines:L,paths:D}=f;L.forEach((U,I)=>{let R=j(U[0],!1),z=`M ${R.x} ${R.y}`;U.forEach((Y,Q)=>{const E=Q===U.length-1;R=j(Y,!E),z+=`L ${R.x} ${R.y}`}),D[I].setAttribute("d",z)})},y=L=>{const{mouse:D}=f;D.sx+=(D.x-D.sx)*.1,D.sy+=(D.y-D.sy)*.1;const U=D.x-D.lx,I=D.y-D.ly,R=Math.hypot(U,I);D.v=R,D.vs+=(R-D.vs)*.1,D.vs=Math.min(100,D.vs),D.lx=D.x,D.ly=D.y,D.a=Math.atan2(I,U),m&&(m.style.setProperty("--x",`${D.sx}px`),m.style.setProperty("--y",`${D.sy}px`)),N(L),w(),r.current=requestAnimationFrame(y)},T=L=>{if(!f.bounding)return;const{mouse:D}=f;D.x=L.pageX-f.bounding.left,D.y=L.pageY-f.bounding.top+window.scrollY,D.set||(D.sx=D.x,D.sy=D.y,D.lx=D.x,D.ly=D.y,D.set=!0)},_=()=>{p(),g()};return p(),g(),window.addEventListener("resize",_),window.addEventListener("mousemove",T),r.current=requestAnimationFrame(y),()=>{window.removeEventListener("resize",_),window.removeEventListener("mousemove",T),r.current&&cancelAnimationFrame(r.current)}},[]),e.jsxs("div",{ref:i,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:n,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` - path { - fill: none; - stroke: hsl(var(--primary) / 0.20); - stroke-width: 1px; - } - `})})]})}async function _e(n,i){const r={...i,credentials:"include",headers:{"Content-Type":"application/json",...i?.headers}},d=await fetch(n,r);if(d.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return d}function Es(){return{"Content-Type":"application/json"}}async function X0(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(n){console.error("登出请求失败:",n)}window.location.href="/auth"}async function Wu(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}function K0(){const[n,i]=u.useState(""),[r,d]=u.useState(!1),[m,x]=u.useState(""),[f,p]=u.useState(!0),g=ga(),{enableWavesBackground:N,setEnableWavesBackground:j}=Rg(),{theme:w,setTheme:y}=Ju();u.useEffect(()=>{(async()=>{try{await Wu()&&g({to:"/"})}catch{}finally{p(!1)}})()},[g]);const _=w==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":w,L=()=>{y(_==="dark"?"light":"dark")},D=async U=>{if(U.preventDefault(),x(""),!n.trim()){x("请输入 Access Token");return}d(!0);try{const I=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:n.trim()})}),R=await I.json();I.ok&&R.valid?R.is_first_setup?g({to:"/setup"}):g({to:"/"}):x(R.message||"Token 验证失败,请检查后重试")}catch(I){console.error("Token 验证错误:",I),x("连接服务器失败,请检查网络连接")}finally{d(!1)}};return f?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[N&&e.jsx(mp,{}),e.jsx("div",{className:"text-muted-foreground",children:"正在检查登录状态..."})]}):e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[N&&e.jsx(mp,{}),e.jsxs($e,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[e.jsx("button",{onClick:L,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:_==="dark"?"切换到浅色模式":"切换到深色模式",children:_==="dark"?e.jsx(gg,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(jg,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(We,{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(Wf,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(es,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(st,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(hs,{children:e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(vg,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(re,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:n,onChange:U=>i(U.target.value),className:G("pl-10",m&&"border-red-500 focus-visible:ring-red-500"),disabled:r,autoFocus:!0,autoComplete:"off"})]})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(zt,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:m})]}),e.jsx(C,{type:"submit",className:"w-full",disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),e.jsxs(Hs,{children:[e.jsx(Zu,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(bg,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(As,{className:"sm:max-w-md",children:[e.jsxs(Ds,{children:[e.jsxs(Os,{className:"flex items-center gap-2",children:[e.jsx(Wf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(Js,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ly,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),e.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),e.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Sa,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),e.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:e.jsx("code",{className:"text-primary",children:"data/webui.json"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",e.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(zt,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"安全提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),e.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(tn,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsxs(ns,{className:"flex items-center gap-2",children:[e.jsx(tn,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(is,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>j(!1),children:"关闭动画"})]})]})]})]})})]}),e.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:e.jsx("p",{children:M0})})]})}const Ms=u.forwardRef(({className:n,...i},r)=>e.jsx("textarea",{className:G("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:r,...i}));Ms.displayName="Textarea";const hr=u.forwardRef(({className:n,orientation:i="horizontal",decorative:r=!0,...d},m)=>e.jsx(Vp,{ref:m,decorative:r,orientation:i,className:G("shrink-0 bg-border",i==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...d}));hr.displayName=Vp.displayName;function J0({config:n,onChange:i}){const r=m=>{m.trim()&&!n.alias_names.includes(m.trim())&&i({...n,alias_names:[...n.alias_names,m.trim()]})},d=m=>{i({...n,alias_names:n.alias_names.filter((x,f)=>f!==m)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(re,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:n.qq_account||"",onChange:m=>i({...n,qq_account:Number(m.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(re,{id:"nickname",placeholder:"请输入机器人的昵称",value:n.nickname,onChange:m=>i({...n,nickname:m.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:n.alias_names.map((m,x)=>e.jsxs(Fe,{variant:"secondary",className:"gap-1",children:[m,e.jsx("button",{type:"button",onClick:()=>d(x),className:"ml-1 hover:text-destructive",children:e.jsx(il,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:m=>{m.key==="Enter"&&(r(m.target.value),m.target.value="")}}),e.jsx(C,{type:"button",variant:"outline",onClick:()=>{const m=document.getElementById("alias_input");m&&(r(m.value),m.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function P0({config:n,onChange:i}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(Ms,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:n.personality,onChange:r=>i({...n,personality:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(Ms,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:n.reply_style,onChange:r=>i({...n,reply_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(Ms,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:n.interest,onChange:r=>i({...n,interest:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(hr,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(Ms,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:n.plan_style,onChange:r=>i({...n,plan_style:r.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(Ms,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:n.private_plan_style,onChange:r=>i({...n,private_plan_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function Z0({config:n,onChange:i}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(n.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(re,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:n.emoji_chance,onChange:r=>i({...n,emoji_chance:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(re,{id:"max_reg_num",type:"number",min:"1",max:"200",value:n.max_reg_num,onChange:r=>i({...n,max_reg_num:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx(Be,{id:"do_replace",checked:n.do_replace,onCheckedChange:r=>i({...n,do_replace:r})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(re,{id:"check_interval",type:"number",min:"1",max:"120",value:n.check_interval,onChange:r=>i({...n,check_interval:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(hr,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx(Be,{id:"steal_emoji",checked:n.steal_emoji,onCheckedChange:r=>i({...n,steal_emoji:r})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx(Be,{id:"content_filtration",checked:n.content_filtration,onCheckedChange:r=>i({...n,content_filtration:r})})]}),n.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(re,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:n.filtration_prompt,onChange:r=>i({...n,filtration_prompt:r.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function W0({config:n,onChange:i}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx(Be,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:r=>i({...n,enable_tool:r})})]}),e.jsx(hr,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{htmlFor:"enable_mood",children:"启用情绪系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),e.jsx(Be,{id:"enable_mood",checked:n.enable_mood,onCheckedChange:r=>i({...n,enable_mood:r})})]}),n.enable_mood&&e.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),e.jsx(re,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:n.mood_update_threshold||1,onChange:r=>i({...n,mood_update_threshold:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"emotion_style",children:"情感特征"}),e.jsx(Ms,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:n.emotion_style||"",onChange:r=>i({...n,emotion_style:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),e.jsx(hr,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx(Be,{id:"all_global",checked:n.all_global,onCheckedChange:r=>i({...n,all_global:r})})]})]})}function ew({config:n,onChange:i}){const[r,d]=u.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx(Fc,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{id:"siliconflow_api_key",type:r?"text":"password",placeholder:"sk-...",value:n.api_key,onChange:m=>i({api_key:m.target.value}),className:"font-mono pr-10"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>d(!r),children:r?e.jsx(dr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Ot,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[e.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[e.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),e.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),e.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),e.jsx("li",{children:"SenseVoice - 语音识别"}),e.jsx("li",{children:"BGE-M3 - 文本嵌入"}),e.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),e.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:e.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function sw(){const n=await _e("/api/webui/config/bot",{method:"GET",headers:Es()});if(!n.ok)throw new Error("读取Bot配置失败");const r=(await n.json()).config.bot||{};return{qq_account:r.qq_account||0,nickname:r.nickname||"",alias_names:r.alias_names||[]}}async function tw(){const n=await _e("/api/webui/config/bot",{method:"GET",headers:Es()});if(!n.ok)throw new Error("读取人格配置失败");const r=(await n.json()).config.personality||{};return{personality:r.personality||"",reply_style:r.reply_style||"",interest:r.interest||"",plan_style:r.plan_style||"",private_plan_style:r.private_plan_style||""}}async function aw(){const n=await _e("/api/webui/config/bot",{method:"GET",headers:Es()});if(!n.ok)throw new Error("读取表情包配置失败");const r=(await n.json()).config.emoji||{};return{emoji_chance:r.emoji_chance??.4,max_reg_num:r.max_reg_num??40,do_replace:r.do_replace??!0,check_interval:r.check_interval??10,steal_emoji:r.steal_emoji??!0,content_filtration:r.content_filtration??!1,filtration_prompt:r.filtration_prompt||""}}async function lw(){const n=await _e("/api/webui/config/bot",{method:"GET",headers:Es()});if(!n.ok)throw new Error("读取其他配置失败");const r=(await n.json()).config,d=r.tool||{},m=r.mood||{},x=r.jargon||{};return{enable_tool:d.enable_tool??!0,enable_mood:m.enable_mood??!1,mood_update_threshold:m.mood_update_threshold,emotion_style:m.emotion_style,all_global:x.all_global??!0}}async function nw(){const n=await _e("/api/webui/config/model",{method:"GET",headers:Es()});if(!n.ok)throw new Error("读取模型配置失败");return{api_key:((await n.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function iw(n){const i=await _e("/api/webui/config/bot/section/bot",{method:"POST",headers:Es(),body:JSON.stringify(n)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存Bot基础配置失败")}return await i.json()}async function rw(n){const i=await _e("/api/webui/config/bot/section/personality",{method:"POST",headers:Es(),body:JSON.stringify(n)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存人格配置失败")}return await i.json()}async function cw(n){const i=await _e("/api/webui/config/bot/section/emoji",{method:"POST",headers:Es(),body:JSON.stringify(n)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存表情包配置失败")}return await i.json()}async function ow(n){const i=[];i.push(_e("/api/webui/config/bot/section/tool",{method:"POST",headers:Es(),body:JSON.stringify({enable_tool:n.enable_tool})})),i.push(_e("/api/webui/config/bot/section/jargon",{method:"POST",headers:Es(),body:JSON.stringify({all_global:n.all_global})}));const r={enable_mood:n.enable_mood};n.enable_mood&&(r.mood_update_threshold=n.mood_update_threshold||1,r.emotion_style=n.emotion_style||""),i.push(_e("/api/webui/config/bot/section/mood",{method:"POST",headers:Es(),body:JSON.stringify(r)}));const d=await Promise.all(i);for(const m of d)if(!m.ok){const x=await m.json();throw new Error(x.detail||"保存其他配置失败")}return{success:!0}}async function dw(n){const i=await _e("/api/webui/config/model",{method:"GET",headers:Es()});if(!i.ok)throw new Error("读取模型配置失败");const d=(await i.json()).config,m=d.api_providers||[],x=m.findIndex(g=>g.name==="SiliconFlow");x>=0?m[x]={...m[x],api_key:n.api_key}:m.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:n.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const f={...d,api_providers:m},p=await _e("/api/webui/config/model",{method:"POST",headers:Es(),body:JSON.stringify(f)});if(!p.ok){const g=await p.json();throw new Error(g.detail||"保存模型配置失败")}return await p.json()}async function xp(){const n=localStorage.getItem("access-token"),i=await _e("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${n}`}});if(!i.ok){const r=await i.json();throw new Error(r.message||"标记配置完成失败")}return await i.json()}async function so(){const n=await _e("/api/webui/system/restart",{method:"POST",headers:Es()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"重启失败")}return await n.json()}async function Hg(){const n=await _e("/api/webui/system/status",{method:"GET",headers:Es()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取状态失败")}return await n.json()}function uw(){const n=ga(),{toast:i}=Rs(),[r,d]=u.useState(0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!0),[j,w]=u.useState({qq_account:0,nickname:"",alias_names:[]}),[y,T]=u.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.请控制你的发言频率,不要太过频繁的发言 -4.如果有人对你感到厌烦,请减少回复 -5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[_,L]=u.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[D,U]=u.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遇遇特定事件的时候起伏较大",all_global:!0}),[I,R]=u.useState({api_key:""}),[z,Y]=u.useState(!1),[Q,E]=u.useState(""),M=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:lr},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:Xc},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Yu},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:ai},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:vg}],te=(r+1)/M.length*100;u.useEffect(()=>{(async()=>{try{N(!0);const[F,q,se,v,K]=await Promise.all([sw(),tw(),aw(),lw(),nw()]);w(F),T(q),L(se),U(v),R(K)}catch(F){i({title:"加载配置失败",description:F instanceof Error?F.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{N(!1)}})()},[i]);const fe=async()=>{p(!0);try{switch(r){case 0:await iw(j);break;case 1:await rw(y);break;case 2:await cw(_);break;case 3:await ow(D);break;case 4:await dw(I);break}return i({title:"保存成功",description:`${M[r].title}配置已保存`}),!0}catch(O){return i({title:"保存失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},je=async()=>{await fe()&&r{r>0&&d(r-1)},ge=async()=>{x(!0),Y(!0);try{if(E("正在保存API配置..."),!await fe()){x(!1),Y(!1);return}E("正在完成初始化..."),await xp(),E("正在重启麦麦..."),await so(),i({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),E("等待麦麦重启完成...");const F=60;let q=0,se=!1;for(;qsetTimeout(v,1e3));try{(await Hg()).running&&(se=!0,E("重启成功!正在跳转..."))}catch{q++}}if(!se)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{n({to:"/"})},1e3)}catch(O){Y(!1),i({title:"配置失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}finally{x(!1)}},be=async()=>{try{await xp(),n({to:"/"})}catch(O){i({title:"跳过失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}},Se=()=>{switch(r){case 0:return e.jsx(J0,{config:j,onChange:w});case 1:return e.jsx(P0,{config:y,onChange:T});case 2:return e.jsx(Z0,{config:_,onChange:L});case 3:return e.jsx(W0,{config:D,onChange:U});case 4:return e.jsx(ew,{config:I,onChange:R});default:return null}};return e.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[z&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[e.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(Ks,{className:"h-10 w-10 animate-spin text-primary"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),e.jsx("p",{className:"text-muted-foreground",children:Q})]}),e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),e.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),g?e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:e.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),e.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[e.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(ny,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),e.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",Pu," 的初始配置"]})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",r+1," / ",M.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(te),"%"]})]}),e.jsx(ii,{value:te,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:M.map((O,F)=>{const q=O.icon;return e.jsxs("div",{className:G("flex flex-1 flex-col items-center gap-1 md:gap-2",Fn({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Wc,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(C,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx(ei,{className:"h-4 w-4"}),"返回上一页"]})]}),e.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}const mw=gt.memo(function({config:i,onChange:r}){const d=()=>{r({...i,platforms:[...i.platforms,""]})},m=N=>{r({...i,platforms:i.platforms.filter((j,w)=>w!==N)})},x=(N,j)=>{const w=[...i.platforms];w[N]=j,r({...i,platforms:w})},f=()=>{r({...i,alias_names:[...i.alias_names,""]})},p=N=>{r({...i,alias_names:i.alias_names.filter((j,w)=>w!==N)})},g=(N,j)=>{const w=[...i.alias_names];w[N]=j,r({...i,alias_names:w})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"platform",children:"平台"}),e.jsx(re,{id:"platform",value:i.platform,onChange:N=>r({...i,platform:N.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(re,{id:"qq_account",value:i.qq_account,onChange:N=>r({...i,qq_account:N.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"nickname",children:"昵称"}),e.jsx(re,{id:"nickname",value:i.nickname,onChange:N=>r({...i,nickname:N.target.value}),placeholder:"麦麦"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{children:"其他平台账号"}),e.jsxs(C,{onClick:d,size:"sm",variant:"outline",children:[e.jsx(rt,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[i.platforms.map((N,j)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:N,onChange:w=>x(j,w.target.value),placeholder:"wx:114514"}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:['确定要删除平台账号 "',N||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>m(j),children:"删除"})]})]})]})]},j)),i.platforms.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{children:"别名"}),e.jsxs(C,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(rt,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[i.alias_names.map((N,j)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:N,onChange:w=>g(j,w.target.value),placeholder:"小麦"}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:['确定要删除别名 "',N||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>p(j),children:"删除"})]})]})]})]},j)),i.alias_names.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}),xw=gt.memo(function({config:i,onChange:r}){const d=()=>{r({...i,states:[...i.states,""]})},m=f=>{r({...i,states:i.states.filter((p,g)=>g!==f)})},x=(f,p)=>{const g=[...i.states];g[f]=p,r({...i,states:g})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"personality",children:"人格特质"}),e.jsx(Ms,{id:"personality",value:i.personality,onChange:f=>r({...i,personality:f.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(Ms,{id:"reply_style",value:i.reply_style,onChange:f=>r({...i,reply_style:f.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"interest",children:"兴趣"}),e.jsx(Ms,{id:"interest",value:i.interest,onChange:f=>r({...i,interest:f.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(Ms,{id:"plan_style",value:i.plan_style,onChange:f=>r({...i,plan_style:f.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(Ms,{id:"visual_style",value:i.visual_style,onChange:f=>r({...i,visual_style:f.target.value}),placeholder:"识图时的处理规则",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"private_plan_style",children:"私聊规则"}),e.jsx(Ms,{id:"private_plan_style",value:i.private_plan_style,onChange:f=>r({...i,private_plan_style:f.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{children:"状态列表(人格多样性)"}),e.jsxs(C,{onClick:d,size:"sm",variant:"outline",children:[e.jsx(rt,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),e.jsx("div",{className:"space-y-2",children:i.states.map((f,p)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ms,{value:f,onChange:g=>x(p,g.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsx(is,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>m(p),children:"删除"})]})]})]})]},p))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"state_probability",children:"状态替换概率"}),e.jsx(re,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:i.state_probability,onChange:f=>r({...i,state_probability:parseFloat(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}),Oe=UN,Re=BN,Ae=u.forwardRef(({className:n,children:i,...r},d)=>e.jsxs(eg,{ref:d,className:G("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...r,children:[i,e.jsx(AN,{asChild:!0,children:e.jsx(Rl,{className:"h-4 w-4 opacity-50"})})]}));Ae.displayName=eg.displayName;const Gg=u.forwardRef(({className:n,...i},r)=>e.jsx(sg,{ref:r,className:G("flex cursor-default items-center justify-center py-1",n),...i,children:e.jsx(mr,{className:"h-4 w-4"})}));Gg.displayName=sg.displayName;const Fg=u.forwardRef(({className:n,...i},r)=>e.jsx(tg,{ref:r,className:G("flex cursor-default items-center justify-center py-1",n),...i,children:e.jsx(Rl,{className:"h-4 w-4"})}));Fg.displayName=tg.displayName;const De=u.forwardRef(({className:n,children:i,position:r="popper",...d},m)=>e.jsx(DN,{children:e.jsxs(ag,{ref:m,className:G("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg 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 origin-[--radix-select-content-transform-origin]",r==="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",n),position:r,...d,children:[e.jsx(Gg,{}),e.jsx(ON,{className:G("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:i}),e.jsx(Fg,{})]})}));De.displayName=ag.displayName;const hw=u.forwardRef(({className:n,...i},r)=>e.jsx(lg,{ref:r,className:G("px-2 py-1.5 text-sm font-semibold",n),...i}));hw.displayName=lg.displayName;const ne=u.forwardRef(({className:n,children:i,...r},d)=>e.jsxs(ng,{ref:d,className:G("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...r,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(RN,{children:e.jsx(Vt,{className:"h-4 w-4"})})}),e.jsx(LN,{children:i})]}));ne.displayName=ng.displayName;const fw=u.forwardRef(({className:n,...i},r)=>e.jsx(ig,{ref:r,className:G("-mx-1 my-1 h-px bg-muted",n),...i}));fw.displayName=ig.displayName;const La=mN,Ua=xN,Ta=u.forwardRef(({className:n,align:i="center",sideOffset:r=4,...d},m)=>e.jsx(uN,{children:e.jsx($p,{ref:m,align:i,sideOffset:r,className:G("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 origin-[--radix-popover-content-transform-origin]",n),...d})}));Ta.displayName=$p.displayName;const pw=gt.memo(function({value:i,onChange:r}){const[d,m]=u.useState("00"),[x,f]=u.useState("00"),[p,g]=u.useState("23"),[N,j]=u.useState("59");u.useEffect(()=>{const y=i.split("-");if(y.length===2){const[T,_]=y,[L,D]=T.split(":"),[U,I]=_.split(":");L&&m(L.padStart(2,"0")),D&&f(D.padStart(2,"0")),U&&g(U.padStart(2,"0")),I&&j(I.padStart(2,"0"))}},[i]);const w=(y,T,_,L)=>{const D=`${y}:${T}-${_}:${L}`;r(D)};return e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(C,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(Zn,{className:"h-4 w-4 mr-2"}),i||"选择时间段"]})}),e.jsx(Ta,{className:"w-72 sm:w-80",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-xs",children:"小时"}),e.jsxs(Oe,{value:d,onValueChange:y=>{m(y),w(y,x,p,N)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsx(De,{children:Array.from({length:24},(y,T)=>T).map(y=>e.jsx(ne,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-xs",children:"分钟"}),e.jsxs(Oe,{value:x,onValueChange:y=>{f(y),w(d,y,p,N)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsx(De,{children:Array.from({length:60},(y,T)=>T).map(y=>e.jsx(ne,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-xs",children:"小时"}),e.jsxs(Oe,{value:p,onValueChange:y=>{g(y),w(d,x,y,N)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsx(De,{children:Array.from({length:24},(y,T)=>T).map(y=>e.jsx(ne,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-xs",children:"分钟"}),e.jsxs(Oe,{value:N,onValueChange:y=>{j(y),w(d,x,p,y)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsx(De,{children:Array.from({length:60},(y,T)=>T).map(y=>e.jsx(ne,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]})]})]})]})})]})}),gw=gt.memo(function({rule:i}){const r=`{ target = "${i.target}", time = "${i.time}", value = ${i.value.toFixed(1)} }`;return e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Ot,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ta,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:r}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})}),jw=gt.memo(function({config:i,onChange:r}){const d=()=>{r({...i,talk_value_rules:[...i.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},m=f=>{r({...i,talk_value_rules:i.talk_value_rules.filter((p,g)=>g!==f)})},x=(f,p,g)=>{const N=[...i.talk_value_rules];N[f]={...N[f],[p]:g},r({...i,talk_value_rules:N})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(re,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:i.talk_value,onChange:f=>r({...i,talk_value:parseFloat(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"mentioned_bot_reply",checked:i.mentioned_bot_reply,onCheckedChange:f=>r({...i,mentioned_bot_reply:f})}),e.jsx(k,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(re,{id:"max_context_size",type:"number",min:"1",value:i.max_context_size,onChange:f=>r({...i,max_context_size:parseInt(f.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(re,{id:"planner_smooth",type:"number",step:"1",min:"0",value:i.planner_smooth,onChange:f=>r({...i,planner_smooth:parseFloat(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"enable_talk_value_rules",checked:i.enable_talk_value_rules,onCheckedChange:f=>r({...i,enable_talk_value_rules:f})}),e.jsx(k,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"include_planner_reasoning",checked:i.include_planner_reasoning,onCheckedChange:f=>r({...i,include_planner_reasoning:f})}),e.jsx(k,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),i.enable_talk_value_rules&&e.jsxs("div",{className:"border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),e.jsxs(C,{onClick:d,size:"sm",children:[e.jsx(rt,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),i.talk_value_rules&&i.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:i.talk_value_rules.map((f,p)=>e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",p+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(gw,{rule:f}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"sm",children:e.jsx(Je,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:["确定要删除规则 #",p+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>m(p),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Oe,{value:f.target===""?"global":"specific",onValueChange:g=>{g==="global"?x(p,"target",""):x(p,"target","qq::group")},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"global",children:"全局配置"}),e.jsx(ne,{value:"specific",children:"详细配置"})]})]})]}),f.target!==""&&(()=>{const g=f.target.split(":"),N=g[0]||"qq",j=g[1]||"",w=g[2]||"group";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Oe,{value:N,onValueChange:y=>{x(p,"target",`${y}:${j}:${w}`)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"qq",children:"QQ"}),e.jsx(ne,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(re,{value:j,onChange:y=>{x(p,"target",`${N}:${y.target.value}:${w}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Oe,{value:w,onValueChange:y=>{x(p,"target",`${N}:${j}:${y}`)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"group",children:"群组(group)"}),e.jsx(ne,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",f.target||"(未设置)"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(pw,{value:f.time,onChange:g=>x(p,"time",g)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{htmlFor:`rule-value-${p}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(re,{id:`rule-value-${p}`,type:"number",step:"0.01",min:"0.01",max:"1",value:f.value,onChange:g=>{const N=parseFloat(g.target.value);isNaN(N)||x(p,"value",Math.max(.01,Math.min(1,N)))},className:"w-20 h-8 text-xs"})]}),e.jsx(ha,{value:[f.value],onValueChange:g=>x(p,"value",g[0]),min:.01,max:1,step:.01,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0.01 (极少发言)"}),e.jsx("span",{children:"0.5"}),e.jsx("span",{children:"1.0 (正常)"})]})]})]})]},p))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),e.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}),vw=gt.memo(function({config:i,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{checked:i.enable_asr,onCheckedChange:d=>r({...i,enable_asr:d})}),e.jsx(k,{className:"cursor-pointer",children:"启用语音识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}),bw=gt.memo(function({config:i,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{checked:i.enable,onCheckedChange:d=>r({...i,enable:d})}),e.jsx(k,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),i.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"LPMM 模式"}),e.jsxs(Oe,{value:i.lpmm_mode,onValueChange:d=>r({...i,lpmm_mode:d}),children:[e.jsx(Ae,{children:e.jsx(Re,{placeholder:"选择 LPMM 模式"})}),e.jsxs(De,{children:[e.jsx(ne,{value:"classic",children:"经典模式"}),e.jsx(ne,{value:"agent",children:"Agent 模式"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"同义词搜索 TopK"}),e.jsx(re,{type:"number",min:"1",value:i.rag_synonym_search_top_k,onChange:d=>r({...i,rag_synonym_search_top_k:parseInt(d.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"同义词阈值"}),e.jsx(re,{type:"number",step:"0.1",min:"0",max:"1",value:i.rag_synonym_threshold,onChange:d=>r({...i,rag_synonym_threshold:parseFloat(d.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"实体提取线程数"}),e.jsx(re,{type:"number",min:"1",value:i.info_extraction_workers,onChange:d=>r({...i,info_extraction_workers:parseInt(d.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"嵌入向量维度"}),e.jsx(re,{type:"number",min:"1",value:i.embedding_dimension,onChange:d=>r({...i,embedding_dimension:parseInt(d.target.value)})})]})]})]})]})]})}),Nw=gt.memo(function({config:i,onChange:r}){const[d,m]=u.useState(""),[x,f]=u.useState("WARNING"),p=()=>{d&&!i.suppress_libraries.includes(d)&&(r({...i,suppress_libraries:[...i.suppress_libraries,d]}),m(""))},g=_=>{r({...i,suppress_libraries:i.suppress_libraries.filter(L=>L!==_)})},N=()=>{d&&!i.library_log_levels[d]&&(r({...i,library_log_levels:{...i.library_log_levels,[d]:x}}),m(""),f("WARNING"))},j=_=>{const L={...i.library_log_levels};delete L[_],r({...i,library_log_levels:L})},w=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],y=["FULL","compact","lite"],T=["none","title","full"];return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"日期格式"}),e.jsx(re,{value:i.date_style,onChange:_=>r({...i,date_style:_.target.value}),placeholder:"例如: m-d H:i:s"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"日志级别样式"}),e.jsxs(Oe,{value:i.log_level_style,onValueChange:_=>r({...i,log_level_style:_}),children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsx(De,{children:y.map(_=>e.jsx(ne,{value:_,children:_},_))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"日志文本颜色"}),e.jsxs(Oe,{value:i.color_text,onValueChange:_=>r({...i,color_text:_}),children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsx(De,{children:T.map(_=>e.jsx(ne,{value:_,children:_},_))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"全局日志级别"}),e.jsxs(Oe,{value:i.log_level,onValueChange:_=>r({...i,log_level:_}),children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsx(De,{children:w.map(_=>e.jsx(ne,{value:_,children:_},_))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"控制台日志级别"}),e.jsxs(Oe,{value:i.console_log_level,onValueChange:_=>r({...i,console_log_level:_}),children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsx(De,{children:w.map(_=>e.jsx(ne,{value:_,children:_},_))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"文件日志级别"}),e.jsxs(Oe,{value:i.file_log_level,onValueChange:_=>r({...i,file_log_level:_}),children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsx(De,{children:w.map(_=>e.jsx(ne,{value:_,children:_},_))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(k,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:d,onChange:_=>m(_.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),p())}}),e.jsx(C,{onClick:p,size:"sm",className:"flex-shrink-0",children:e.jsx(rt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.suppress_libraries.map(_=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[e.jsx("span",{className:"text-sm",children:_}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>g(_),children:e.jsx(Je,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},_))})]}),e.jsxs("div",{children:[e.jsx(k,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:d,onChange:_=>m(_.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Oe,{value:x,onValueChange:f,children:[e.jsx(Ae,{className:"w-32",children:e.jsx(Re,{})}),e.jsx(De,{children:w.map(_=>e.jsx(ne,{value:_,children:_},_))})]}),e.jsx(C,{onClick:N,size:"sm",children:e.jsx(rt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(i.library_log_levels).map(([_,L])=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-medium",children:_}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:L}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>j(_),children:e.jsx(Je,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},_))})]})]})}),yw=gt.memo(function({config:i,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx(Be,{checked:i.show_prompt,onCheckedChange:d=>r({...i,show_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx(Be,{checked:i.show_replyer_prompt,onCheckedChange:d=>r({...i,show_replyer_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx(Be,{checked:i.show_replyer_reasoning,onCheckedChange:d=>r({...i,show_replyer_reasoning:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx(Be,{checked:i.show_jargon_prompt,onCheckedChange:d=>r({...i,show_jargon_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx(Be,{checked:i.show_memory_prompt,onCheckedChange:d=>r({...i,show_memory_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx(Be,{checked:i.show_planner_prompt,onCheckedChange:d=>r({...i,show_planner_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx(Be,{checked:i.show_lpmm_paragraph,onCheckedChange:d=>r({...i,show_lpmm_paragraph:d})})]})]})]})}),ww=gt.memo(function({config:i,onChange:r}){const[d,m]=u.useState(""),x=()=>{d&&!i.auth_token.includes(d)&&(r({...i,auth_token:[...i.auth_token,d]}),m(""))},f=p=>{r({...i,auth_token:i.auth_token.filter((g,N)=>N!==p)})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{children:"启用自定义服务器"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),e.jsx(Be,{checked:i.use_custom,onCheckedChange:p=>r({...i,use_custom:p})})]}),i.use_custom&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"主机地址"}),e.jsx(re,{value:i.host,onChange:p=>r({...i,host:p.target.value}),placeholder:"127.0.0.1"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"端口号"}),e.jsx(re,{type:"number",value:i.port,onChange:p=>r({...i,port:parseInt(p.target.value)}),placeholder:"8090"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"连接模式"}),e.jsxs(Oe,{value:i.mode,onValueChange:p=>r({...i,mode:p}),children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"ws",children:"WebSocket (ws)"}),e.jsx(ne,{value:"tcp",children:"TCP"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{checked:i.use_wss,onCheckedChange:p=>r({...i,use_wss:p}),disabled:i.mode!=="ws"}),e.jsx(k,{children:"使用 WSS 安全连接"})]})]}),i.use_wss&&i.mode==="ws"&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"SSL 证书文件路径"}),e.jsx(re,{value:i.cert_file,onChange:p=>r({...i,cert_file:p.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"SSL 密钥文件路径"}),e.jsx(re,{value:i.key_file,onChange:p=>r({...i,key_file:p.target.value}),placeholder:"key.pem"})]})]})]})]})]}),e.jsxs("div",{children:[e.jsx(k,{className:"mb-2 block",children:"认证令牌"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:d,onChange:p=>m(p.target.value),placeholder:"输入认证令牌",onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),x())}}),e.jsx(C,{onClick:x,size:"sm",children:e.jsx(rt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:i.auth_token.map((p,g)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:p}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>f(g),children:e.jsx(Je,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},g))})]})]})}),_w=gt.memo(function({config:i,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx(Be,{checked:i.enable,onCheckedChange:d=>r({...i,enable:d})})]})]})}),Sw=gt.memo(function({emojiConfig:i,memoryConfig:r,toolConfig:d,onEmojiChange:m,onMemoryChange:x,onToolChange:f}){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"enable_tool",checked:d.enable_tool,onCheckedChange:p=>f({...d,enable_tool:p})}),e.jsx(k,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(re,{id:"max_agent_iterations",type:"number",min:"1",value:r.max_agent_iterations,onChange:p=>x({...r,max_agent_iterations:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"agent_timeout_seconds",children:"最长回忆时间(秒)"}),e.jsx(re,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:r.agent_timeout_seconds??120,onChange:p=>x({...r,agent_timeout_seconds:parseFloat(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"记忆检索的超时时间,避免过长的等待"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"enable_jargon_detection",checked:r.enable_jargon_detection??!0,onCheckedChange:p=>x({...r,enable_jargon_detection:p})}),e.jsx(k,{htmlFor:"enable_jargon_detection",className:"cursor-pointer",children:"启用黑话识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"记忆检索过程中是否启用黑话识别"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"global_memory",checked:r.global_memory??!1,onCheckedChange:p=>x({...r,global_memory:p})}),e.jsx(k,{htmlFor:"global_memory",className:"cursor-pointer",children:"全局记忆查询"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许记忆检索在所有聊天记录中进行全局查询(忽略当前聊天流)"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(re,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:i.emoji_chance,onChange:p=>m({...i,emoji_chance:parseFloat(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(re,{id:"max_reg_num",type:"number",min:"1",value:i.max_reg_num,onChange:p=>m({...i,max_reg_num:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(re,{id:"check_interval",type:"number",min:"1",value:i.check_interval,onChange:p=>m({...i,check_interval:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"do_replace",checked:i.do_replace,onCheckedChange:p=>m({...i,do_replace:p})}),e.jsx(k,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"steal_emoji",checked:i.steal_emoji,onCheckedChange:p=>m({...i,steal_emoji:p})}),e.jsx(k,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"content_filtration",checked:i.content_filtration,onCheckedChange:p=>m({...i,content_filtration:p})}),e.jsx(k,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),i.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(k,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(re,{id:"filtration_prompt",value:i.filtration_prompt,onChange:p=>m({...i,filtration_prompt:p.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),Cw=gt.memo(function({member:i,groupIndex:r,memberIndex:d,availableChatIds:m,onUpdate:x,onRemove:f}){const p=m.includes(i)||i==="*",[g,N]=u.useState(!p);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:g?e.jsxs(e.Fragment,{children:[e.jsx(re,{value:i,onChange:j=>x(r,d,j.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),m.length>0&&e.jsx(C,{size:"sm",variant:"outline",onClick:()=>N(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Oe,{value:i,onValueChange:j=>x(r,d,j),children:[e.jsx(Ae,{className:"flex-1",children:e.jsx(Re,{placeholder:"选择聊天流"})}),e.jsxs(De,{children:[e.jsx(ne,{value:"*",children:"* (全局共享)"}),m.map((j,w)=>e.jsx(ne,{value:j,children:j},w))]})]}),e.jsx(C,{size:"sm",variant:"outline",onClick:()=>N(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:['确定要删除组成员 "',i||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>f(r,d),children:"删除"})]})]})]})]})}),kw=gt.memo(function({config:i,onChange:r}){const d=()=>{r({...i,learning_list:[...i.learning_list,["","enable","enable","1.0"]]})},m=y=>{r({...i,learning_list:i.learning_list.filter((T,_)=>_!==y)})},x=(y,T,_)=>{const L=[...i.learning_list];L[y][T]=_,r({...i,learning_list:L})},f=({rule:y})=>{const T=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Ot,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ta,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},p=()=>{r({...i,expression_groups:[...i.expression_groups,[]]})},g=y=>{r({...i,expression_groups:i.expression_groups.filter((T,_)=>_!==y)})},N=y=>{const T=[...i.expression_groups];T[y]=[...T[y],""],r({...i,expression_groups:T})},j=(y,T)=>{const _=[...i.expression_groups];_[y]=_[y].filter((L,D)=>D!==T),r({...i,expression_groups:_})},w=(y,T,_)=>{const L=[...i.expression_groups];L[y][T]=_,r({...i,expression_groups:L})};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),e.jsxs(C,{onClick:d,size:"sm",variant:"outline",children:[e.jsx(rt,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[i.learning_list.map((y,T)=>{const _=i.learning_list.some((z,Y)=>Y!==T&&z[0]===""),L=y[0]==="",D=y[0].split(":"),U=D[0]||"qq",I=D[1]||"",R=D[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["规则 ",T+1," ",L&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{rule:y}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:["确定要删除学习规则 ",T+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>m(T),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Oe,{value:L?"global":"specific",onValueChange:z=>{z==="global"?x(T,0,""):x(T,0,"qq::group")},disabled:_&&!L,children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"global",children:"全局配置"}),e.jsx(ne,{value:"specific",disabled:_&&!L,children:"详细配置"})]})]}),_&&!L&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!L&&e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Oe,{value:U,onValueChange:z=>{x(T,0,`${z}:${I}:${R}`)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"qq",children:"QQ"}),e.jsx(ne,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(re,{value:I,onChange:z=>{x(T,0,`${U}:${z.target.value}:${R}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Oe,{value:R,onValueChange:z=>{x(T,0,`${U}:${I}:${z}`)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"group",children:"群组(group)"}),e.jsx(ne,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",y[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Be,{checked:y[1]==="enable",onCheckedChange:z=>x(T,1,z?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx(Be,{checked:y[2]==="enable",onCheckedChange:z=>x(T,2,z?"enable":"disable")})]})}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{className:"text-xs font-medium",children:"学习强度"}),e.jsx(re,{type:"number",step:"0.1",min:"0",max:"5",value:y[3],onChange:z=>{const Y=parseFloat(z.target.value);isNaN(Y)||x(T,3,Math.max(0,Math.min(5,Y)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),e.jsx(ha,{value:[parseFloat(y[3])||1],onValueChange:z=>x(T,3,z[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0 (不学习)"}),e.jsx("span",{children:"2.5"}),e.jsx("span",{children:"5.0 (快速学习)"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},T)}),i.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达反思配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦主动向管理员询问表达方式是否合适的功能"})]}),e.jsx(Be,{checked:i.reflect,onCheckedChange:y=>r({...i,reflect:y})})]}),i.reflect&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"反思操作员"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const T=(i.reflect_operator_id||"").split(":"),_=T[0]||"qq",L=T[1]||"",D=T[2]||"private";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Oe,{value:_,onValueChange:U=>{r({...i,reflect_operator_id:`${U}:${L}:${D}`})},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"qq",children:"QQ"}),e.jsx(ne,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(re,{value:L,onChange:U=>{r({...i,reflect_operator_id:`${_}:${U.target.value}:${D}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Oe,{value:D,onValueChange:U=>{r({...i,reflect_operator_id:`${_}:${L}:${U}`})},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"private",children:"私聊(private)"}),e.jsx(ne,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",i.reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会向此操作员询问表达方式是否合适"})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"允许反思的聊天流"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思"})]}),e.jsxs(C,{onClick:()=>{r({...i,allow_reflect:[...i.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(rt,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(i.allow_reflect||[]).map((y,T)=>{const _=y.split(":"),L=_[0]||"qq",D=_[1]||"",U=_[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Oe,{value:L,onValueChange:I=>{const R=[...i.allow_reflect];R[T]=`${I}:${D}:${U}`,r({...i,allow_reflect:R})},children:[e.jsx(Ae,{className:"w-24",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"qq",children:"QQ"}),e.jsx(ne,{value:"wx",children:"微信"})]})]}),e.jsx(re,{value:D,onChange:I=>{const R=[...i.allow_reflect];R[T]=`${L}:${I.target.value}:${U}`,r({...i,allow_reflect:R})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Oe,{value:U,onValueChange:I=>{const R=[...i.allow_reflect];R[T]=`${L}:${D}:${I}`,r({...i,allow_reflect:R})},children:[e.jsx(Ae,{className:"w-32",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"group",children:"群组"}),e.jsx(ne,{value:"private",children:"私聊"})]})]}),e.jsx(C,{onClick:()=>{r({...i,allow_reflect:i.allow_reflect.filter((I,R)=>R!==T)})},size:"sm",variant:"ghost",children:e.jsx(Je,{className:"h-4 w-4"})})]},T)}),(!i.allow_reflect||i.allow_reflect.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:"列表为空,所有聊天流都可以进行表达反思"})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),e.jsxs(C,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(rt,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[i.expression_groups.map((y,T)=>{const _=i.learning_list.map(L=>L[0]).filter(L=>L!=="");return e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",T+1,y.length===1&&y[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(C,{onClick:()=>N(T),size:"sm",variant:"outline",children:e.jsx(rt,{className:"h-4 w-4"})}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:["确定要删除共享组 ",T+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>g(T),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:y.map((L,D)=>e.jsx(Cw,{member:L,groupIndex:T,memberIndex:D,availableChatIds:_,onUpdate:w,onRemove:j},`${T}-${D}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},T)}),i.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"黑话设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"all_global_jargon",checked:i.all_global_jargon??!1,onCheckedChange:y=>r({...i,all_global_jargon:y})}),e.jsx(k,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"全局黑话模式"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"开启后,新增的黑话将默认设为全局(所有聊天流共享)。关闭后,已记录的全局黑话不会改变,需要手动删除。"})]})})]})});function Tw({regex:n,reaction:i,onRegexChange:r,onReactionChange:d}){const[m,x]=u.useState(!1),[f,p]=u.useState(""),[g,N]=u.useState(null),[j,w]=u.useState(""),[y,T]=u.useState({}),[_,L]=u.useState(""),D=u.useRef(null),[U,I]=u.useState("build"),R=E=>E.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),z=(E,M=0)=>{const te=D.current;if(!te)return;const fe=te.selectionStart||0,je=te.selectionEnd||0,ve=n.substring(0,fe)+E+n.substring(je);r(ve),setTimeout(()=>{const ge=fe+E.length+M;te.setSelectionRange(ge,ge),te.focus()},0)};u.useEffect(()=>{if(!n||!f){N(null),T({}),L(i),w("");return}try{const E=R(n),M=new RegExp(E,"g"),te=f.match(M);N(te),w("");const je=new RegExp(E).exec(f);if(je&&je.groups){T(je.groups);let ve=i;Object.entries(je.groups).forEach(([ge,be])=>{ve=ve.replace(new RegExp(`\\[${ge}\\]`,"g"),be||"")}),L(ve)}else T({}),L(i)}catch(E){w(E.message),N(null),T({}),L(i)}},[n,f,i]);const Y=()=>{if(!f||!g||g.length===0)return e.jsx("span",{className:"text-muted-foreground",children:f||"请输入测试文本"});try{const E=R(n),M=new RegExp(E,"g");let te=0;const fe=[];let je;for(;(je=M.exec(f))!==null;)je.index>te&&fe.push(e.jsx("span",{children:f.substring(te,je.index)},`text-${te}`)),fe.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:je[0]},`match-${je.index}`)),te=je.index+je[0].length;return te)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return e.jsxs(Hs,{open:m,onOpenChange:x,children:[e.jsx(Zu,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Xu,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(As,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"正则表达式编辑器"}),e.jsx(Js,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(Ke,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(ka,{value:U,onValueChange:E=>I(E),className:"w-full",children:[e.jsxs(fa,{className:"grid w-full grid-cols-2",children:[e.jsx(ss,{value:"build",children:"🔧 构建器"}),e.jsx(ss,{value:"test",children:"🧪 测试器"})]}),e.jsxs(ys,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(re,{ref:D,value:n,onChange:E=>r(E.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(Ms,{value:i,onChange:E=>d(E.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[Q.map(E=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:E.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:E.items.map(M=>e.jsx(C,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>z(M.pattern,M.moveCursor||0),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("span",{className:"text-xs font-medium",children:M.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:M.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:M.desc})]})},M.label))})]},E.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("^(?P\\S{1,20})是这样的$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),e.jsx(C,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),e.jsx(C,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?P.+?)(?:是|为什么|怎么)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),e.jsxs("li",{children:["命名捕获组格式:",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),e.jsxs("li",{children:["在 reaction 中使用 ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),e.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),e.jsxs(ys,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:n||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(Ms,{id:"test-text",value:f,onChange:E=>p(E.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),j&&e.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),e.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:j})]}),!j&&f&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:g&&g.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",g.length," 处)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(Ke,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:Y()})})]}),Object.keys(y).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(Ke,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(y).map(([E,M])=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",E,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:M})]},E))})})]}),Object.keys(y).length>0&&i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(Ke,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:_})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),e.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),e.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),e.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})}const Ew=gt.memo(function({keywordReactionConfig:i,responsePostProcessConfig:r,chineseTypoConfig:d,responseSplitterConfig:m,onKeywordReactionChange:x,onResponsePostProcessChange:f,onChineseTypoChange:p,onResponseSplitterChange:g}){const N=()=>{x({...i,regex_rules:[...i.regex_rules,{regex:[""],reaction:""}]})},j=z=>{x({...i,regex_rules:i.regex_rules.filter((Y,Q)=>Q!==z)})},w=(z,Y,Q)=>{const E=[...i.regex_rules];Y==="regex"&&typeof Q=="string"?E[z]={...E[z],regex:[Q]}:Y==="reaction"&&typeof Q=="string"&&(E[z]={...E[z],reaction:Q}),x({...i,regex_rules:E})},y=()=>{x({...i,keyword_rules:[...i.keyword_rules,{keywords:[],reaction:""}]})},T=z=>{x({...i,keyword_rules:i.keyword_rules.filter((Y,Q)=>Q!==z)})},_=(z,Y,Q)=>{const E=[...i.keyword_rules];typeof Q=="string"&&(E[z]={...E[z],reaction:Q}),x({...i,keyword_rules:E})},L=z=>{const Y=[...i.keyword_rules];Y[z]={...Y[z],keywords:[...Y[z].keywords||[],""]},x({...i,keyword_rules:Y})},D=(z,Y)=>{const Q=[...i.keyword_rules];Q[z]={...Q[z],keywords:(Q[z].keywords||[]).filter((E,M)=>M!==Y)},x({...i,keyword_rules:Q})},U=(z,Y,Q)=>{const E=[...i.keyword_rules],M=[...E[z].keywords||[]];M[Y]=Q,E[z]={...E[z],keywords:M},x({...i,keyword_rules:E})},I=({rule:z})=>{const Y=`{ regex = [${(z.regex||[]).map(Q=>`"${Q}"`).join(", ")}], reaction = "${z.reaction}" }`;return e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Ot,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ta,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Ke,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:Y})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},R=({rule:z})=>{const Y=`[[keyword_reaction.keyword_rules]] -keywords = [${(z.keywords||[]).map(Q=>`"${Q}"`).join(", ")}] -reaction = "${z.reaction}"`;return e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Ot,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ta,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Ke,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:Y})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),e.jsxs(C,{onClick:N,size:"sm",variant:"outline",children:[e.jsx(rt,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[i.regex_rules.map((z,Y)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",Y+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Tw,{regex:z.regex&&z.regex[0]||"",reaction:z.reaction,onRegexChange:Q=>w(Y,"regex",Q),onReactionChange:Q=>w(Y,"reaction",Q)}),e.jsx(I,{rule:z}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:["确定要删除正则规则 ",Y+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>j(Y),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(re,{value:z.regex&&z.regex[0]||"",onChange:Q=>w(Y,"regex",Q.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Ms,{value:z.reaction,onChange:Q=>w(Y,"reaction",Q.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},Y)),i.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),e.jsxs(C,{onClick:y,size:"sm",variant:"outline",children:[e.jsx(rt,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[i.keyword_rules.map((z,Y)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",Y+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{rule:z}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:["确定要删除关键词规则 ",Y+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>T(Y),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(C,{onClick:()=>L(Y),size:"sm",variant:"ghost",children:[e.jsx(rt,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(z.keywords||[]).map((Q,E)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{value:Q,onChange:M=>U(Y,E,M.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(C,{onClick:()=>D(Y,E),size:"sm",variant:"ghost",children:e.jsx(Je,{className:"h-4 w-4"})})]},E)),(!z.keywords||z.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Ms,{value:z.reaction,onChange:Q=>_(Y,"reaction",Q.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},Y)),i.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"enable_response_post_process",checked:r.enable_response_post_process,onCheckedChange:z=>f({...r,enable_response_post_process:z})}),e.jsx(k,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),r.enable_response_post_process&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Be,{id:"enable_chinese_typo",checked:d.enable,onCheckedChange:z=>p({...d,enable:z})}),e.jsx(k,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),d.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),e.jsx(re,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:d.error_rate,onChange:z=>p({...d,error_rate:parseFloat(z.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(re,{id:"min_freq",type:"number",min:"0",value:d.min_freq,onChange:z=>p({...d,min_freq:parseInt(z.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),e.jsx(re,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:d.tone_error_rate,onChange:z=>p({...d,tone_error_rate:parseFloat(z.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),e.jsx(re,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:d.word_replace_rate,onChange:z=>p({...d,word_replace_rate:parseFloat(z.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Be,{id:"enable_response_splitter",checked:m.enable,onCheckedChange:z=>g({...m,enable:z})}),e.jsx(k,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),m.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(re,{id:"max_length",type:"number",min:"1",value:m.max_length,onChange:z=>g({...m,max_length:parseInt(z.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(re,{id:"max_sentence_num",type:"number",min:"1",value:m.max_sentence_num,onChange:z=>g({...m,max_sentence_num:parseInt(z.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"enable_kaomoji_protection",checked:m.enable_kaomoji_protection,onCheckedChange:z=>g({...m,enable_kaomoji_protection:z})}),e.jsx(k,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"enable_overflow_return_all",checked:m.enable_overflow_return_all,onCheckedChange:z=>g({...m,enable_overflow_return_all:z})}),e.jsx(k,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),Ll="/api/webui/config";async function hp(){const i=await(await _e(`${Ll}/bot`)).json();if(!i.success)throw new Error("获取配置数据失败");return i.config}async function Wn(){const i=await(await _e(`${Ll}/model`)).json();if(!i.success)throw new Error("获取模型配置数据失败");return i.config}async function fp(n){const r=await(await _e(`${Ll}/bot`,{method:"POST",body:JSON.stringify(n)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function zw(){const i=await(await _e(`${Ll}/bot/raw`)).json();if(!i.success)throw new Error("获取配置源代码失败");return i.content}async function Mw(n){const r=await(await _e(`${Ll}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:n})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function Pc(n){const r=await(await _e(`${Ll}/model`,{method:"POST",body:JSON.stringify(n)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function Aw(n,i){const d=await(await _e(`${Ll}/bot/section/${n}`,{method:"POST",body:JSON.stringify(i)})).json();if(!d.success)throw new Error(d.message||`保存配置节 ${n} 失败`)}async function Fu(n,i){const d=await(await _e(`${Ll}/model/section/${n}`,{method:"POST",body:JSON.stringify(i)})).json();if(!d.success)throw new Error(d.message||`保存配置节 ${n} 失败`)}async function Dw(n,i="openai",r="/models"){const d=new URLSearchParams({provider_name:n,parser:i,endpoint:r}),m=await _e(`/api/webui/models/list?${d}`);if(!m.ok){const f=await m.json().catch(()=>({}));throw new Error(f.detail||`获取模型列表失败 (${m.status})`)}const x=await m.json();if(!x.success)throw new Error("获取模型列表失败");return x.models}async function Ow(n){const i=new URLSearchParams({provider_name:n}),r=await _e(`/api/webui/models/test-connection-by-name?${i}`,{method:"POST"});if(!r.ok){const d=await r.json().catch(()=>({}));throw new Error(d.detail||`测试连接失败 (${r.status})`)}return await r.json()}const Rw=ti("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),$t=u.forwardRef(({className:n,variant:i,...r},d)=>e.jsx("div",{ref:d,role:"alert",className:G(Rw({variant:i}),n),...r}));$t.displayName="Alert";const Lw=u.forwardRef(({className:n,...i},r)=>e.jsx("h5",{ref:r,className:G("mb-1 font-medium leading-none tracking-tight",n),...i}));Lw.displayName="AlertTitle";const Qt=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:G("text-sm [&_p]:leading-relaxed",n),...i}));Qt.displayName="AlertDescription";function em({onRestartComplete:n,onRestartFailed:i}){const[r,d]=u.useState(0),[m,x]=u.useState("restarting"),[f,p]=u.useState(0),[g,N]=u.useState(0);u.useEffect(()=>{const y=setInterval(()=>{d(L=>L>=90?L:L+1)},200),T=setInterval(()=>{p(L=>L+1)},1e3),_=setTimeout(()=>{x("checking"),j()},3e3);return()=>{clearInterval(y),clearInterval(T),clearTimeout(_)}},[]);const j=()=>{const T=async()=>{try{if(N(L=>L+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)d(100),x("success"),setTimeout(()=>{n?.()},1500);else throw new Error("Status check failed")}catch{g<60?setTimeout(T,2e3):(x("failed"),i?.())}};T()},w=y=>{const T=Math.floor(y/60),_=y%60;return`${T}:${_.toString().padStart(2,"0")}`};return e.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:e.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[m==="restarting"&&e.jsxs(e.Fragment,{children:[e.jsx(Ks,{className:"h-16 w-16 text-primary animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),m==="checking"&&e.jsxs(e.Fragment,{children:[e.jsx(Ks,{className:"h-16 w-16 text-primary animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),e.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",g,"/60)"]})]}),m==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(ta,{className:"h-16 w-16 text-green-500"}),e.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),m==="failed"&&e.jsxs(e.Fragment,{children:[e.jsx(zt,{className:"h-16 w-16 text-destructive"}),e.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),m!=="failed"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(ii,{value:r,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[r,"%"]}),e.jsxs("span",{children:["已用时: ",w(f)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[m==="restarting"&&"🔄 配置已保存,正在重启主程序...",m==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",m==="success"&&"✅ 配置已生效,服务运行正常",m==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),m==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),e.jsx("button",{onClick:()=>{x("checking"),N(0),j()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}const Uw={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(n,i){let r;if(!i.inString&&(r=n.match(/^('''|"""|'|")/))&&(i.stringType=r[0],i.inString=!0),n.sol()&&!i.inString&&i.inArray===0&&(i.lhs=!0),i.inString){for(;i.inString;)if(n.match(i.stringType))i.inString=!1;else if(n.peek()==="\\")n.next(),n.next();else{if(n.eol())break;n.match(/^.[^\\\"\']*/)}return i.lhs?"property":"string"}else{if(i.inArray&&n.peek()==="]")return n.next(),i.inArray--,"bracket";if(i.lhs&&n.peek()==="["&&n.skipTo("]"))return n.next(),n.peek()==="]"&&n.next(),"atom";if(n.peek()==="#")return n.skipToEnd(),"comment";if(n.eatSpace())return null;if(i.lhs&&n.eatWhile(function(d){return d!="="&&d!=" "}))return"property";if(i.lhs&&n.peek()==="=")return n.next(),i.lhs=!1,null;if(!i.lhs&&n.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!i.lhs&&(n.match("true")||n.match("false")))return"atom";if(!i.lhs&&n.peek()==="[")return i.inArray++,n.next(),"bracket";if(!i.lhs&&n.match(/^\-?\d+(?:\.\d+)?/))return"number";n.eatSpace()||n.next()}return null},languageData:{commentTokens:{line:"#"}}},Bw={python:[My()],json:[Ay(),Dy()],toml:[zy.define(Uw)],text:[]};function Hw({value:n,onChange:i,language:r="text",readOnly:d=!1,height:m="400px",minHeight:x,maxHeight:f,placeholder:p,theme:g="dark",className:N=""}){const[j,w]=u.useState(!1);if(u.useEffect(()=>{w(!0)},[]),!j)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${N}`,style:{height:m,minHeight:x,maxHeight:f}});const y=[...Bw[r]||[],ap.lineWrapping];return d&&y.push(ap.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${N}`,children:e.jsx(Oy,{value:n,height:m,minHeight:x,maxHeight:f,theme:g==="dark"?Ry:void 0,extensions:y,onChange:i,placeholder:p,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function qw(n,i,r,d={}){const{debounceMs:m=2e3,onSaveSuccess:x,onSaveError:f}=d,p=u.useRef(null),g=u.useCallback(async(y,T)=>{try{i(!0),await Aw(y,T),r(!1),x?.()}catch(_){console.error(`自动保存 ${y} 失败:`,_),r(!0),f?.(_ instanceof Error?_:new Error(String(_)))}finally{i(!1)}},[i,r,x,f]),N=u.useCallback((y,T)=>{n||(r(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{g(y,T)},m))},[n,r,g,m]),j=u.useCallback(async(y,T)=>{p.current&&(clearTimeout(p.current),p.current=null),await g(y,T)},[g]),w=u.useCallback(()=>{p.current&&(clearTimeout(p.current),p.current=null)},[]);return u.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),{triggerAutoSave:N,saveNow:j,cancelPendingAutoSave:w}}function kt(n,i,r,d){u.useEffect(()=>{n&&!r&&d(i,n)},[n])}const Gw=500;function Fw(){const[n,i]=u.useState(!0),[r,d]=u.useState(!1),[m,x]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!1),[j,w]=u.useState(!1),[y,T]=u.useState("visual"),[_,L]=u.useState(""),[D,U]=u.useState(!1),{toast:I}=Rs(),[R,z]=u.useState(null),[Y,Q]=u.useState(null),[E,M]=u.useState(null),[te,fe]=u.useState(null),[je,ve]=u.useState(null),[ge,be]=u.useState(null),[Se,O]=u.useState(null),[F,q]=u.useState(null),[se,v]=u.useState(null),[K,me]=u.useState(null),[oe,xe]=u.useState(null),[ye,de]=u.useState(null),[W,ae]=u.useState(null),[$,Z]=u.useState(null),[ke,He]=u.useState(null),[pe,Te]=u.useState(null),[Qs,vt]=u.useState(null),ie=u.useRef(!0),qe=u.useRef({}),gs=u.useCallback(Ne=>{qe.current=Ne,z(Ne.bot),Q(Ne.personality);const bs=Ne.chat;bs.talk_value_rules||(bs.talk_value_rules=[]),M(bs),fe(Ne.expression),ve(Ne.emoji),be(Ne.memory),O(Ne.tool),q(Ne.voice),v(Ne.lpmm_knowledge),me(Ne.keyword_reaction),xe(Ne.response_post_process),de(Ne.chinese_typo),ae(Ne.response_splitter),Z(Ne.log),He(Ne.debug),Te(Ne.maim_message),vt(Ne.telemetry)},[]),Ys=u.useCallback(()=>({...qe.current,bot:R,personality:Y,chat:E,expression:te,emoji:je,memory:ge,tool:Se,voice:F,lpmm_knowledge:se,keyword_reaction:K,response_post_process:oe,chinese_typo:ye,response_splitter:W,log:$,debug:ke,maim_message:pe,telemetry:Qs}),[R,Y,E,te,je,ge,Se,F,se,K,oe,ye,W,$,ke,pe,Qs]),Ls=u.useCallback(async()=>{try{const Ne=await zw();L(Ne),U(!1)}catch(Ne){I({variant:"destructive",title:"加载失败",description:Ne instanceof Error?Ne.message:"加载源代码失败"})}},[I]),ft=u.useCallback(async()=>{try{i(!0);const Ne=await hp();gs(Ne),p(!1),ie.current=!1,await Ls()}catch(Ne){console.error("加载配置失败:",Ne),I({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{i(!1)}},[I,Ls,gs]);u.useEffect(()=>{ft()},[ft]);const{triggerAutoSave:ps,cancelPendingAutoSave:Us}=qw(ie.current,x,p);kt(R,"bot",ie.current,ps),kt(Y,"personality",ie.current,ps),kt(E,"chat",ie.current,ps),kt(te,"expression",ie.current,ps),kt(je,"emoji",ie.current,ps),kt(ge,"memory",ie.current,ps),kt(Se,"tool",ie.current,ps),kt(F,"voice",ie.current,ps),kt(se,"lpmm_knowledge",ie.current,ps),kt(K,"keyword_reaction",ie.current,ps),kt(oe,"response_post_process",ie.current,ps),kt(ye,"chinese_typo",ie.current,ps),kt(W,"response_splitter",ie.current,ps),kt($,"log",ie.current,ps),kt(ke,"debug",ie.current,ps),kt(pe,"maim_message",ie.current,ps),kt(Qs,"telemetry",ie.current,ps);const ja=async()=>{try{d(!0),await Mw(_),p(!1),U(!1),I({title:"保存成功",description:"配置已保存"}),await ft()}catch(Ne){U(!0),I({variant:"destructive",title:"保存失败",description:Ne instanceof Error?Ne.message:"保存配置失败"})}finally{d(!1)}},va=async Ne=>{if(f){I({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(T(Ne),Ne==="source")await Ls();else try{const bs=await hp();gs(bs),p(!1)}catch(bs){console.error("加载配置失败:",bs),I({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},X=async()=>{try{d(!0),Us(),await fp(Ys()),p(!1),I({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Ne){console.error("保存配置失败:",Ne),I({title:"保存失败",description:Ne.message,variant:"destructive"})}finally{d(!1)}},Ue=async()=>{try{N(!0),so().catch(()=>{}),w(!0)}catch(Ne){console.error("重启失败:",Ne),w(!1),I({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),N(!1)}},Ee=async()=>{try{d(!0),Us(),await fp(Ys()),p(!1),I({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ne=>setTimeout(Ne,Gw)),await Ue()}catch(Ne){console.error("保存失败:",Ne),I({title:"保存失败",description:Ne.message,variant:"destructive"})}finally{d(!1)}},Qe=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},qs=()=>{w(!1),N(!1),I({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return n?e.jsx(Ke,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ke,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"麦麦主程序配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"管理麦麦的核心功能和行为设置"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(C,{onClick:y==="visual"?X:ja,disabled:r||m||!f||g,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(jr,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:r?"保存中":m?"自动":f?"保存":"已保存"})]}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsxs(C,{disabled:r||m||g,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(gr,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:g?"重启中":f?"保存重启":"重启"})]})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认重启麦麦?"}),e.jsx(is,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:f?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:f?Ee:Ue,children:f?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(ka,{value:y,onValueChange:Ne=>va(Ne),className:"w-full",children:e.jsxs(fa,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(ss,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(cy,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(ss,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(oy,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs($t,{children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsxs(Qt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),y==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs($t,{children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsxs(Qt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",D&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(Hw,{value:_,onChange:Ne=>{L(Ne),p(!0),D&&U(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),y==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(ka,{defaultValue:"bot",className:"w-full",children:[e.jsxs(fa,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-9",children:[e.jsx(ss,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(ss,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(ss,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(ss,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(ss,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(ss,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(ss,{value:"voice",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"语音"}),e.jsx(ss,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(ss,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(ys,{value:"bot",className:"space-y-4",children:R&&e.jsx(mw,{config:R,onChange:z})}),e.jsx(ys,{value:"personality",className:"space-y-4",children:Y&&e.jsx(xw,{config:Y,onChange:Q})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:E&&e.jsx(jw,{config:E,onChange:M})}),e.jsx(ys,{value:"expression",className:"space-y-4",children:te&&e.jsx(kw,{config:te,onChange:fe})}),e.jsx(ys,{value:"features",className:"space-y-4",children:je&&ge&&Se&&e.jsx(Sw,{emojiConfig:je,memoryConfig:ge,toolConfig:Se,onEmojiChange:ve,onMemoryChange:be,onToolChange:O})}),e.jsx(ys,{value:"processing",className:"space-y-4",children:K&&oe&&ye&&W&&e.jsx(Ew,{keywordReactionConfig:K,responsePostProcessConfig:oe,chineseTypoConfig:ye,responseSplitterConfig:W,onKeywordReactionChange:me,onResponsePostProcessChange:xe,onChineseTypoChange:de,onResponseSplitterChange:ae})}),e.jsx(ys,{value:"voice",className:"space-y-4",children:F&&e.jsx(vw,{config:F,onChange:q})}),e.jsx(ys,{value:"lpmm",className:"space-y-4",children:se&&e.jsx(bw,{config:se,onChange:v})}),e.jsxs(ys,{value:"other",className:"space-y-4",children:[$&&e.jsx(Nw,{config:$,onChange:Z}),ke&&e.jsx(yw,{config:ke,onChange:He}),pe&&e.jsx(ww,{config:pe,onChange:Te}),Qs&&e.jsx(_w,{config:Qs,onChange:vt})]})]})}),j&&e.jsx(em,{onRestartComplete:Qe,onRestartFailed:qs})]})})}const rn=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:G("w-full caption-bottom text-sm",n),...i})}));rn.displayName="Table";const cn=u.forwardRef(({className:n,...i},r)=>e.jsx("thead",{ref:r,className:G("[&_tr]:border-b",n),...i}));cn.displayName="TableHeader";const on=u.forwardRef(({className:n,...i},r)=>e.jsx("tbody",{ref:r,className:G("[&_tr:last-child]:border-0",n),...i}));on.displayName="TableBody";const Vw=u.forwardRef(({className:n,...i},r)=>e.jsx("tfoot",{ref:r,className:G("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n),...i}));Vw.displayName="TableFooter";const ct=u.forwardRef(({className:n,...i},r)=>e.jsx("tr",{ref:r,className:G("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n),...i}));ct.displayName="TableRow";const Ye=u.forwardRef(({className:n,...i},r)=>e.jsx("th",{ref:r,className:G("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...i}));Ye.displayName="TableHead";const Ge=u.forwardRef(({className:n,...i},r)=>e.jsx("td",{ref:r,className:G("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...i}));Ge.displayName="TableCell";const $w=u.forwardRef(({className:n,...i},r)=>e.jsx("caption",{ref:r,className:G("mt-4 text-sm text-muted-foreground",n),...i}));$w.displayName="TableCaption";const to=u.forwardRef(({className:n,...i},r)=>e.jsx(It,{ref:r,className:G("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",n),...i}));to.displayName=It.displayName;const ao=u.forwardRef(({className:n,...i},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Mt,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(It.Input,{ref:r,className:G("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",n),...i})]}));ao.displayName=It.Input.displayName;const lo=u.forwardRef(({className:n,...i},r)=>e.jsx(It.List,{ref:r,className:G("max-h-[300px] overflow-y-auto overflow-x-hidden",n),...i}));lo.displayName=It.List.displayName;const no=u.forwardRef((n,i)=>e.jsx(It.Empty,{ref:i,className:"py-6 text-center text-sm",...n}));no.displayName=It.Empty.displayName;const fr=u.forwardRef(({className:n,...i},r)=>e.jsx(It.Group,{ref:r,className:G("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",n),...i}));fr.displayName=It.Group.displayName;const Qw=u.forwardRef(({className:n,...i},r)=>e.jsx(It.Separator,{ref:r,className:G("-mx-1 h-px bg-border",n),...i}));Qw.displayName=It.Separator.displayName;const pr=u.forwardRef(({className:n,...i},r)=>e.jsx(It.Item,{ref:r,className:G("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n),...i}));pr.displayName=It.Item.displayName;const ht=u.forwardRef(({className:n,...i},r)=>e.jsx(rg,{ref:r,className:G("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...i,children:e.jsx(HN,{className:G("grid place-content-center text-current"),children:e.jsx(Vt,{className:"h-4 w-4"})})}));ht.displayName=rg.displayName;const Vg=u.createContext(null),$g="maibot-completed-tours";function Iw(){try{const n=localStorage.getItem($g);return n?new Set(JSON.parse(n)):new Set}catch{return new Set}}function pp(n){localStorage.setItem($g,JSON.stringify([...n]))}function Yw({children:n}){const[i,r]=u.useState({activeTourId:null,stepIndex:0,isRunning:!1}),d=u.useRef(new Map),[,m]=u.useState(0),[x,f]=u.useState(Iw),p=u.useCallback((R,z)=>{d.current.set(R,z),m(Y=>Y+1)},[]),g=u.useCallback(R=>{d.current.delete(R),r(z=>z.activeTourId===R?{...z,activeTourId:null,isRunning:!1,stepIndex:0}:z)},[]),N=u.useCallback((R,z=0)=>{d.current.has(R)&&r({activeTourId:R,stepIndex:z,isRunning:!0})},[]),j=u.useCallback(()=>{r(R=>({...R,isRunning:!1}))},[]),w=u.useCallback(R=>{r(z=>({...z,stepIndex:R}))},[]),y=u.useCallback(()=>{r(R=>({...R,stepIndex:R.stepIndex+1}))},[]),T=u.useCallback(()=>{r(R=>({...R,stepIndex:Math.max(0,R.stepIndex-1)}))},[]),_=u.useCallback(()=>i.activeTourId?d.current.get(i.activeTourId)||[]:[],[i.activeTourId]),L=u.useCallback(R=>{f(z=>{const Y=new Set(z);return Y.add(R),pp(Y),Y})},[]),D=u.useCallback(R=>{const{action:z,index:Y,status:Q,type:E}=R,M=["finished","skipped"];if(z==="close"){r(te=>({...te,isRunning:!1,stepIndex:0}));return}M.includes(Q)?r(te=>(Q==="finished"&&te.activeTourId&&setTimeout(()=>L(te.activeTourId),0),{...te,isRunning:!1,stepIndex:0})):E==="step:after"&&(z==="next"?r(te=>({...te,stepIndex:Y+1})):z==="prev"&&r(te=>({...te,stepIndex:Y-1})))},[L]),U=u.useCallback(R=>x.has(R),[x]),I=u.useCallback(R=>{f(z=>{const Y=new Set(z);return Y.delete(R),pp(Y),Y})},[]);return e.jsx(Vg.Provider,{value:{state:i,tours:d.current,registerTour:p,unregisterTour:g,startTour:N,stopTour:j,goToStep:w,nextStep:y,prevStep:T,getCurrentSteps:_,handleJoyrideCallback:D,isTourCompleted:U,markTourCompleted:L,resetTourCompleted:I},children:n})}function sm(){const n=u.useContext(Vg);if(!n)throw new Error("useTour must be used within a TourProvider");return n}const Xw={options:{zIndex:1e4,primaryColor:"hsl(var(--primary))",textColor:"hsl(var(--foreground))",backgroundColor:"hsl(var(--background))",arrowColor:"hsl(var(--background))",overlayColor:"rgba(0, 0, 0, 0.5)"},tooltip:{borderRadius:"var(--radius)",padding:"1rem"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"1rem",fontWeight:600,marginBottom:"0.5rem"},tooltipContent:{fontSize:"0.875rem",padding:"0.5rem 0"},buttonNext:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",borderRadius:"calc(var(--radius) - 2px)",fontSize:"0.875rem",padding:"0.5rem 1rem"},buttonBack:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem",marginRight:"0.5rem"},buttonSkip:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem"},buttonClose:{color:"hsl(var(--muted-foreground))"},spotlight:{borderRadius:"var(--radius)"}},Kw={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function Jw(){const{state:n,getCurrentSteps:i,handleJoyrideCallback:r}=sm(),d=i(),[m,x]=u.useState(!1),f=u.useRef(n.stepIndex),p=u.useRef(null);u.useEffect(()=>{f.current!==n.stepIndex&&(x(!1),f.current=n.stepIndex)},[n.stepIndex]),u.useEffect(()=>{if(!n.isRunning||d.length===0){x(!1);return}const j=d[n.stepIndex];if(!j){x(!1);return}const w=j.target;if(w==="body"){x(!0);return}x(!1);const y=setTimeout(()=>{const T=()=>{const U=document.querySelector(w);if(U){const I=U.getBoundingClientRect();if(I.width>0&&I.height>0)return!0}return!1};if(T()){setTimeout(()=>x(!0),100);return}const _=setInterval(()=>{T()&&(clearInterval(_),setTimeout(()=>x(!0),100))},100),L=setTimeout(()=>{clearInterval(_),x(!0)},5e3),D=()=>{clearInterval(_),clearTimeout(L)};p.current=D},150);return()=>{clearTimeout(y),p.current&&(p.current(),p.current=null)}},[n.isRunning,n.stepIndex,d]);const g=u.useRef(null);if(u.useEffect(()=>{let j=document.getElementById("tour-portal-container");return j||(j=document.createElement("div"),j.id="tour-portal-container",j.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(j)),g.current=j,()=>{}},[]),!n.isRunning||d.length===0||!m)return null;const N=e.jsx(Ly,{steps:d,stepIndex:n.stepIndex,run:n.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:r,styles:Xw,locale:Kw,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${n.stepIndex}`);return g.current?Hb.createPortal(N,g.current):N}const Da="model-assignment-tour",Qg=[{target:"body",content:"本引导旨在帮助你配置模型提供商和对应的模型,并为麦麦的各个组件分配合适的模型。",placement:"center",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="sidebar-model-provider"]',content:'第一步,你需要配置模型提供商。模型提供商决定了你要使用谁家的模型,无论是单一厂商(如 DeepSeek),还是模型平台(如 Siliconflow),都可以在这里进行配置。点击"下一步"进入配置页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-provider-button"]',content:'点击"添加提供商"按钮,开始配置你的模型提供商。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="provider-dialog"]',content:"在这里,你可以选择你想要配置的模型提供商,填写相关信息后保存即可。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-name-input"]',content:"这里的名称是你为这个模型提供商起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-apikey-input"]',content:"这里需要填写你从模型提供商那里获取的 API 密钥,用于验证和调用模型服务。对于不同的提供商,获取 API 密钥的方式可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-url-input"]',content:"这里需要填写模型提供商的 API 访问地址,确保填写正确以便系统能够连接到模型服务。对于不同的提供商,API 地址可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-template-select"]',content:"当然,如果你不知道如何填写这些信息,很多模型提供商在这里都提供了预设的模板供你选择,选择对应的模板后,相关信息会自动填充。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-save-button"]',content:"填写完所有信息后,点击保存按钮,模型提供商就配置完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-cancel-button"]',content:"因为这次咱们什么都没有填写,所以点击取消按钮退出吧。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="sidebar-model-management"]',content:'配置好模型提供商后,接下来我们需要为麦麦添加模型并分配功能。点击"下一步"进入模型管理页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-model-button"]',content:'在为麦麦的组件分配模型之前,首先需要添加你想要分配的模型,点击"添加模型"按钮开始添加。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="model-dialog"]',content:"在这里,你可以选择你之前配置好的模型提供商,然后选择对应的模型来添加。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-name-input"]',content:"这里的模型名称是你为这个模型起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-provider-select"]',content:"在这里选择你之前配置好的模型提供商,这样系统才能知道你要添加哪个提供商的模型。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-identifier-input"]',content:"这里需要填写你想要添加的模型的标识符,不同的模型提供商可能有不同的标识符格式,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-save-button"]',content:"填写完所有信息后,点击保存按钮,模型就添加完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-cancel-button"]',content:"当然,因为这次咱们什么都没有填写,所以直接点击取消按钮退出吧,等你准备好了再来添加模型。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="tasks-tab-trigger"]',content:'最后一步,添加好模型后,切换到"为模型分配功能"标签页,为麦麦的各个组件分配合适的模型。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="task-model-select"]',content:"在这里,你可以为每个组件选择一个或多个合适的模型,选择完成后配置会自动保存。恭喜你完成了模型配置的学习!",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1}],Ig={0:"/config/model",1:"/config/model",2:"/config/modelProvider",3:"/config/modelProvider",4:"/config/modelProvider",5:"/config/modelProvider",6:"/config/modelProvider",7:"/config/modelProvider",8:"/config/modelProvider",9:"/config/modelProvider",10:"/config/modelProvider",11:"/config/model",12:"/config/model",13:"/config/model",14:"/config/model",15:"/config/model",16:"/config/model",17:"/config/model",18:"/config/model",19:"/config/model"},nr=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini",modelFetcher:{endpoint:"/models",parser:"gemini"}},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function gp(n){return n?n.replace(/\/+$/,"").toLowerCase():""}function Pw(n){if(!n)return null;const i=gp(n);return nr.find(r=>r.id!=="custom"&&gp(r.base_url)===i)||null}function Zw(){const[n,i]=u.useState([]),[r,d]=u.useState(!0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!1),[j,w]=u.useState(!1),[y,T]=u.useState(!1),[_,L]=u.useState(!1),[D,U]=u.useState(null),[I,R]=u.useState(null),[z,Y]=u.useState("custom"),[Q,E]=u.useState(!1),[M,te]=u.useState(!1),[fe,je]=u.useState(null),[ve,ge]=u.useState(!1),[be,Se]=u.useState(""),[O,F]=u.useState(new Set),[q,se]=u.useState(!1),[v,K]=u.useState(1),[me,oe]=u.useState(20),[xe,ye]=u.useState(""),[de,W]=u.useState({}),[ae,$]=u.useState(new Set),[Z,ke]=u.useState(new Map),{toast:He}=Rs(),pe=ga(),{state:Te,goToStep:Qs,registerTour:vt}=sm(),ie=u.useRef(null),qe=u.useRef(!0);u.useEffect(()=>{vt(Da,Qg)},[vt]),u.useEffect(()=>{if(Te.activeTourId===Da&&Te.isRunning){const S=Ig[Te.stepIndex];S&&!window.location.pathname.endsWith(S.replace("/config/",""))&&pe({to:S})}},[Te.stepIndex,Te.activeTourId,Te.isRunning,pe]);const gs=u.useRef(Te.stepIndex);u.useEffect(()=>{if(Te.activeTourId===Da&&Te.isRunning){const S=gs.current,H=Te.stepIndex;S>=3&&S<=9&&H<3&&L(!1),S>=10&&H>=3&&H<=9&&(W({}),Y("custom"),U({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),R(null),ge(!1),L(!0)),gs.current=H}},[Te.stepIndex,Te.activeTourId,Te.isRunning]),u.useEffect(()=>{if(Te.activeTourId!==Da||!Te.isRunning)return;const S=H=>{const we=H.target,Ss=Te.stepIndex;Ss===2&&we.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Qs(3),300):Ss===9&&we.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>Qs(10),300)};return document.addEventListener("click",S,!0),()=>document.removeEventListener("click",S,!0)},[Te,Qs]),u.useEffect(()=>{Ys()},[]);const Ys=async()=>{try{d(!0);const S=await Wn();i(S.api_providers||[]),N(!1),qe.current=!1}catch(S){console.error("加载配置失败:",S)}finally{d(!1)}},Ls=async()=>{try{w(!0),so().catch(()=>{}),T(!0)}catch(S){console.error("重启失败:",S),T(!1),He({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),w(!1)}},ft=async()=>{try{x(!0),ie.current&&clearTimeout(ie.current);const S=await Wn();S.api_providers=n,await Pc(S),N(!1),He({title:"保存成功",description:"正在重启麦麦..."}),await Ls()}catch(S){console.error("保存配置失败:",S),He({title:"保存失败",description:S.message,variant:"destructive"}),x(!1)}},ps=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Us=()=>{T(!1),w(!1),He({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},ja=u.useCallback(async S=>{if(!qe.current)try{p(!0),await Fu("api_providers",S),N(!1)}catch(H){console.error("自动保存失败:",H),N(!0)}finally{p(!1)}},[]);u.useEffect(()=>{if(!qe.current)return N(!0),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{ja(n)},2e3),()=>{ie.current&&clearTimeout(ie.current)}},[n,ja]);const va=async()=>{try{x(!0),ie.current&&clearTimeout(ie.current);const S=await Wn();S.api_providers=n,await Pc(S),N(!1),He({title:"保存成功",description:"模型提供商配置已保存"})}catch(S){console.error("保存配置失败:",S),He({title:"保存失败",description:S.message,variant:"destructive"})}finally{x(!1)}},X=(S,H)=>{if(W({}),S){const we=nr.find(Ss=>Ss.base_url===S.base_url&&Ss.client_type===S.client_type);Y(we?.id||"custom"),U(S)}else Y("custom"),U({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});R(H),ge(!1),L(!0)},Ue=S=>{Y(S),E(!1);const H=nr.find(we=>we.id===S);H&&H.id!=="custom"?U(we=>({...we,name:H.name,base_url:H.base_url,client_type:H.client_type})):H?.id==="custom"&&U(we=>({...we,name:"",base_url:"",client_type:"openai"}))},Ee=u.useMemo(()=>z!=="custom",[z]),Qe=async()=>{if(D?.api_key)try{await navigator.clipboard.writeText(D.api_key),He({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{He({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},qs=()=>{if(!D)return;const S={};if(D.name?.trim()||(S.name="请输入提供商名称"),D.base_url?.trim()||(S.base_url="请输入基础 URL"),D.api_key?.trim()||(S.api_key="请输入 API Key"),Object.keys(S).length>0){W(S);return}W({});const H={...D,max_retry:D.max_retry??2,timeout:D.timeout??30,retry_interval:D.retry_interval??10};if(I!==null){const we=[...n];we[I]=H,i(we)}else i([...n,H]);L(!1),U(null),R(null)},Ne=S=>{if(!S&&D){const H={...D,max_retry:D.max_retry??2,timeout:D.timeout??30,retry_interval:D.retry_interval??10};U(H)}L(S)},bs=S=>{je(S),te(!0)},Ie=()=>{if(fe!==null){const S=n.filter((H,we)=>we!==fe);i(S),He({title:"删除成功",description:"提供商已从列表中移除"})}te(!1),je(null)},Ps=S=>{const H=new Set(O);H.has(S)?H.delete(S):H.add(S),F(H)},Me=()=>{if(O.size===Bs.length)F(new Set);else{const S=Bs.map((H,we)=>n.findIndex(Ss=>Ss===Bs[we]));F(new Set(S))}},Gs=()=>{if(O.size===0){He({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}se(!0)},ot=()=>{const S=n.filter((H,we)=>!O.has(we));i(S),F(new Set),se(!1),He({title:"批量删除成功",description:`已删除 ${O.size} 个提供商`})},Bs=n.filter(S=>{if(!be)return!0;const H=be.toLowerCase();return S.name.toLowerCase().includes(H)||S.base_url.toLowerCase().includes(H)||S.client_type.toLowerCase().includes(H)}),Ze=Math.ceil(Bs.length/me),Fs=Bs.slice((v-1)*me,v*me),Yt=()=>{const S=parseInt(xe);S>=1&&S<=Ze&&(K(S),ye(""))},Et=async S=>{$(H=>new Set(H).add(S));try{const H=await Ow(S);ke(we=>new Map(we).set(S,H)),H.network_ok?H.api_key_valid===!0?He({title:"连接正常",description:`${S} 网络连接正常,API Key 有效 (${H.latency_ms}ms)`}):H.api_key_valid===!1?He({title:"连接正常但 Key 无效",description:`${S} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):He({title:"网络连接正常",description:`${S} 可以访问 (${H.latency_ms}ms)`}):He({title:"连接失败",description:H.error||"无法连接到提供商",variant:"destructive"})}catch(H){He({title:"测试失败",description:H.message,variant:"destructive"})}finally{$(H=>{const we=new Set(H);return we.delete(S),we})}},ol=async()=>{for(const S of n)await Et(S.name)},ba=S=>{const H=ae.has(S),we=Z.get(S);return H?e.jsxs(Fe,{variant:"secondary",className:"gap-1",children:[e.jsx(Ks,{className:"h-3 w-3 animate-spin"}),"测试中"]}):we?we.network_ok?we.api_key_valid===!0?e.jsxs(Fe,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(ta,{className:"h-3 w-3"}),"正常"]}):we.api_key_valid===!1?e.jsxs(Fe,{variant:"destructive",className:"gap-1",children:[e.jsx(zt,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(Fe,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(ta,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(Fe,{variant:"destructive",className:"gap-1",children:[e.jsx(pg,{className:"h-3 w-3"}),"离线"]}):null};return r?e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[O.size>0&&e.jsxs(C,{onClick:Gs,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(Je,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",O.size,")"]}),e.jsxs(C,{onClick:ol,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:n.length===0||ae.size>0,children:[e.jsx(tn,{className:"mr-2 h-4 w-4"}),ae.size>0?`测试中 (${ae.size})`:"测试全部"]}),e.jsxs(C,{onClick:()=>X(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(rt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(C,{onClick:va,disabled:m||f||!g||j,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(jr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":f?"自动保存中...":g?"保存配置":"已保存"]}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsxs(C,{disabled:m||f||j,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(gr,{className:"mr-2 h-4 w-4"}),j?"重启中...":g?"保存并重启":"重启麦麦"]})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认重启麦麦?"}),e.jsx(is,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:g?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:g?ft:Ls,children:g?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs($t,{children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsxs(Qt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(Ke,{className:"h-[calc(100vh-260px)]",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索提供商名称、URL 或类型...",value:be,onChange:S=>Se(S.target.value),className:"pl-9"})]}),be&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Bs.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:Bs.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:be?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):Fs.map((S,H)=>{const we=n.findIndex(Ss=>Ss===S);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:S.name}),ba(S.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:S.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Et(S.name),disabled:ae.has(S.name),title:"测试连接",children:ae.has(S.name)?e.jsx(Ks,{className:"h-4 w-4 animate-spin"}):e.jsx(tn,{className:"h-4 w-4"})}),e.jsx(C,{variant:"default",size:"sm",onClick:()=>X(S,we),children:e.jsx(ln,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(C,{size:"sm",onClick:()=>bs(we),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(Je,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),e.jsx("p",{className:"font-medium",children:S.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:S.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:S.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:S.retry_interval})]})]})]},H)})}),e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ct,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(ht,{checked:O.size===Bs.length&&Bs.length>0,onCheckedChange:Me})}),e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"基础URL"}),e.jsx(Ye,{children:"客户端类型"}),e.jsx(Ye,{className:"text-right",children:"最大重试"}),e.jsx(Ye,{className:"text-right",children:"超时(秒)"}),e.jsx(Ye,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:Fs.length===0?e.jsx(ct,{children:e.jsx(Ge,{colSpan:9,className:"text-center text-muted-foreground py-8",children:be?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):Fs.map((S,H)=>{const we=n.findIndex(Ss=>Ss===S);return e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(ht,{checked:O.has(we),onCheckedChange:()=>Ps(we)})}),e.jsx(Ge,{children:ba(S.name)||e.jsx(Fe,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Ge,{className:"font-medium",children:S.name}),e.jsx(Ge,{className:"max-w-xs truncate",title:S.base_url,children:S.base_url}),e.jsx(Ge,{children:S.client_type}),e.jsx(Ge,{className:"text-right",children:S.max_retry}),e.jsx(Ge,{className:"text-right",children:S.timeout}),e.jsx(Ge,{className:"text-right",children:S.retry_interval}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Et(S.name),disabled:ae.has(S.name),title:"测试连接",children:ae.has(S.name)?e.jsx(Ks,{className:"h-4 w-4 animate-spin"}):e.jsx(tn,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"default",size:"sm",onClick:()=>X(S,we),children:[e.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(C,{size:"sm",onClick:()=>bs(we),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(Je,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},H)})})]})})}),Bs.length>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Oe,{value:me.toString(),onValueChange:S=>{oe(parseInt(S)),K(1),F(new Set)},children:[e.jsx(Ae,{id:"page-size-provider",className:"w-20",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"10",children:"10"}),e.jsx(ne,{value:"20",children:"20"}),e.jsx(ne,{value:"50",children:"50"}),e.jsx(ne,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(v-1)*me+1," 到"," ",Math.min(v*me,Bs.length)," 条,共 ",Bs.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>K(1),disabled:v===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>K(S=>Math.max(1,S-1)),disabled:v===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:xe,onChange:S=>ye(S.target.value),onKeyDown:S=>S.key==="Enter"&&Yt(),placeholder:v.toString(),className:"w-16 h-8 text-center",min:1,max:Ze}),e.jsx(C,{variant:"outline",size:"sm",onClick:Yt,disabled:!xe,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>K(S=>S+1),disabled:v>=Ze,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>K(Ze),disabled:v>=Ze,className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})]}),e.jsx(Hs,{open:_,onOpenChange:Ne,children:e.jsxs(As,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:Te.isRunning,children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:I!==null?"编辑提供商":"添加提供商"}),e.jsx(Js,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:S=>{S.preventDefault(),qs()},autoComplete:"off",children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[e.jsx(k,{htmlFor:"template",children:"提供商模板"}),e.jsxs(La,{open:Q,onOpenChange:E,children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(C,{variant:"outline",role:"combobox","aria-expanded":Q,className:"w-full justify-between",children:[z?nr.find(S=>S.id===z)?.display_name:"选择提供商模板...",e.jsx(Ku,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ta,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(to,{children:[e.jsx(ao,{placeholder:"搜索提供商模板..."}),e.jsx(Ke,{className:"h-[300px]",children:e.jsxs(lo,{className:"max-h-none overflow-visible",children:[e.jsx(no,{children:"未找到匹配的模板"}),e.jsx(fr,{children:nr.map(S=>e.jsxs(pr,{value:S.display_name,onSelect:()=>Ue(S.id),children:[e.jsx(Vt,{className:`mr-2 h-4 w-4 ${z===S.id?"opacity-100":"opacity-0"}`}),S.display_name]},S.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsx(k,{htmlFor:"name",className:de.name?"text-destructive":"",children:"名称 *"}),e.jsx(re,{id:"name",value:D?.name||"",onChange:S=>{U(H=>H?{...H,name:S.target.value}:null),de.name&&W(H=>({...H,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:de.name?"border-destructive focus-visible:ring-destructive":""}),de.name&&e.jsx("p",{className:"text-xs text-destructive",children:de.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(k,{htmlFor:"base_url",className:de.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(re,{id:"base_url",value:D?.base_url||"",onChange:S=>{U(H=>H?{...H,base_url:S.target.value}:null),de.base_url&&W(H=>({...H,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:Ee,className:`${Ee?"bg-muted cursor-not-allowed":""} ${de.base_url?"border-destructive focus-visible:ring-destructive":""}`}),de.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:de.base_url}),Ee&&!de.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsx(k,{htmlFor:"api_key",className:de.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{id:"api_key",type:ve?"text":"password",value:D?.api_key||"",onChange:S=>{U(H=>H?{...H,api_key:S.target.value}:null),de.api_key&&W(H=>({...H,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${de.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(C,{type:"button",variant:"outline",size:"icon",onClick:()=>ge(!ve),title:ve?"隐藏密钥":"显示密钥",children:ve?e.jsx(dr,{className:"h-4 w-4"}):e.jsx(Ot,{className:"h-4 w-4"})}),e.jsx(C,{type:"button",variant:"outline",size:"icon",onClick:Qe,title:"复制密钥",children:e.jsx(Yc,{className:"h-4 w-4"})})]}),de.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:de.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Oe,{value:D?.client_type||"openai",onValueChange:S=>U(H=>H?{...H,client_type:S}:null),disabled:Ee,children:[e.jsx(Ae,{id:"client_type",className:Ee?"bg-muted cursor-not-allowed":"",children:e.jsx(Re,{placeholder:"选择客户端类型"})}),e.jsxs(De,{children:[e.jsx(ne,{value:"openai",children:"OpenAI"}),e.jsx(ne,{value:"gemini",children:"Gemini"})]})]}),Ee&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(re,{id:"max_retry",type:"number",min:"0",value:D?.max_retry??"",onChange:S=>{const H=S.target.value===""?null:parseInt(S.target.value);U(we=>we?{...we,max_retry:H}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(re,{id:"timeout",type:"number",min:"1",value:D?.timeout??"",onChange:S=>{const H=S.target.value===""?null:parseInt(S.target.value);U(we=>we?{...we,timeout:H}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(re,{id:"retry_interval",type:"number",min:"1",value:D?.retry_interval??"",onChange:S=>{const H=S.target.value===""?null:parseInt(S.target.value);U(we=>we?{...we,retry_interval:H}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(at,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:()=>L(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(C,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(us,{open:M,onOpenChange:te,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:['确定要删除提供商 "',fe!==null?n[fe]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:Ie,children:"删除"})]})]})}),e.jsx(us,{open:q,onOpenChange:se,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认批量删除"}),e.jsxs(is,{children:["确定要删除选中的 ",O.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:ot,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),y&&e.jsx(em,{onRestartComplete:ps,onRestartFailed:Us})]})}function Yg(n){return typeof n=="boolean"?"boolean":typeof n=="number"?"number":"string"}function Ww(n,i){switch(i){case"boolean":return n==="true";case"number":{const r=parseFloat(n);return isNaN(r)?0:r}default:return n}}function Mu(n){return Object.entries(n).map(([i,r])=>({id:crypto.randomUUID(),key:i,value:r,type:Yg(r)}))}function Au(n){const i={};for(const r of n)r.key.trim()&&(i[r.key.trim()]=r.value);return i}function Du(n){if(!n.trim())return{valid:!0,parsed:{}};try{const i=JSON.parse(n);if(typeof i!="object"||i===null||Array.isArray(i))return{valid:!1,error:"必须是一个 JSON 对象 {}"};for(const[r,d]of Object.entries(i))if(d!==null&&!["string","number","boolean"].includes(typeof d))return{valid:!1,error:`键 "${r}" 的值类型不支持(仅支持 string/number/boolean)`};return{valid:!0,parsed:i}}catch{return{valid:!1,error:"JSON 格式错误"}}}function e1(n){switch(n){case"boolean":return"布尔";case"number":return"数字";default:return"字符串"}}function s1(n){switch(n){case"boolean":return"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400";case"number":return"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"}}function t1({value:n,onChange:i,className:r,placeholder:d="添加额外参数..."}){const[m,x]=u.useState("list"),[f,p]=u.useState(()=>Mu(n||{})),[g,N]=u.useState(()=>Object.keys(n||{}).length>0?JSON.stringify(n,null,2):""),[j,w]=u.useState(null);u.useEffect(()=>{const I=Mu(n||{});p(I),N(Object.keys(n||{}).length>0?JSON.stringify(n,null,2):"")},[n]);const y=u.useMemo(()=>{const I=Du(g);return I.valid&&I.parsed?{success:!0,data:I.parsed}:{success:!1,data:{}}},[g]),T=u.useCallback(I=>{const R=I;if(R==="json"&&m==="list"){const z=Au(f);N(Object.keys(z).length>0?JSON.stringify(z,null,2):""),w(null)}else if(R==="list"&&m==="json"){const z=Du(g);z.valid&&z.parsed&&(p(Mu(z.parsed)),w(null))}x(R)},[m,f,g]),_=u.useCallback(()=>{const I={id:crypto.randomUUID(),key:"",value:"",type:"string"},R=[...f,I];p(R)},[f]),L=u.useCallback(I=>{const R=f.filter(z=>z.id!==I);p(R),i(Au(R))},[f,i]),D=u.useCallback((I,R,z)=>{const Y=f.map(Q=>{if(Q.id!==I)return Q;if(R==="type"){const E=z;let M;return E==="boolean"?M=Q.value==="true"||Q.value===!0:E==="number"?M=typeof Q.value=="number"?Q.value:parseFloat(String(Q.value))||0:M=String(Q.value),{...Q,type:E,value:M}}else return R==="value"?{...Q,value:Ww(z,Q.type)}:{...Q,[R]:z}});p(Y),i(Au(Y))},[f,i]),U=u.useCallback(I=>{N(I);const R=Du(I);R.valid&&R.parsed?(w(null),i(R.parsed)):w(R.error||"JSON 格式错误")},[i]);return e.jsxs("div",{className:G("space-y-3",r),children:[e.jsx(k,{className:"text-sm font-medium",children:"额外参数"}),e.jsxs(ka,{value:m,onValueChange:T,className:"w-full",children:[e.jsxs(fa,{className:"h-8 p-0.5 bg-muted/60",children:[e.jsx(ss,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"键值对"}),e.jsx(ss,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON"})]}),e.jsxs(ys,{value:"list",className:"mt-3 space-y-2",children:[f.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:d}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 text-xs text-muted-foreground px-1",children:[e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),f.map(I=>e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 items-center",children:[e.jsx(re,{value:I.key,onChange:R=>D(I.id,"key",R.target.value),placeholder:"key",className:"h-8 text-sm"}),I.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Be,{checked:I.value===!0,onCheckedChange:R=>D(I.id,"value",String(R))}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:I.value?"true":"false"})]}):e.jsx(re,{type:I.type==="number"?"number":"text",value:I.value,onChange:R=>D(I.id,"value",R.target.value),placeholder:"value",className:"h-8 text-sm",step:I.type==="number"?"any":void 0}),e.jsxs(Oe,{value:I.type,onValueChange:R=>D(I.id,"type",R),children:[e.jsx(Ae,{className:"h-8 text-xs",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"string",children:"字符串"}),e.jsx(ne,{value:"number",children:"数字"}),e.jsx(ne,{value:"boolean",children:"布尔"})]})]}),e.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>L(I.id),children:e.jsx(Je,{className:"h-4 w-4"})})]},I.id))]}),e.jsxs(C,{type:"button",variant:"outline",size:"sm",className:"w-full h-8",onClick:_,children:[e.jsx(rt,{className:"h-4 w-4 mr-1"}),"添加参数"]})]}),e.jsx(ys,{value:"json",className:"mt-3",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),j?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(zt,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:j})]}):g.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx(Vt,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(Ms,{value:g,onChange:I=>U(I.target.value),placeholder:`{ - "key": "value" -}`,className:G("font-mono text-sm min-h-[140px] h-[140px] resize-y flex-1",j&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持 string、number、boolean 类型"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"预览"}),e.jsx("div",{className:"min-h-[140px] h-[140px] flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:y.success&&Object.keys(y.data).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(y.data).map(([I,R])=>{const z=Yg(R);return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("code",{className:"px-1.5 py-0.5 bg-background rounded text-xs font-medium",children:I}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:G("font-mono",z==="boolean"&&(R?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),z==="number"&&"text-blue-600 dark:text-blue-400",z==="string"&&"text-amber-600 dark:text-amber-400"),children:z==="string"?`"${R}"`:String(R)}),e.jsx(Fe,{variant:"secondary",className:G("h-5 text-[10px] px-1.5",s1(z)),children:e1(z)})]},I)})}):y.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"暂无参数"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON 格式错误"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"实时预览解析结果"})]})]})})]})]})}function a1({value:n,label:i,onRemove:r}){const{attributes:d,listeners:m,setNodeRef:x,transform:f,transition:p,isDragging:g}=Yy({id:n}),N={transform:Xy.Transform.toString(f),transition:p,opacity:g?.5:1},j=y=>{y.preventDefault(),y.stopPropagation(),r(n)},w=y=>{y.stopPropagation()};return e.jsx("div",{ref:x,style:N,className:G("inline-flex items-center gap-1",g&&"shadow-lg"),children:e.jsxs(Fe,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...d,...m,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(dy,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:i}),e.jsx("button",{type:"button",className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive",onClick:j,onPointerDown:w,onMouseDown:y=>y.stopPropagation(),children:e.jsx(il,{className:"h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function l1({options:n,selected:i,onChange:r,placeholder:d="选择选项...",emptyText:m="未找到选项",className:x}){const[f,p]=u.useState(!1),g=By(lp(Iy,{activationConstraint:{distance:8}}),lp(Qy,{coordinateGetter:$y})),N=y=>{i.includes(y)?r(i.filter(T=>T!==y)):r([...i,y])},j=y=>{r(i.filter(T=>T!==y))},w=y=>{const{active:T,over:_}=y;if(_&&T.id!==_.id){const L=i.indexOf(T.id),D=i.indexOf(_.id);r(Vy(i,L,D))}};return e.jsxs(La,{open:f,onOpenChange:p,children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(C,{variant:"outline",role:"combobox","aria-expanded":f,className:G("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(Hy,{sensors:g,collisionDetection:qy,onDragEnd:w,children:e.jsx(Gy,{items:i,strategy:Fy,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:i.length===0?e.jsx("span",{className:"text-muted-foreground",children:d}):i.map(y=>{const T=n.find(_=>_.value===y);return e.jsx(a1,{value:y,label:T?.label||y,onRemove:j},y)})})})}),e.jsx(Ku,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(Ta,{className:"w-full p-0",align:"start",children:e.jsxs(to,{children:[e.jsx(ao,{placeholder:"搜索...",className:"h-9"}),e.jsxs(lo,{children:[e.jsx(no,{children:m}),e.jsx(fr,{children:n.map(y=>{const T=i.includes(y.value);return e.jsxs(pr,{value:y.value,onSelect:()=>N(y.value),children:[e.jsx("div",{className:G("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",T?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Vt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:y.label})]},y.value)})})]})]})})]})}const _a=gt.memo(function({title:i,description:r,taskConfig:d,modelNames:m,onChange:x,hideTemperature:f=!1,hideMaxTokens:p=!1,dataTour:g}){const N=j=>{x("model_list",j)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:i}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:r})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":g,children:[e.jsx(k,{children:"模型列表"}),e.jsx(l1,{options:m.map(j=>({label:j,value:j})),selected:d.model_list||[],onChange:N,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!f&&e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{children:"温度"}),e.jsx(re,{type:"number",step:"0.1",min:"0",max:"1",value:d.temperature??.3,onChange:j=>{const w=parseFloat(j.target.value);!isNaN(w)&&w>=0&&w<=1&&x("temperature",w)},className:"w-20 h-8 text-sm"})]}),e.jsx(ha,{value:[d.temperature??.3],onValueChange:j=>x("temperature",j[0]),min:0,max:1,step:.1,className:"w-full"})]}),!p&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"最大 Token"}),e.jsx(re,{type:"number",step:"1",min:"1",value:d.max_tokens??1024,onChange:j=>x("max_tokens",parseInt(j.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(re,{type:"number",step:"1",min:"1",value:d.slow_threshold??15,onChange:j=>{const w=parseInt(j.target.value);!isNaN(w)&&w>=1&&x("slow_threshold",w)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"模型响应时间超过此阈值将输出警告日志"})]})]})]})}),n1=gt.memo(function({paginatedModels:i,allModels:r,onEdit:d,onDelete:m,isModelUsed:x,searchQuery:f}){return i.length===0?e.jsx("div",{className:"md:hidden text-center text-muted-foreground py-8 rounded-lg border bg-card",children:f?"未找到匹配的模型":"暂无模型配置"}):e.jsx("div",{className:"md:hidden space-y-3",children:i.map((p,g)=>{const N=r.findIndex(w=>w===p),j=x(p.name);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-base",children:p.name}),e.jsx(Fe,{variant:j?"default":"secondary",className:j?"bg-green-600 hover:bg-green-700":"",children:j?"已使用":"未使用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground break-all",title:p.model_identifier,children:p.model_identifier})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>d(p,N),children:[e.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(C,{size:"sm",onClick:()=>m(N),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(Je,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),e.jsx("p",{className:"font-medium",children:p.api_provider})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"模型温度"}),e.jsx("p",{className:"font-medium",children:p.temperature!=null?p.temperature:e.jsx("span",{className:"text-muted-foreground",children:"默认"})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),e.jsxs("p",{className:"font-medium",children:["¥",p.price_in,"/M"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),e.jsxs("p",{className:"font-medium",children:["¥",p.price_out,"/M"]})]})]})]},g)})})}),i1=gt.memo(function({paginatedModels:i,allModels:r,filteredModels:d,selectedModels:m,onEdit:x,onDelete:f,onToggleSelection:p,onToggleSelectAll:g,isModelUsed:N,searchQuery:j}){return e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ct,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(ht,{checked:m.size===d.length&&d.length>0,onCheckedChange:g})}),e.jsx(Ye,{className:"w-24",children:"使用状态"}),e.jsx(Ye,{children:"模型名称"}),e.jsx(Ye,{children:"模型标识符"}),e.jsx(Ye,{children:"提供商"}),e.jsx(Ye,{className:"text-center",children:"温度"}),e.jsx(Ye,{className:"text-right",children:"输入价格"}),e.jsx(Ye,{className:"text-right",children:"输出价格"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:i.length===0?e.jsx(ct,{children:e.jsx(Ge,{colSpan:9,className:"text-center text-muted-foreground py-8",children:j?"未找到匹配的模型":"暂无模型配置"})}):i.map((w,y)=>{const T=r.findIndex(L=>L===w),_=N(w.name);return e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(ht,{checked:m.has(T),onCheckedChange:()=>p(T)})}),e.jsx(Ge,{children:e.jsx(Fe,{variant:_?"default":"secondary",className:_?"bg-green-600 hover:bg-green-700":"",children:_?"已使用":"未使用"})}),e.jsx(Ge,{className:"font-medium",children:w.name}),e.jsx(Ge,{className:"max-w-xs truncate",title:w.model_identifier,children:w.model_identifier}),e.jsx(Ge,{children:w.api_provider}),e.jsx(Ge,{className:"text-center",children:w.temperature!=null?w.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ge,{className:"text-right",children:["¥",w.price_in,"/M"]}),e.jsxs(Ge,{className:"text-right",children:["¥",w.price_out,"/M"]}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>x(w,T),children:[e.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(C,{size:"sm",onClick:()=>f(T),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(Je,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},y)})})]})})})}),r1=300*1e3,jp=new Map,c1=[10,20,50,100],o1=gt.memo(function({page:i,pageSize:r,totalItems:d,jumpToPage:m,onPageChange:x,onPageSizeChange:f,onJumpToPageChange:p,onJumpToPage:g,onSelectionClear:N}){const j=Math.ceil(d/r),w=T=>{f(parseInt(T)),x(1),N?.()},y=T=>{T.key==="Enter"&&g()};return d===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Oe,{value:r.toString(),onValueChange:w,children:[e.jsx(Ae,{id:"page-size-model",className:"w-20",children:e.jsx(Re,{})}),e.jsx(De,{children:c1.map(T=>e.jsx(ne,{value:T.toString(),children:T},T))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(i-1)*r+1," 到"," ",Math.min(i*r,d)," 条,共 ",d," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:i===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,i-1)),disabled:i===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:m,onChange:T=>p(T.target.value),onKeyDown:y,placeholder:i.toString(),className:"w-16 h-8 text-center",min:1,max:j}),e.jsx(C,{variant:"outline",size:"sm",onClick:g,disabled:!m,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>x(i+1),disabled:i>=j,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>x(j),disabled:i>=j,className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})});function d1(n){const{models:i,taskConfig:r,debounceMs:d=2e3,onSavingChange:m,onUnsavedChange:x}=n,f=u.useRef(null),p=u.useRef(null),g=u.useRef(!0),N=u.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null),p.current&&(clearTimeout(p.current),p.current=null)},[]),j=u.useCallback(T=>{const _={model_identifier:T.model_identifier,name:T.name,api_provider:T.api_provider,price_in:T.price_in??0,price_out:T.price_out??0,force_stream_mode:T.force_stream_mode??!1,extra_params:T.extra_params??{}};return T.temperature!=null&&(_.temperature=T.temperature),T.max_tokens!=null&&(_.max_tokens=T.max_tokens),_},[]),w=u.useCallback(async T=>{try{m?.(!0);const _=T.map(j);await Fu("models",_),x?.(!1)}catch(_){console.error("自动保存模型列表失败:",_),x?.(!0)}finally{m?.(!1)}},[m,x,j]),y=u.useCallback(async T=>{try{m?.(!0),await Fu("model_task_config",T),x?.(!1)}catch(_){console.error("自动保存任务配置失败:",_),x?.(!0)}finally{m?.(!1)}},[m,x]);return u.useEffect(()=>{if(!g.current)return x?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{w(i)},d),()=>{f.current&&clearTimeout(f.current)}},[i,w,d,x]),u.useEffect(()=>{if(!(g.current||!r))return x?.(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{y(r)},d),()=>{p.current&&clearTimeout(p.current)}},[r,y,d,x]),u.useEffect(()=>()=>{N()},[N]),{clearTimers:N,initialLoadRef:g}}function u1(n={}){const{onCloseEditDialog:i}=n,r=ga(),{registerTour:d,startTour:m,state:x,goToStep:f}=sm(),p=u.useRef(x.stepIndex);return u.useEffect(()=>{d(Da,Qg)},[d]),u.useEffect(()=>{if(x.activeTourId===Da&&x.isRunning){const N=Ig[x.stepIndex];N&&!window.location.pathname.endsWith(N.replace("/config/",""))&&r({to:N})}},[x.stepIndex,x.activeTourId,x.isRunning,r]),u.useEffect(()=>{if(x.activeTourId===Da&&x.isRunning){const N=p.current,j=x.stepIndex;N>=12&&N<=17&&j<12&&i?.(),p.current=j}},[x.stepIndex,x.activeTourId,x.isRunning,i]),u.useEffect(()=>{if(x.activeTourId!==Da||!x.isRunning)return;const N=j=>{const w=j.target,y=x.stepIndex;y===2&&w.closest('[data-tour="add-provider-button"]')?setTimeout(()=>f(3),300):y===9&&w.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>f(10),300):y===11&&w.closest('[data-tour="add-model-button"]')?setTimeout(()=>f(12),300):y===17&&w.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>f(18),300):y===18&&w.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>f(19),300)};return document.addEventListener("click",N,!0),()=>document.removeEventListener("click",N,!0)},[x,f]),{startTour:u.useCallback(()=>{m(Da)},[m]),isRunning:x.isRunning&&x.activeTourId===Da,stepIndex:x.stepIndex}}function m1(n){const{getProviderConfig:i}=n,[r,d]=u.useState([]),[m,x]=u.useState(!1),[f,p]=u.useState(null),[g,N]=u.useState(null),j=u.useCallback(()=>{d([]),p(null),N(null)},[]),w=u.useCallback(async(y,T=!1)=>{const _=i(y);if(!_?.base_url){d([]),N(null),p('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!_.api_key){d([]),N(null),p('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const L=Pw(_.base_url);if(N(L),!L?.modelFetcher){d([]),p(null);return}const D=`${y}:${_.base_url}`,U=jp.get(D);if(!T&&U&&Date.now()-U.timestampE(!1)}),{clearTimers:Qs,initialLoadRef:vt}=d1({models:n,taskConfig:g,onSavingChange:L,onUnsavedChange:U}),ie=u.useCallback(async()=>{try{w(!0);const S=await Wn(),H=S.models||[];i(H),p(H.map(Ss=>Ss.name));const we=S.api_providers||[];d(we.map(Ss=>Ss.name)),x(we),N(S.model_task_config||null),U(!1),vt.current=!1}catch(S){console.error("加载配置失败:",S)}finally{w(!1)}},[vt]);u.useEffect(()=>{ie()},[ie]);const qe=u.useCallback(S=>m.find(H=>H.name===S),[m]),{availableModels:gs,fetchingModels:Ys,modelFetchError:Ls,matchedTemplate:ft,fetchModelsForProvider:ps,clearModels:Us}=m1({getProviderConfig:qe});u.useEffect(()=>{Q&&M?.api_provider&&ps(M.api_provider)},[Q,M?.api_provider,ps]);const ja=async()=>{try{R(!0),so().catch(()=>{}),Y(!0)}catch(S){console.error("重启失败:",S),Y(!1),He({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),R(!1)}},va=S=>{const H={model_identifier:S.model_identifier,name:S.name,api_provider:S.api_provider,price_in:S.price_in??0,price_out:S.price_out??0,force_stream_mode:S.force_stream_mode??!1,extra_params:S.extra_params??{}};return S.temperature!=null&&(H.temperature=S.temperature),S.max_tokens!=null&&(H.max_tokens=S.max_tokens),H},X=async()=>{try{T(!0),Qs();const S=await Wn();S.models=n.map(va),S.model_task_config=g,await Pc(S),U(!1),He({title:"保存成功",description:"正在重启麦麦..."}),await ja()}catch(S){console.error("保存配置失败:",S),He({title:"保存失败",description:S.message,variant:"destructive"}),T(!1)}},Ue=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ee=()=>{Y(!1),R(!1),He({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Qe=async()=>{try{T(!0),Qs();const S=await Wn();S.models=n.map(va),S.model_task_config=g,await Pc(S),U(!1),He({title:"保存成功",description:"模型配置已保存"}),await ie()}catch(S){console.error("保存配置失败:",S),He({title:"保存失败",description:S.message,variant:"destructive"})}finally{T(!1)}},qs=(S,H)=>{ke({}),te(S||{model_identifier:"",name:"",api_provider:r[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),je(H),E(!0)},Ne=()=>{if(!M)return;const S={};if(M.name?.trim()||(S.name="请输入模型名称"),M.api_provider?.trim()||(S.api_provider="请选择 API 提供商"),M.model_identifier?.trim()||(S.model_identifier="请输入模型标识符"),Object.keys(S).length>0){ke(S);return}ke({});const H={model_identifier:M.model_identifier,name:M.name,api_provider:M.api_provider,price_in:M.price_in??0,price_out:M.price_out??0,force_stream_mode:M.force_stream_mode??!1,extra_params:M.extra_params??{}};M.temperature!=null&&(H.temperature=M.temperature),M.max_tokens!=null&&(H.max_tokens=M.max_tokens);let we,Ss=null;if(fe!==null?(Ss=n[fe].name,we=[...n],we[fe]=H):we=[...n,H],i(we),p(we.map(At=>At.name)),Ss&&Ss!==H.name&&g){const At=Nr=>Nr.map(ci=>ci===Ss?H.name:ci);N({...g,utils:{...g.utils,model_list:At(g.utils?.model_list||[])},utils_small:{...g.utils_small,model_list:At(g.utils_small?.model_list||[])},tool_use:{...g.tool_use,model_list:At(g.tool_use?.model_list||[])},replyer:{...g.replyer,model_list:At(g.replyer?.model_list||[])},planner:{...g.planner,model_list:At(g.planner?.model_list||[])},vlm:{...g.vlm,model_list:At(g.vlm?.model_list||[])},voice:{...g.voice,model_list:At(g.voice?.model_list||[])},embedding:{...g.embedding,model_list:At(g.embedding?.model_list||[])},lpmm_entity_extract:{...g.lpmm_entity_extract,model_list:At(g.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...g.lpmm_rdf_build,model_list:At(g.lpmm_rdf_build?.model_list||[])},lpmm_qa:{...g.lpmm_qa,model_list:At(g.lpmm_qa?.model_list||[])}})}E(!1),te(null),je(null)},bs=S=>{if(!S&&M){const H={...M,price_in:M.price_in??0,price_out:M.price_out??0};te(H)}E(S)},Ie=S=>{Se(S),ge(!0)},Ps=()=>{if(be!==null){const S=n.filter((H,we)=>we!==be);i(S),p(S.map(H=>H.name)),He({title:"删除成功",description:"模型已从列表中移除"})}ge(!1),Se(null)},Me=S=>{const H=new Set(q);H.has(S)?H.delete(S):H.add(S),se(H)},Gs=()=>{if(q.size===Fs.length)se(new Set);else{const S=Fs.map((H,we)=>n.findIndex(Ss=>Ss===Fs[we]));se(new Set(S))}},ot=()=>{if(q.size===0){He({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}K(!0)},Bs=()=>{const S=n.filter((H,we)=>!q.has(we));i(S),p(S.map(H=>H.name)),se(new Set),K(!1),He({title:"批量删除成功",description:`已删除 ${q.size} 个模型`})},Ze=(S,H,we)=>{g&&N({...g,[S]:{...g[S],[H]:we}})},Fs=n.filter(S=>{if(!O)return!0;const H=O.toLowerCase();return S.name.toLowerCase().includes(H)||S.model_identifier.toLowerCase().includes(H)||S.api_provider.toLowerCase().includes(H)}),Yt=Math.ceil(Fs.length/xe),Et=Fs.slice((me-1)*xe,me*xe),ol=()=>{const S=parseInt(de);S>=1&&S<=Yt&&(oe(S),W(""))},ba=S=>g?[g.utils?.model_list||[],g.utils_small?.model_list||[],g.tool_use?.model_list||[],g.replyer?.model_list||[],g.planner?.model_list||[],g.vlm?.model_list||[],g.voice?.model_list||[],g.embedding?.model_list||[],g.lpmm_entity_extract?.model_list||[],g.lpmm_rdf_build?.model_list||[],g.lpmm_qa?.model_list||[]].some(we=>we.includes(S)):!1;return j?e.jsx(Ke,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ke,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsxs(C,{onClick:Qe,disabled:y||_||!D||I,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(jr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),y?"保存中...":_?"自动保存中...":D?"保存配置":"已保存"]}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsxs(C,{disabled:y||_||I,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(gr,{className:"mr-2 h-4 w-4"}),I?"重启中...":D?"保存并重启":"重启麦麦"]})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认重启麦麦?"}),e.jsx(is,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:D?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:D?X:ja,children:D?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs($t,{children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsxs(Qt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs($t,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:pe,children:[e.jsx(uy,{className:"h-4 w-4 text-primary"}),e.jsxs(Qt,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),e.jsx(C,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),e.jsxs(ka,{defaultValue:"models",className:"w-full",children:[e.jsxs(fa,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(ss,{value:"models",children:"添加模型"}),e.jsx(ss,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(ys,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[q.size>0&&e.jsxs(C,{onClick:ot,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(Je,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",q.size,")"]}),e.jsxs(C,{onClick:()=>qs(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(rt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索模型名称、标识符或提供商...",value:O,onChange:S=>F(S.target.value),className:"pl-9"})]}),O&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Fs.length," 个结果"]})]}),e.jsx(n1,{paginatedModels:Et,allModels:n,onEdit:qs,onDelete:Ie,isModelUsed:ba,searchQuery:O}),e.jsx(i1,{paginatedModels:Et,allModels:n,filteredModels:Fs,selectedModels:q,onEdit:qs,onDelete:Ie,onToggleSelection:Me,onToggleSelectAll:Gs,isModelUsed:ba,searchQuery:O}),e.jsx(o1,{page:me,pageSize:xe,totalItems:Fs.length,jumpToPage:de,onPageChange:oe,onPageSizeChange:ye,onJumpToPageChange:W,onJumpToPage:ol,onSelectionClear:()=>se(new Set)})]}),e.jsxs(ys,{value:"tasks",className:"space-y-6 mt-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),g&&e.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[e.jsx(_a,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:g.utils,modelNames:f,onChange:(S,H)=>Ze("utils",S,H),dataTour:"task-model-select"}),e.jsx(_a,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:g.utils_small,modelNames:f,onChange:(S,H)=>Ze("utils_small",S,H)}),e.jsx(_a,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:g.tool_use,modelNames:f,onChange:(S,H)=>Ze("tool_use",S,H)}),e.jsx(_a,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:g.replyer,modelNames:f,onChange:(S,H)=>Ze("replyer",S,H)}),e.jsx(_a,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:g.planner,modelNames:f,onChange:(S,H)=>Ze("planner",S,H)}),e.jsx(_a,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:g.vlm,modelNames:f,onChange:(S,H)=>Ze("vlm",S,H),hideTemperature:!0}),e.jsx(_a,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:g.voice,modelNames:f,onChange:(S,H)=>Ze("voice",S,H),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(_a,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:g.embedding,modelNames:f,onChange:(S,H)=>Ze("embedding",S,H),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(_a,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:g.lpmm_entity_extract,modelNames:f,onChange:(S,H)=>Ze("lpmm_entity_extract",S,H)}),e.jsx(_a,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:g.lpmm_rdf_build,modelNames:f,onChange:(S,H)=>Ze("lpmm_rdf_build",S,H)}),e.jsx(_a,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:g.lpmm_qa,modelNames:f,onChange:(S,H)=>Ze("lpmm_qa",S,H)})]})]})]})]}),e.jsx(Hs,{open:Q,onOpenChange:bs,children:e.jsxs(As,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:Te,children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:fe!==null?"编辑模型":"添加模型"}),e.jsx(Js,{children:"配置模型的基本信息和参数"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[e.jsx(k,{htmlFor:"model_name",className:Z.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(re,{id:"model_name",value:M?.name||"",onChange:S=>{te(H=>H?{...H,name:S.target.value}:null),Z.name&&ke(H=>({...H,name:void 0}))},placeholder:"例如: qwen3-30b",className:Z.name?"border-destructive focus-visible:ring-destructive":""}),Z.name?e.jsx("p",{className:"text-xs text-destructive",children:Z.name}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[e.jsx(k,{htmlFor:"api_provider",className:Z.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Oe,{value:M?.api_provider||"",onValueChange:S=>{te(H=>H?{...H,api_provider:S}:null),Us(),Z.api_provider&&ke(H=>({...H,api_provider:void 0}))},children:[e.jsx(Ae,{id:"api_provider",className:Z.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Re,{placeholder:"选择提供商"})}),e.jsx(De,{children:r.map(S=>e.jsx(ne,{value:S,children:S},S))})]}),Z.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:Z.api_provider})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{htmlFor:"model_identifier",className:Z.model_identifier?"text-destructive":"",children:"模型标识符 *"}),ft?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fe,{variant:"secondary",className:"text-xs",children:ft.display_name}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>M?.api_provider&&ps(M.api_provider,!0),disabled:Ys,children:Ys?e.jsx(Ks,{className:"h-3 w-3 animate-spin"}):e.jsx(Tt,{className:"h-3 w-3"})})]})]}),ft?.modelFetcher?e.jsxs(La,{open:ae,onOpenChange:$,children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(C,{variant:"outline",role:"combobox","aria-expanded":ae,className:"w-full justify-between font-normal",disabled:Ys||!!Ls,children:[Ys?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Ks,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):Ls?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):M?.model_identifier?e.jsx("span",{className:"truncate",children:M.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(Ku,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ta,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(to,{children:[e.jsx(ao,{placeholder:"搜索模型..."}),e.jsx(Ke,{className:"h-[300px]",children:e.jsxs(lo,{className:"max-h-none overflow-visible",children:[e.jsx(no,{children:Ls?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:Ls}),!Ls.includes("API Key")&&e.jsx(C,{variant:"link",size:"sm",onClick:()=>M?.api_provider&&ps(M.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(fr,{heading:"可用模型",children:gs.map(S=>e.jsxs(pr,{value:S.id,onSelect:()=>{te(H=>H?{...H,model_identifier:S.id}:null),$(!1)},children:[e.jsx(Vt,{className:`mr-2 h-4 w-4 ${M?.model_identifier===S.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:S.id}),S.name!==S.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:S.name})]})]},S.id))}),e.jsx(fr,{heading:"手动输入",children:e.jsxs(pr,{value:"__manual_input__",onSelect:()=>{$(!1)},children:[e.jsx(ln,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(re,{id:"model_identifier",value:M?.model_identifier||"",onChange:S=>{te(H=>H?{...H,model_identifier:S.target.value}:null),Z.model_identifier&&ke(H=>({...H,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:Z.model_identifier?"border-destructive focus-visible:ring-destructive":""}),Z.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:Z.model_identifier}),Ls&&ft?.modelFetcher&&!Z.model_identifier&&e.jsxs($t,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsx(Qt,{className:"text-xs",children:Ls})]}),ft?.modelFetcher&&e.jsx(re,{value:M?.model_identifier||"",onChange:S=>{te(H=>H?{...H,model_identifier:S.target.value}:null),Z.model_identifier&&ke(H=>({...H,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${Z.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!Z.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:Ls?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':ft?.modelFetcher?`已识别为 ${ft.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(re,{id:"price_in",type:"number",step:"0.1",min:"0",value:M?.price_in??"",onChange:S=>{const H=S.target.value===""?null:parseFloat(S.target.value);te(we=>we?{...we,price_in:H}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(re,{id:"price_out",type:"number",step:"0.1",min:"0",value:M?.price_out??"",onChange:S=>{const H=S.target.value===""?null:parseFloat(S.target.value);te(we=>we?{...we,price_out:H}:null)},placeholder:"默认: 0"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx(Be,{id:"enable_model_temperature",checked:M?.temperature!=null,onCheckedChange:S=>{te(S?H=>H?{...H,temperature:.5}:null:H=>H?{...H,temperature:null}:null)}})]}),M?.temperature!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:M.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(ha,{value:[M.temperature],onValueChange:S=>te(H=>H?{...H,temperature:S[0]}:null),min:0,max:1,step:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"较低的温度(0.1-0.3)产生更确定的输出,较高的温度(0.7-1.0)产生更多样化的输出"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx(Be,{id:"enable_model_max_tokens",checked:M?.max_tokens!=null,onCheckedChange:S=>{te(S?H=>H?{...H,max_tokens:2048}:null:H=>H?{...H,max_tokens:null}:null)}})]}),M?.max_tokens!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{className:"text-sm",children:"最大 Token 数"}),e.jsx(re,{type:"number",min:"1",max:"128000",value:M.max_tokens,onChange:S=>{const H=parseInt(S.target.value);!isNaN(H)&&H>=1&&te(we=>we?{...we,max_tokens:H}:null)},className:"w-28 h-8 text-sm"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"限制模型单次输出的最大 token 数量,不同模型支持的上限不同"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"force_stream_mode",checked:M?.force_stream_mode||!1,onCheckedChange:S=>te(H=>H?{...H,force_stream_mode:S}:null)}),e.jsx(k,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsx(t1,{value:M?.extra_params||{},onChange:S=>te(H=>H?{...H,extra_params:S}:null),placeholder:"添加额外参数(如 enable_thinking、top_p 等)..."})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>E(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(C,{onClick:Ne,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(us,{open:ve,onOpenChange:ge,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:['确定要删除模型 "',be!==null?n[be]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:Ps,children:"删除"})]})]})}),e.jsx(us,{open:v,onOpenChange:K,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认批量删除"}),e.jsxs(is,{children:["确定要删除选中的 ",q.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:Bs,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),z&&e.jsx(em,{onRestartComplete:Ue,onRestartFailed:Ee})]})})}const io="/api/webui/config";async function h1(){const i=await(await _e(`${io}/adapter-config/path`)).json();return!i.success||!i.path?null:{path:i.path,lastModified:i.lastModified}}async function vp(n){const r=await(await _e(`${io}/adapter-config/path`,{method:"POST",headers:Es(),body:JSON.stringify({path:n})})).json();if(!r.success)throw new Error(r.message||"保存路径失败")}async function bp(n){const r=await(await _e(`${io}/adapter-config?path=${encodeURIComponent(n)}`)).json();if(!r.success)throw new Error("读取配置文件失败");return r.content}async function Np(n,i){const d=await(await _e(`${io}/adapter-config`,{method:"POST",headers:Es(),body:JSON.stringify({path:n,content:i})})).json();if(!d.success)throw new Error(d.message||"保存配置失败")}const sa={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},Ou={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:an},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:my}};function f1(){const[n,i]=u.useState("upload"),[r,d]=u.useState(null),[m,x]=u.useState(""),[f,p]=u.useState(""),[g,N]=u.useState("oneclick"),[j,w]=u.useState(""),[y,T]=u.useState(!1),[_,L]=u.useState(!1),[D,U]=u.useState(!1),[I,R]=u.useState(!1),[z,Y]=u.useState(null),Q=u.useRef(null),{toast:E}=Rs(),M=u.useRef(null),te=W=>{if(!W.trim())return{valid:!1,error:"路径不能为空"};if(!W.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const ae=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,$=/^(\/|~\/).+\.toml$/i,Z=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,ke=ae.test(W),He=$.test(W),pe=Z.test(W);return!ke&&!He&&!pe?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(W)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},fe=W=>{if(p(W),W.trim()){const ae=te(W);w(ae.error)}else w("")},je=u.useCallback(async W=>{const ae=Ou[W];L(!0);try{const $=await bp(ae.path),Z=me($);d(Z),N(W),p(ae.path),await vp(ae.path),E({title:"加载成功",description:`已从${ae.name}预设加载配置`})}catch($){console.error("加载预设配置失败:",$),E({title:"加载失败",description:$ instanceof Error?$.message:"无法读取预设配置文件",variant:"destructive"})}finally{L(!1)}},[E]),ve=u.useCallback(async W=>{const ae=te(W);if(!ae.valid){w(ae.error),E({title:"路径无效",description:ae.error,variant:"destructive"});return}w(""),L(!0);try{const $=await bp(W),Z=me($);d(Z),p(W),await vp(W),E({title:"加载成功",description:"已从配置文件加载"})}catch($){console.error("加载配置失败:",$),E({title:"加载失败",description:$ instanceof Error?$.message:"无法读取配置文件",variant:"destructive"})}finally{L(!1)}},[E]);u.useEffect(()=>{(async()=>{try{const ae=await h1();if(ae&&ae.path){p(ae.path);const $=Object.entries(Ou).find(([,Z])=>Z.path===ae.path);$?(i("preset"),N($[0]),await je($[0])):(i("path"),await ve(ae.path))}}catch(ae){console.error("加载保存的路径失败:",ae)}})()},[ve,je]);const ge=u.useCallback(W=>{n!=="path"&&n!=="preset"||!f||(M.current&&clearTimeout(M.current),M.current=setTimeout(async()=>{T(!0);try{const ae=oe(W);await Np(f,ae),E({title:"自动保存成功",description:"配置已保存到文件"})}catch(ae){console.error("自动保存失败:",ae),E({title:"自动保存失败",description:ae instanceof Error?ae.message:"保存配置失败",variant:"destructive"})}finally{T(!1)}},1e3))},[n,f,E]),be=async()=>{if(!r||!f)return;const W=te(f);if(!W.valid){E({title:"保存失败",description:W.error,variant:"destructive"});return}T(!0);try{const ae=oe(r);await Np(f,ae),E({title:"保存成功",description:"配置已保存到文件"})}catch(ae){console.error("保存失败:",ae),E({title:"保存失败",description:ae instanceof Error?ae.message:"保存配置失败",variant:"destructive"})}finally{T(!1)}},Se=async()=>{f&&await ve(f)},O=W=>{if(W!==n){if(r){Y(W),U(!0);return}F(W)}},F=W=>{d(null),x(""),w(""),i(W),W==="preset"&&je("oneclick"),E({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[W]})},q=()=>{z&&(F(z),Y(null)),U(!1)},se=()=>{if(r){R(!0);return}v()},v=()=>{p(""),d(null),w(""),E({title:"已清空",description:"路径和配置已清空"})},K=()=>{v(),R(!1)},me=W=>{const ae=JSON.parse(JSON.stringify(sa)),$=W.split(` -`);let Z="";for(const ke of $){const He=ke.trim();if(!He||He.startsWith("#"))continue;const pe=He.match(/^\[(\w+)\]/);if(pe){Z=pe[1];continue}const Te=He.match(/^(\w+)\s*=\s*(.+)$/);if(Te&&Z){const[,Qs,vt]=Te;let ie=vt.trim();const qe=ie.match(/^("[^"]*")/);if(qe)ie=qe[1];else{const Ys=ie.indexOf("#");Ys!==-1&&(ie=ie.substring(0,Ys).trim())}let gs;if(ie==="true")gs=!0;else if(ie==="false")gs=!1;else if(ie.startsWith("[")&&ie.endsWith("]")){const Ys=ie.slice(1,-1).trim();if(Ys){const Ls=Ys.split(",").map(ps=>{const Us=ps.trim();return isNaN(Number(Us))?Us.replace(/"/g,""):Number(Us)}),ft=typeof Ls[0];gs=Ls.every(ps=>typeof ps===ft)?Ls:Ls.filter(ps=>typeof ps=="number")}else gs=[]}else ie.startsWith('"')&&ie.endsWith('"')?gs=ie.slice(1,-1):isNaN(Number(ie))?gs=ie.replace(/"/g,""):gs=Number(ie);if(Z in ae){const Ys=ae[Z];Ys[Qs]=gs}}}return ae},oe=W=>{const ae=[],$=(Z,ke)=>Z===""||Z===null||Z===void 0?ke:Z;return ae.push("[inner]"),ae.push(`version = "${$(W.inner.version,sa.inner.version)}" # 版本号`),ae.push("# 请勿修改版本号,除非你知道自己在做什么"),ae.push(""),ae.push("[nickname] # 现在没用"),ae.push(`nickname = "${$(W.nickname.nickname,sa.nickname.nickname)}"`),ae.push(""),ae.push("[napcat_server] # Napcat连接的ws服务设置"),ae.push(`host = "${$(W.napcat_server.host,sa.napcat_server.host)}" # Napcat设定的主机地址`),ae.push(`port = ${$(W.napcat_server.port||0,sa.napcat_server.port)} # Napcat设定的端口`),ae.push(`token = "${$(W.napcat_server.token,sa.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),ae.push(`heartbeat_interval = ${$(W.napcat_server.heartbeat_interval||0,sa.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),ae.push(""),ae.push("[maibot_server] # 连接麦麦的ws服务设置"),ae.push(`host = "${$(W.maibot_server.host,sa.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),ae.push(`port = ${$(W.maibot_server.port||0,sa.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),ae.push(""),ae.push("[chat] # 黑白名单功能"),ae.push(`group_list_type = "${$(W.chat.group_list_type,sa.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),ae.push(`group_list = [${W.chat.group_list.join(", ")}] # 群组名单`),ae.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),ae.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),ae.push(`private_list_type = "${$(W.chat.private_list_type,sa.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),ae.push(`private_list = [${W.chat.private_list.join(", ")}] # 私聊名单`),ae.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),ae.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),ae.push(`ban_user_id = [${W.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),ae.push(`ban_qq_bot = ${W.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),ae.push(`enable_poke = ${W.chat.enable_poke} # 是否启用戳一戳功能`),ae.push(""),ae.push("[voice] # 发送语音设置"),ae.push(`use_tts = ${W.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),ae.push(""),ae.push("[debug]"),ae.push(`level = "${$(W.debug.level,sa.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),ae.join(` -`)},xe=W=>{const ae=W.target.files?.[0];if(!ae)return;const $=new FileReader;$.onload=Z=>{try{const ke=Z.target?.result,He=me(ke);d(He),x(ae.name),E({title:"上传成功",description:`已加载配置文件:${ae.name}`})}catch(ke){console.error("解析配置文件失败:",ke),E({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},$.readAsText(ae)},ye=()=>{if(!r)return;const W=oe(r),ae=new Blob([W],{type:"text/plain;charset=utf-8"}),$=URL.createObjectURL(ae),Z=document.createElement("a");Z.href=$,Z.download=m||"config.toml",document.body.appendChild(Z),Z.click(),document.body.removeChild(Z),URL.revokeObjectURL($),E({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},de=()=>{d(JSON.parse(JSON.stringify(sa))),x("config.toml"),E({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(Ke,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[e.jsx(zt,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsxs($e,{children:[e.jsxs(We,{children:[e.jsx(es,{children:"工作模式"}),e.jsx(st,{children:"选择配置文件的管理方式"})]}),e.jsxs(hs,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${n==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>O("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(an,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${n==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>O("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(ur,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${n==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>O("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(xy,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),n==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(k,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Ou).map(([W,ae])=>{const $=ae.icon,Z=g===W;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${Z?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{N(W),je(W)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx($,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:ae.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ae.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:ae.path})]})]})},W)})})]}),n==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(re,{id:"config-path",value:f,onChange:W=>fe(W.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${j?"border-destructive":""}`}),j&&e.jsx("p",{className:"text-xs text-destructive",children:j})]}),e.jsx(C,{onClick:()=>ve(f),disabled:_||!f||!!j,className:"w-full sm:w-auto",children:_?e.jsxs(e.Fragment,{children:[e.jsx(Tt,{className:"h-4 w-4 animate-spin mr-2"}),e.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:"加载配置"}),e.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),e.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[e.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[e.jsx("span",{children:"路径格式说明"}),e.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),e.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"C:\\Adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"/opt/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),e.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),e.jsxs($t,{children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsx(Qt,{children:n==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]}):n==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]})})]}),n==="upload"&&!r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:Q,type:"file",accept:".toml",className:"hidden",onChange:xe}),e.jsxs(C,{onClick:()=>Q.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(ur,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(C,{onClick:de,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Sa,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),n==="upload"&&r&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(C,{onClick:ye,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(nl,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(n==="preset"||n==="path")&&r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(C,{onClick:be,size:"sm",disabled:y||!!j,className:"w-full sm:w-auto",children:[e.jsx(jr,{className:"mr-2 h-4 w-4"}),y?"保存中...":"立即保存"]}),e.jsxs(C,{onClick:Se,size:"sm",variant:"outline",disabled:_,className:"w-full sm:w-auto",children:[e.jsx(Tt,{className:`mr-2 h-4 w-4 ${_?"animate-spin":""}`}),"刷新"]}),n==="path"&&e.jsxs(C,{onClick:se,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(Je,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),r?e.jsxs(ka,{defaultValue:"napcat",className:"w-full",children:[e.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:e.jsxs(fa,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(ss,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),e.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),e.jsxs(ss,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),e.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),e.jsxs(ss,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),e.jsx("span",{className:"sm:hidden",children:"聊天"})]}),e.jsxs(ss,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),e.jsx("span",{className:"sm:hidden",children:"语音"})]}),e.jsx(ss,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(ys,{value:"napcat",className:"space-y-4",children:e.jsx(p1,{config:r,onChange:W=>{d(W),ge(W)}})}),e.jsx(ys,{value:"maibot",className:"space-y-4",children:e.jsx(g1,{config:r,onChange:W=>{d(W),ge(W)}})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:e.jsx(j1,{config:r,onChange:W=>{d(W),ge(W)}})}),e.jsx(ys,{value:"voice",className:"space-y-4",children:e.jsx(v1,{config:r,onChange:W=>{d(W),ge(W)}})}),e.jsx(ys,{value:"debug",className:"space-y-4",children:e.jsx(b1,{config:r,onChange:W=>{d(W),ge(W)}})})]}):e.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:e.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[e.jsx(Sa,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:n==="preset"?"请选择预设的部署方式":n==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),e.jsx(us,{open:D,onOpenChange:U,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认切换模式"}),e.jsxs(is,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(ls,{children:[e.jsx(cs,{onClick:()=>{U(!1),Y(null)},children:"取消"}),e.jsx(rs,{onClick:q,children:"确认切换"})]})]})}),e.jsx(us,{open:I,onOpenChange:R,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认清空路径"}),e.jsxs(is,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(ls,{children:[e.jsx(cs,{onClick:()=>R(!1),children:"取消"}),e.jsx(rs,{onClick:K,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function p1({config:n,onChange:i}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(re,{id:"napcat-host",value:n.napcat_server.host,onChange:r=>i({...n,napcat_server:{...n.napcat_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(re,{id:"napcat-port",type:"number",value:n.napcat_server.port||"",onChange:r=>i({...n,napcat_server:{...n.napcat_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(re,{id:"napcat-token",type:"password",value:n.napcat_server.token,onChange:r=>i({...n,napcat_server:{...n.napcat_server,token:r.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(re,{id:"napcat-heartbeat",type:"number",value:n.napcat_server.heartbeat_interval||"",onChange:r=>i({...n,napcat_server:{...n.napcat_server,heartbeat_interval:r.target.value?parseInt(r.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function g1({config:n,onChange:i}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(re,{id:"maibot-host",value:n.maibot_server.host,onChange:r=>i({...n,maibot_server:{...n.maibot_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(re,{id:"maibot-port",type:"number",value:n.maibot_server.port||"",onChange:r=>i({...n,maibot_server:{...n.maibot_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function j1({config:n,onChange:i}){const r=x=>{const f={...n};x==="group"?f.chat.group_list=[...f.chat.group_list,0]:x==="private"?f.chat.private_list=[...f.chat.private_list,0]:f.chat.ban_user_id=[...f.chat.ban_user_id,0],i(f)},d=(x,f)=>{const p={...n};x==="group"?p.chat.group_list=p.chat.group_list.filter((g,N)=>N!==f):x==="private"?p.chat.private_list=p.chat.private_list.filter((g,N)=>N!==f):p.chat.ban_user_id=p.chat.ban_user_id.filter((g,N)=>N!==f),i(p)},m=(x,f,p)=>{const g={...n};x==="group"?g.chat.group_list[f]=p:x==="private"?g.chat.private_list[f]=p:g.chat.ban_user_id[f]=p,i(g)};return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),e.jsxs("div",{className:"grid gap-4 md:gap-6",children:[e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Oe,{value:n.chat.group_list_type,onValueChange:x=>i({...n,chat:{...n.chat,group_list_type:x}}),children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(ne,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(k,{className:"text-sm md:text-base",children:"群组列表"}),e.jsxs(C,{onClick:()=>r("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Sa,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),n.chat.group_list.map((x,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:p=>m("group",f,parseInt(p.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:["确定要删除群号 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>d("group",f),children:"删除"})]})]})]})]},f)),n.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Oe,{value:n.chat.private_list_type,onValueChange:x=>i({...n,chat:{...n.chat,private_list_type:x}}),children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(ne,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(k,{className:"text-sm md:text-base",children:"私聊列表"}),e.jsxs(C,{onClick:()=>r("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Sa,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),n.chat.private_list.map((x,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:p=>m("private",f,parseInt(p.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:["确定要删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>d("private",f),children:"删除"})]})]})]})]},f)),n.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-sm md:text-base",children:"全局禁止名单"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),e.jsxs(C,{onClick:()=>r("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Sa,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),n.chat.ban_user_id.map((x,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:p=>m("ban",f,parseInt(p.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(us,{children:[e.jsx(tt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(Je,{className:"h-4 w-4"})})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:["确定要从全局禁止名单中删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>d("ban",f),children:"删除"})]})]})]})]},f)),n.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx(Be,{checked:n.chat.ban_qq_bot,onCheckedChange:x=>i({...n,chat:{...n.chat,ban_qq_bot:x}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx(Be,{checked:n.chat.enable_poke,onCheckedChange:x=>i({...n,chat:{...n.chat,enable_poke:x}})})]})]})]})})}function v1({config:n,onChange:i}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx(Be,{checked:n.voice.use_tts,onCheckedChange:r=>i({...n,voice:{use_tts:r}})})]})]})})}function b1({config:n,onChange:i}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),e.jsx("div",{className:"grid gap-3 md:gap-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Oe,{value:n.debug.level,onValueChange:r=>i({...n,debug:{level:r}}),children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(ne,{value:"INFO",children:"INFO(信息)"}),e.jsx(ne,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(ne,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(ne,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const N1=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spellCheck","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],y1=/^(aria-|data-)/,Xg=n=>Object.fromEntries(Object.entries(n).filter(([i])=>y1.test(i)||N1.includes(i)));function w1(n,i){const r=Xg(n);return Object.keys(n).some(d=>!Object.hasOwn(r,d)&&n[d]!==i[d])}class _1 extends u.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(i){if(i.uppy!==this.props.uppy)this.uninstallPlugin(i),this.installPlugin();else if(w1(this.props,i)){const{uppy:r,...d}={...this.props,target:this.container};this.plugin.setOptions(d)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:i,...r}={id:"Dashboard",...this.props,inline:!0,target:this.container};i.use(Ky,r),this.plugin=i.getPlugin(r.id)}uninstallPlugin(i=this.props){const{uppy:r}=i;r.removePlugin(this.plugin)}render(){return u.createElement("div",{className:"uppy-Container",ref:i=>{this.container=i},...Xg(this.props)})}}function S1({src:n,alt:i="表情包",className:r,maxRetries:d=5,retryInterval:m=1500}){const[x,f]=u.useState("loading"),[p,g]=u.useState(0),[N,j]=u.useState(null),w=u.useCallback(async()=>{try{const y=await fetch(n,{credentials:"include"});if(y.status===202){f("generating"),p{g(L=>L+1)},m):f("error");return}if(!y.ok){f("error");return}const T=await y.blob(),_=URL.createObjectURL(T);j(_),f("loaded")}catch(y){console.error("加载缩略图失败:",y),f("error")}},[n,p,d,m]);return u.useEffect(()=>{f("loading"),g(0),j(null)},[n]),u.useEffect(()=>{w()},[w]),u.useEffect(()=>()=>{N&&URL.revokeObjectURL(N)},[N]),x==="loading"||x==="generating"?e.jsx(Eg,{className:G("w-full h-full",r)}):x==="error"||!N?e.jsx("div",{className:G("w-full h-full flex items-center justify-center bg-muted",r),children:e.jsx(Ng,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:N,alt:i,className:G("w-full h-full object-contain",r)})}function Kg({content:n,className:i=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${i}`,children:e.jsx(Py,{remarkPlugins:[Wy,e0],rehypePlugins:[Zy],components:{code({inline:r,className:d,children:m,...x}){return r?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...x,children:m}):e.jsx("code",{className:`${d} block bg-muted p-4 rounded-lg overflow-x-auto`,...x,children:m})},table({children:r,...d}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...d,children:r})})},th({children:r,...d}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...d,children:r})},td({children:r,...d}){return e.jsx("td",{className:"border border-border px-4 py-2",...d,children:r})},a({children:r,...d}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...d,children:r})},blockquote({children:r,...d}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...d,children:r})},h1({children:r,...d}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...d,children:r})},h2({children:r,...d}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...d,children:r})},h3({children:r,...d}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...d,children:r})},h4({children:r,...d}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...d,children:r})},ul({children:r,...d}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...d,children:r})},ol({children:r,...d}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...d,children:r})},p({children:r,...d}){return e.jsx("p",{className:"my-2 leading-relaxed",...d,children:r})},hr({...r}){return e.jsx("hr",{className:"my-4 border-border",...r})}},children:n})})}function C1({children:n,className:i}){return e.jsx(Kg,{content:n,className:i})}const pa="/api/webui/emoji";async function k1(n){const i=new URLSearchParams;n.page&&i.append("page",n.page.toString()),n.page_size&&i.append("page_size",n.page_size.toString()),n.search&&i.append("search",n.search),n.is_registered!==void 0&&i.append("is_registered",n.is_registered.toString()),n.is_banned!==void 0&&i.append("is_banned",n.is_banned.toString()),n.format&&i.append("format",n.format),n.sort_by&&i.append("sort_by",n.sort_by),n.sort_order&&i.append("sort_order",n.sort_order);const r=await _e(`${pa}/list?${i}`,{});if(!r.ok)throw new Error(`获取表情包列表失败: ${r.statusText}`);return r.json()}async function T1(n){const i=await _e(`${pa}/${n}`,{});if(!i.ok)throw new Error(`获取表情包详情失败: ${i.statusText}`);return i.json()}async function E1(n,i){const r=await _e(`${pa}/${n}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok)throw new Error(`更新表情包失败: ${r.statusText}`);return r.json()}async function z1(n){const i=await _e(`${pa}/${n}`,{method:"DELETE"});if(!i.ok)throw new Error(`删除表情包失败: ${i.statusText}`);return i.json()}async function M1(){const n=await _e(`${pa}/stats/summary`,{});if(!n.ok)throw new Error(`获取统计数据失败: ${n.statusText}`);return n.json()}async function A1(n){const i=await _e(`${pa}/${n}/register`,{method:"POST"});if(!i.ok)throw new Error(`注册表情包失败: ${i.statusText}`);return i.json()}async function D1(n){const i=await _e(`${pa}/${n}/ban`,{method:"POST"});if(!i.ok)throw new Error(`封禁表情包失败: ${i.statusText}`);return i.json()}function O1(n,i=!1){return i?`${pa}/${n}/thumbnail?original=true`:`${pa}/${n}/thumbnail`}function R1(n){return`${pa}/${n}/thumbnail?original=true`}async function L1(n){const i=await _e(`${pa}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:n})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除失败")}return i.json()}function U1(){return`${pa}/upload`}function B1(){const[n,i]=u.useState([]),[r,d]=u.useState(null),[m,x]=u.useState(!1),[f,p]=u.useState(1),[g,N]=u.useState(0),[j,w]=u.useState(20),[y,T]=u.useState("all"),[_,L]=u.useState("all"),[D,U]=u.useState("all"),[I,R]=u.useState("usage_count"),[z,Y]=u.useState("desc"),[Q,E]=u.useState(null),[M,te]=u.useState(!1),[fe,je]=u.useState(!1),[ve,ge]=u.useState(!1),[be,Se]=u.useState(new Set),[O,F]=u.useState(!1),[q,se]=u.useState(""),[v,K]=u.useState("medium"),[me,oe]=u.useState(!1),{toast:xe}=Rs(),ye=u.useCallback(async()=>{try{x(!0);const ie=await k1({page:f,page_size:j,is_registered:y==="all"?void 0:y==="registered",is_banned:_==="all"?void 0:_==="banned",format:D==="all"?void 0:D,sort_by:I,sort_order:z});i(ie.data),N(ie.total)}catch(ie){const qe=ie instanceof Error?ie.message:"加载表情包列表失败";xe({title:"错误",description:qe,variant:"destructive"})}finally{x(!1)}},[f,j,y,_,D,I,z,xe]),de=async()=>{try{const ie=await M1();d(ie.data)}catch(ie){console.error("加载统计数据失败:",ie)}};u.useEffect(()=>{ye()},[ye]),u.useEffect(()=>{de()},[]);const W=async ie=>{try{const qe=await T1(ie.id);E(qe.data),te(!0)}catch(qe){const gs=qe instanceof Error?qe.message:"加载详情失败";xe({title:"错误",description:gs,variant:"destructive"})}},ae=ie=>{E(ie),je(!0)},$=ie=>{E(ie),ge(!0)},Z=async()=>{if(Q)try{await z1(Q.id),xe({title:"成功",description:"表情包已删除"}),ge(!1),E(null),ye(),de()}catch(ie){const qe=ie instanceof Error?ie.message:"删除失败";xe({title:"错误",description:qe,variant:"destructive"})}},ke=async ie=>{try{await A1(ie.id),xe({title:"成功",description:"表情包已注册"}),ye(),de()}catch(qe){const gs=qe instanceof Error?qe.message:"注册失败";xe({title:"错误",description:gs,variant:"destructive"})}},He=async ie=>{try{await D1(ie.id),xe({title:"成功",description:"表情包已封禁"}),ye(),de()}catch(qe){const gs=qe instanceof Error?qe.message:"封禁失败";xe({title:"错误",description:gs,variant:"destructive"})}},pe=ie=>{const qe=new Set(be);qe.has(ie)?qe.delete(ie):qe.add(ie),Se(qe)},Te=async()=>{try{const ie=await L1(Array.from(be));xe({title:"批量删除完成",description:ie.message}),Se(new Set),F(!1),ye(),de()}catch(ie){xe({title:"批量删除失败",description:ie instanceof Error?ie.message:"批量删除失败",variant:"destructive"})}},Qs=()=>{const ie=parseInt(q),qe=Math.ceil(g/j);ie>=1&&ie<=qe?(p(ie),se("")):xe({title:"无效的页码",description:`请输入1-${qe}之间的页码`,variant:"destructive"})},vt=r?.formats?Object.keys(r.formats):[];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),e.jsxs(C,{onClick:()=>oe(!0),className:"gap-2",children:[e.jsx(ur,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(Ke,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx($e,{children:e.jsxs(We,{className:"pb-2",children:[e.jsx(st,{children:"总数"}),e.jsx(es,{className:"text-2xl",children:r.total})]})}),e.jsx($e,{children:e.jsxs(We,{className:"pb-2",children:[e.jsx(st,{children:"已注册"}),e.jsx(es,{className:"text-2xl text-green-600",children:r.registered})]})}),e.jsx($e,{children:e.jsxs(We,{className:"pb-2",children:[e.jsx(st,{children:"已封禁"}),e.jsx(es,{className:"text-2xl text-red-600",children:r.banned})]})}),e.jsx($e,{children:e.jsxs(We,{className:"pb-2",children:[e.jsx(st,{children:"未注册"}),e.jsx(es,{className:"text-2xl text-gray-600",children:r.unregistered})]})})]}),e.jsxs($e,{children:[e.jsx(We,{children:e.jsxs(es,{className:"flex items-center gap-2",children:[e.jsx(Uu,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(hs,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:"排序方式"}),e.jsxs(Oe,{value:`${I}-${z}`,onValueChange:ie=>{const[qe,gs]=ie.split("-");R(qe),Y(gs),p(1)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(ne,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(ne,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(ne,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(ne,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(ne,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(ne,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(ne,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:"注册状态"}),e.jsxs(Oe,{value:y,onValueChange:ie=>{T(ie),p(1)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部"}),e.jsx(ne,{value:"registered",children:"已注册"}),e.jsx(ne,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:"封禁状态"}),e.jsxs(Oe,{value:_,onValueChange:ie=>{L(ie),p(1)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部"}),e.jsx(ne,{value:"banned",children:"已封禁"}),e.jsx(ne,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:"格式"}),e.jsxs(Oe,{value:D,onValueChange:ie=>{U(ie),p(1)},children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部"}),vt.map(ie=>e.jsxs(ne,{value:ie,children:[ie.toUpperCase()," (",r?.formats[ie],")"]},ie))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[be.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",be.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Oe,{value:v,onValueChange:ie=>K(ie),children:[e.jsx(Ae,{className:"w-24",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"small",children:"小"}),e.jsx(ne,{value:"medium",children:"中"}),e.jsx(ne,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Oe,{value:j.toString(),onValueChange:ie=>{w(parseInt(ie)),p(1),Se(new Set)},children:[e.jsx(Ae,{id:"emoji-page-size",className:"w-20",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"20",children:"20"}),e.jsx(ne,{value:"40",children:"40"}),e.jsx(ne,{value:"60",children:"60"}),e.jsx(ne,{value:"100",children:"100"})]})]}),be.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Se(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:()=>F(!0),children:[e.jsx(Je,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(C,{variant:"outline",size:"sm",onClick:ye,disabled:m,children:[e.jsx(Tt,{className:`h-4 w-4 mr-2 ${m?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs($e,{children:[e.jsxs(We,{children:[e.jsx(es,{children:"表情包列表"}),e.jsxs(st,{children:["共 ",g," 个表情包,当前第 ",f," 页"]})]}),e.jsxs(hs,{children:[n.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${v==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":v==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:n.map(ie=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${be.has(ie.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>pe(ie.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${be.has(ie.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${be.has(ie.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:be.has(ie.id)&&e.jsx(ta,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[ie.is_registered&&e.jsx(Fe,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),ie.is_banned&&e.jsx(Fe,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${v==="small"?"p-1":v==="medium"?"p-2":"p-3"}`,children:e.jsx(S1,{src:O1(ie.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${v==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Fe,{variant:"outline",className:"text-[10px] px-1 py-0",children:ie.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[ie.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${v==="small"?"flex-wrap":""}`,children:[e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:qe=>{qe.stopPropagation(),ae(ie)},title:"编辑",children:e.jsx(nn,{className:"h-3 w-3"})}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:qe=>{qe.stopPropagation(),W(ie)},title:"详情",children:e.jsx(Ra,{className:"h-3 w-3"})}),!ie.is_registered&&e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:qe=>{qe.stopPropagation(),ke(ie)},title:"注册",children:e.jsx(ta,{className:"h-3 w-3"})}),!ie.is_banned&&e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:qe=>{qe.stopPropagation(),He(ie)},title:"封禁",children:e.jsx(hy,{className:"h-3 w-3"})}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:qe=>{qe.stopPropagation(),$(ie)},title:"删除",children:e.jsx(Je,{className:"h-3 w-3"})})]})]})]},ie.id))}),g>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(f-1)*j+1," 到"," ",Math.min(f*j,g)," 条,共 ",g," 条"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>p(ie=>Math.max(1,ie-1)),disabled:f===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:q,onChange:ie=>se(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&Qs(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(g/j)}),e.jsx(C,{variant:"outline",size:"sm",onClick:Qs,disabled:!q,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>p(ie=>ie+1),disabled:f>=Math.ceil(g/j),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(g/j)),disabled:f>=Math.ceil(g/j),className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(H1,{emoji:Q,open:M,onOpenChange:te}),e.jsx(q1,{emoji:Q,open:fe,onOpenChange:je,onSuccess:()=>{ye(),de()}}),e.jsx(G1,{open:me,onOpenChange:oe,onSuccess:()=>{ye(),de()}})]})}),e.jsx(us,{open:O,onOpenChange:F,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认批量删除"}),e.jsxs(is,{children:["你确定要删除选中的 ",be.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:Te,children:"确认删除"})]})]})}),e.jsx(Hs,{open:ve,onOpenChange:ge,children:e.jsxs(As,{children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"确认删除"}),e.jsx(Js,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>ge(!1),children:"取消"}),e.jsx(C,{variant:"destructive",onClick:Z,children:"删除"})]})]})})]})}function H1({emoji:n,open:i,onOpenChange:r}){if(!n)return null;const d=m=>m?new Date(m*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(As,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Ds,{children:e.jsx(Os,{children:"表情包详情"})}),e.jsx(Ke,{className:"max-h-[calc(90vh-8rem)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:R1(n.id),alt:n.description||"表情包",className:"w-full h-full object-cover",onError:m=>{const x=m.target;x.style.display="none";const f=x.parentElement;f&&(f.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:n.id})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx(Fe,{variant:"outline",children:n.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:n.full_path})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:n.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"描述"}),n.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(C1,{className:"prose-sm",children:n.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:n.emotion?e.jsx("span",{className:"text-sm",children:n.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[n.is_registered&&e.jsx(Fe,{variant:"default",className:"bg-green-600",children:"已注册"}),n.is_banned&&e.jsx(Fe,{variant:"destructive",children:"已封禁"}),!n.is_registered&&!n.is_banned&&e.jsx(Fe,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:n.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:d(n.record_time)})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:d(n.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:d(n.last_used_time)})]})]})})]})})}function q1({emoji:n,open:i,onOpenChange:r,onSuccess:d}){const[m,x]=u.useState(""),[f,p]=u.useState(!1),[g,N]=u.useState(!1),[j,w]=u.useState(!1),{toast:y}=Rs();u.useEffect(()=>{n&&(x(n.emotion||""),p(n.is_registered),N(n.is_banned))},[n]);const T=async()=>{if(n)try{w(!0);const _=m.split(/[,,]/).map(L=>L.trim()).filter(Boolean).join(",");await E1(n.id,{emotion:_||void 0,is_registered:f,is_banned:g}),y({title:"成功",description:"表情包信息已更新"}),r(!1),d()}catch(_){const L=_ instanceof Error?_.message:"保存失败";y({title:"错误",description:L,variant:"destructive"})}finally{w(!1)}};return n?e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(As,{className:"max-w-2xl",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"编辑表情包"}),e.jsx(Js,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(k,{children:"情绪"}),e.jsx(Ms,{value:m,onChange:_=>x(_.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ht,{id:"is_registered",checked:f,onCheckedChange:_=>{_===!0?(p(!0),N(!1)):p(!1)}}),e.jsx(k,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ht,{id:"is_banned",checked:g,onCheckedChange:_=>{_===!0?(N(!0),p(!1)):N(!1)}}),e.jsx(k,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(C,{onClick:T,disabled:j,children:j?"保存中...":"保存"})]})]})}):null}function G1({open:n,onOpenChange:i,onSuccess:r}){const[d,m]=u.useState("select"),[x,f]=u.useState([]),[p,g]=u.useState(null),[N,j]=u.useState(!1),{toast:w}=Rs(),y=u.useMemo(()=>new Jy({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);u.useEffect(()=>{const Q=()=>{const E=y.getFiles();if(E.length===0)return;const M=E.map(te=>({id:te.id,name:te.name,previewUrl:te.preview||URL.createObjectURL(te.data),emotion:"",description:"",isRegistered:!0,file:te.data}));f(M),E.length===1?(g(M[0].id),m("edit-single")):m("edit-multiple")};return y.on("upload",Q),()=>{y.off("upload",Q)}},[y]),u.useEffect(()=>{n||(y.cancelAll(),m("select"),f([]),g(null),j(!1))},[n,y]);const T=u.useCallback((Q,E)=>{f(M=>M.map(te=>te.id===Q?{...te,...E}:te))},[]),_=u.useCallback(Q=>Q.emotion.trim().length>0,[]),L=u.useMemo(()=>x.length>0&&x.every(_),[x,_]),D=u.useMemo(()=>x.find(Q=>Q.id===p)||null,[x,p]),U=u.useCallback(()=>{(d==="edit-single"||d==="edit-multiple")&&(m("select"),f([]),g(null))},[d]),I=u.useCallback(async()=>{if(!L){w({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}j(!0);const Q=localStorage.getItem("access-token")||"";let E=0,M=0;try{for(const te of x){const fe=new FormData;fe.append("file",te.file),fe.append("emotion",te.emotion),fe.append("description",te.description),fe.append("is_registered",te.isRegistered.toString());try{(await fetch(U1(),{method:"POST",headers:{Authorization:`Bearer ${Q}`},body:fe})).ok?E++:M++}catch{M++}}M===0?(w({title:"上传成功",description:`成功上传 ${E} 个表情包`}),i(!1),r()):(w({title:"部分上传失败",description:`成功 ${E} 个,失败 ${M} 个`,variant:"destructive"}),r())}finally{j(!1)}},[L,x,w,i,r]),R=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(_1,{uppy:y,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),z=()=>{const Q=x[0];return Q?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(C,{variant:"ghost",size:"sm",onClick:U,children:[e.jsx(ei,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"编辑表情包信息"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("div",{className:"w-32 h-32 rounded-lg border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:Q.previewUrl,alt:Q.name,className:"max-w-full max-h-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate max-w-32",children:Q.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(k,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"single-emotion",value:Q.emotion,onChange:E=>T(Q.id,{emotion:E.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:Q.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"single-description",children:"描述"}),e.jsx(re,{id:"single-description",value:Q.description,onChange:E=>T(Q.id,{description:E.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ht,{id:"single-is-registered",checked:Q.isRegistered,onCheckedChange:E=>T(Q.id,{isRegistered:E===!0})}),e.jsx(k,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(at,{children:e.jsx(C,{onClick:I,disabled:!L||N,children:N?"上传中...":"上传"})})]}):null},Y=()=>{const Q=x.filter(_).length,E=x.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(C,{variant:"ghost",size:"sm",onClick:U,children:[e.jsx(ei,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",Q,"/",E," 已完成)"]})]}),e.jsx(Fe,{variant:L?"default":"secondary",children:L?e.jsxs(e.Fragment,{children:[e.jsx(Vt,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(il,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ke,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:x.map(M=>{const te=_(M),fe=p===M.id;return e.jsxs("div",{onClick:()=>g(M.id),className:` - flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all - ${fe?"ring-2 ring-primary":""} - ${te?"border-green-500 bg-green-50 dark:bg-green-950/20":"border-border hover:border-muted-foreground/50"} - `,children:[e.jsx("div",{className:"w-12 h-12 rounded border overflow-hidden bg-muted flex-shrink-0 flex items-center justify-center",children:e.jsx("img",{src:M.previewUrl,alt:M.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:M.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:M.emotion||"未填写情感标签"})]}),te?e.jsx(ta,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):e.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-muted-foreground/30 flex-shrink-0"})]},M.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:D?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-16 h-16 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:D.previewUrl,alt:D.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:D.name}),_(D)&&e.jsxs(Fe,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(Vt,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(k,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"multi-emotion",value:D.emotion,onChange:M=>T(D.id,{emotion:M.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:D.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"multi-description",children:"描述"}),e.jsx(re,{id:"multi-description",value:D.description,onChange:M=>T(D.id,{description:M.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ht,{id:"multi-is-registered",checked:D.isRegistered,onCheckedChange:M=>T(D.id,{isRegistered:M===!0})}),e.jsx(k,{htmlFor:"multi-is-registered",className:"cursor-pointer text-sm",children:"上传后立即注册"})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Ng,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(at,{children:e.jsx(C,{onClick:I,disabled:!L||N,children:N?"上传中...":`上传全部 (${E})`})})]})};return e.jsx(Hs,{open:n,onOpenChange:i,children:e.jsxs(As,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Ds,{children:[e.jsxs(Os,{className:"flex items-center gap-2",children:[e.jsx(ur,{className:"h-5 w-5"}),d==="select"&&"上传表情包 - 选择文件",d==="edit-single"&&"上传表情包 - 填写信息",d==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(Js,{children:[d==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",d==="edit-single"&&"请填写表情包的情感标签(必填)和描述",d==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[d==="select"&&R(),d==="edit-single"&&z(),d==="edit-multiple"&&Y()]})]})})}const Ul="/api/webui/expression";async function F1(){const n=await _e(`${Ul}/chats`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取聊天列表失败")}return n.json()}async function V1(n){const i=new URLSearchParams;n.page&&i.append("page",n.page.toString()),n.page_size&&i.append("page_size",n.page_size.toString()),n.search&&i.append("search",n.search),n.chat_id&&i.append("chat_id",n.chat_id);const r=await _e(`${Ul}/list?${i}`,{});if(!r.ok){const d=await r.json();throw new Error(d.detail||"获取表达方式列表失败")}return r.json()}async function $1(n){const i=await _e(`${Ul}/${n}`,{});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取表达方式详情失败")}return i.json()}async function Q1(n){const i=await _e(`${Ul}/`,{method:"POST",body:JSON.stringify(n)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"创建表达方式失败")}return i.json()}async function I1(n,i){const r=await _e(`${Ul}/${n}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok){const d=await r.json();throw new Error(d.detail||"更新表达方式失败")}return r.json()}async function Y1(n){const i=await _e(`${Ul}/${n}`,{method:"DELETE"});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除表达方式失败")}return i.json()}async function X1(n){const i=await _e(`${Ul}/batch/delete`,{method:"POST",body:JSON.stringify({ids:n})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除表达方式失败")}return i.json()}async function K1(){const n=await _e(`${Ul}/stats/summary`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取统计数据失败")}return n.json()}function J1(){const[n,i]=u.useState([]),[r,d]=u.useState(!0),[m,x]=u.useState(0),[f,p]=u.useState(1),[g,N]=u.useState(20),[j,w]=u.useState(""),[y,T]=u.useState(null),[_,L]=u.useState(!1),[D,U]=u.useState(!1),[I,R]=u.useState(!1),[z,Y]=u.useState(null),[Q,E]=u.useState(new Set),[M,te]=u.useState(!1),[fe,je]=u.useState(""),[ve,ge]=u.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[be,Se]=u.useState([]),[O,F]=u.useState(new Map),{toast:q}=Rs(),se=async()=>{try{d(!0);const Z=await V1({page:f,page_size:g,search:j||void 0});i(Z.data),x(Z.total)}catch(Z){q({title:"加载失败",description:Z instanceof Error?Z.message:"无法加载表达方式",variant:"destructive"})}finally{d(!1)}},v=async()=>{try{const Z=await K1();Z?.data&&ge(Z.data)}catch(Z){console.error("加载统计数据失败:",Z)}},K=async()=>{try{const Z=await F1();if(Z?.data){Se(Z.data);const ke=new Map;Z.data.forEach(He=>{ke.set(He.chat_id,He.chat_name)}),F(ke)}}catch(Z){console.error("加载聊天列表失败:",Z)}},me=Z=>O.get(Z)||Z;u.useEffect(()=>{se(),v(),K()},[f,g,j]);const oe=async Z=>{try{const ke=await $1(Z.id);T(ke.data),L(!0)}catch(ke){q({title:"加载详情失败",description:ke instanceof Error?ke.message:"无法加载表达方式详情",variant:"destructive"})}},xe=Z=>{T(Z),U(!0)},ye=async Z=>{try{await Y1(Z.id),q({title:"删除成功",description:`已删除表达方式: ${Z.situation}`}),Y(null),se(),v()}catch(ke){q({title:"删除失败",description:ke instanceof Error?ke.message:"无法删除表达方式",variant:"destructive"})}},de=Z=>{const ke=new Set(Q);ke.has(Z)?ke.delete(Z):ke.add(Z),E(ke)},W=()=>{Q.size===n.length&&n.length>0?E(new Set):E(new Set(n.map(Z=>Z.id)))},ae=async()=>{try{await X1(Array.from(Q)),q({title:"批量删除成功",description:`已删除 ${Q.size} 个表达方式`}),E(new Set),te(!1),se(),v()}catch(Z){q({title:"批量删除失败",description:Z instanceof Error?Z.message:"无法批量删除表达方式",variant:"destructive"})}},$=()=>{const Z=parseInt(fe),ke=Math.ceil(m/g);Z>=1&&Z<=ke?(p(Z),je("")):q({title:"无效的页码",description:`请输入1-${ke}之间的页码`,variant:"destructive"})};return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Ol,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs(C,{onClick:()=>R(!0),className:"gap-2",children:[e.jsx(rt,{className:"h-4 w-4"}),"新增表达方式"]})]})}),e.jsx(Ke,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:ve.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:ve.recent_7days})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:ve.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(k,{htmlFor:"search",children:"搜索"}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Mt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索情境、风格或上下文...",value:j,onChange:Z=>w(Z.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:Q.size>0&&e.jsxs("span",{children:["已选择 ",Q.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Oe,{value:g.toString(),onValueChange:Z=>{N(parseInt(Z)),p(1),E(new Set)},children:[e.jsx(Ae,{id:"page-size",className:"w-20",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"10",children:"10"}),e.jsx(ne,{value:"20",children:"20"}),e.jsx(ne,{value:"50",children:"50"}),e.jsx(ne,{value:"100",children:"100"})]})]}),Q.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>E(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:()=>te(!0),children:[e.jsx(Je,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ct,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(ht,{checked:Q.size===n.length&&n.length>0,onCheckedChange:W})}),e.jsx(Ye,{children:"情境"}),e.jsx(Ye,{children:"风格"}),e.jsx(Ye,{children:"聊天"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:r?e.jsx(ct,{children:e.jsx(Ge,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):n.length===0?e.jsx(ct,{children:e.jsx(Ge,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):n.map(Z=>e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(ht,{checked:Q.has(Z.id),onCheckedChange:()=>de(Z.id)})}),e.jsx(Ge,{className:"font-medium max-w-xs truncate",children:Z.situation}),e.jsx(Ge,{className:"max-w-xs truncate",children:Z.style}),e.jsx(Ge,{className:"max-w-[200px] truncate",title:me(Z.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:me(Z.chat_id)})}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>xe(Z),children:[e.jsx(nn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>oe(Z),title:"查看详情",children:e.jsx(Ot,{className:"h-4 w-4"})}),e.jsxs(C,{size:"sm",onClick:()=>Y(Z),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(Je,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Z.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):n.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):n.map(Z=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ht,{checked:Q.has(Z.id),onCheckedChange:()=>de(Z.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:Z.situation,children:Z.situation})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),e.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:Z.style,children:Z.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("p",{className:"text-sm truncate",title:me(Z.chat_id),style:{wordBreak:"keep-all"},children:me(Z.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>xe(Z),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(nn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>oe(Z),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(Ot,{className:"h-3 w-3"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>Y(Z),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(Je,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Z.id))}),m>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",m," 条记录,第 ",f," / ",Math.ceil(m/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>p(f-1),disabled:f===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:fe,onChange:Z=>je(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&$(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/g)}),e.jsx(C,{variant:"outline",size:"sm",onClick:$,disabled:!fe,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>p(f+1),disabled:f>=Math.ceil(m/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(m/g)),disabled:f>=Math.ceil(m/g),className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(P1,{expression:y,open:_,onOpenChange:L,chatNameMap:O}),e.jsx(Z1,{open:I,onOpenChange:R,chatList:be,onSuccess:()=>{se(),v(),R(!1)}}),e.jsx(W1,{expression:y,open:D,onOpenChange:U,chatList:be,onSuccess:()=>{se(),v(),U(!1)}}),e.jsx(us,{open:!!z,onOpenChange:()=>Y(null),children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:['确定要删除表达方式 "',z?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>z&&ye(z),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(e2,{open:M,onOpenChange:te,onConfirm:ae,count:Q.size})]})}function P1({expression:n,open:i,onOpenChange:r,chatNameMap:d}){if(!n)return null;const m=f=>f?new Date(f*1e3).toLocaleString("zh-CN"):"-",x=f=>d.get(f)||f;return e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(As,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"表达方式详情"}),e.jsx(Js,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ar,{label:"情境",value:n.situation}),e.jsx(ar,{label:"风格",value:n.style}),e.jsx(ar,{label:"聊天",value:x(n.chat_id)}),e.jsx(ar,{icon:si,label:"记录ID",value:n.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(ar,{icon:Zn,label:"创建时间",value:m(n.create_date)})})]}),e.jsx(at,{children:e.jsx(C,{onClick:()=>r(!1),children:"关闭"})})]})})}function ar({icon:n,label:i,value:r,mono:d=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(k,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n&&e.jsx(n,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:G("text-sm",d&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function Z1({open:n,onOpenChange:i,chatList:r,onSuccess:d}){const[m,x]=u.useState({situation:"",style:"",chat_id:""}),[f,p]=u.useState(!1),{toast:g}=Rs(),N=async()=>{if(!m.situation||!m.style||!m.chat_id){g({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{p(!0),await Q1(m),g({title:"创建成功",description:"表达方式已创建"}),x({situation:"",style:"",chat_id:""}),d()}catch(j){g({title:"创建失败",description:j instanceof Error?j.message:"无法创建表达方式",variant:"destructive"})}finally{p(!1)}};return e.jsx(Hs,{open:n,onOpenChange:i,children:e.jsxs(As,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"新增表达方式"}),e.jsx(Js,{children:"创建新的表达方式记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(k,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"situation",value:m.situation,onChange:j=>x({...m,situation:j.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(k,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"style",value:m.style,onChange:j=>x({...m,style:j.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(k,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Oe,{value:m.chat_id,onValueChange:j=>x({...m,chat_id:j}),children:[e.jsx(Ae,{children:e.jsx(Re,{placeholder:"选择关联的聊天"})}),e.jsx(De,{children:r.map(j=>e.jsx(ne,{value:j.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[j.chat_name,j.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},j.chat_id))})]})]})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(C,{onClick:N,disabled:f,children:f?"创建中...":"创建"})]})]})})}function W1({expression:n,open:i,onOpenChange:r,chatList:d,onSuccess:m}){const[x,f]=u.useState({}),[p,g]=u.useState(!1),{toast:N}=Rs();u.useEffect(()=>{n&&f({situation:n.situation,style:n.style,chat_id:n.chat_id})},[n]);const j=async()=>{if(n)try{g(!0),await I1(n.id,x),N({title:"保存成功",description:"表达方式已更新"}),m()}catch(w){N({title:"保存失败",description:w instanceof Error?w.message:"无法更新表达方式",variant:"destructive"})}finally{g(!1)}};return n?e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(As,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"编辑表达方式"}),e.jsx(Js,{children:"修改表达方式的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"edit_situation",children:"情境"}),e.jsx(re,{id:"edit_situation",value:x.situation||"",onChange:w=>f({...x,situation:w.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"edit_style",children:"风格"}),e.jsx(re,{id:"edit_style",value:x.style||"",onChange:w=>f({...x,style:w.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Oe,{value:x.chat_id||"",onValueChange:w=>f({...x,chat_id:w}),children:[e.jsx(Ae,{children:e.jsx(Re,{placeholder:"选择关联的聊天"})}),e.jsx(De,{children:d.map(w=>e.jsx(ne,{value:w.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[w.chat_name,w.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},w.chat_id))})]})]})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(C,{onClick:j,disabled:p,children:p?"保存中...":"保存"})]})]})}):null}function e2({open:n,onOpenChange:i,onConfirm:r,count:d}){return e.jsx(us,{open:n,onOpenChange:i,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认批量删除"}),e.jsxs(is,{children:["您即将删除 ",d," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const cl="/api/webui/jargon";async function s2(){const n=await _e(`${cl}/chats`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取聊天列表失败")}return n.json()}async function t2(n){const i=new URLSearchParams;n.page&&i.append("page",n.page.toString()),n.page_size&&i.append("page_size",n.page_size.toString()),n.search&&i.append("search",n.search),n.chat_id&&i.append("chat_id",n.chat_id),n.is_jargon!==void 0&&n.is_jargon!==null&&i.append("is_jargon",n.is_jargon.toString()),n.is_global!==void 0&&i.append("is_global",n.is_global.toString());const r=await _e(`${cl}/list?${i}`,{});if(!r.ok){const d=await r.json();throw new Error(d.detail||"获取黑话列表失败")}return r.json()}async function a2(n){const i=await _e(`${cl}/${n}`,{});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取黑话详情失败")}return i.json()}async function l2(n){const i=await _e(`${cl}/`,{method:"POST",body:JSON.stringify(n)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"创建黑话失败")}return i.json()}async function n2(n,i){const r=await _e(`${cl}/${n}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok){const d=await r.json();throw new Error(d.detail||"更新黑话失败")}return r.json()}async function i2(n){const i=await _e(`${cl}/${n}`,{method:"DELETE"});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除黑话失败")}return i.json()}async function r2(n){const i=await _e(`${cl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:n})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除黑话失败")}return i.json()}async function c2(){const n=await _e(`${cl}/stats/summary`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取黑话统计失败")}return n.json()}async function o2(n,i){const r=new URLSearchParams;n.forEach(m=>r.append("ids",m.toString())),r.append("is_jargon",i.toString());const d=await _e(`${cl}/batch/set-jargon?${r}`,{method:"POST"});if(!d.ok){const m=await d.json();throw new Error(m.detail||"批量设置黑话状态失败")}return d.json()}function d2(){const[n,i]=u.useState([]),[r,d]=u.useState(!0),[m,x]=u.useState(0),[f,p]=u.useState(1),[g,N]=u.useState(20),[j,w]=u.useState(""),[y,T]=u.useState("all"),[_,L]=u.useState("all"),[D,U]=u.useState(null),[I,R]=u.useState(!1),[z,Y]=u.useState(!1),[Q,E]=u.useState(!1),[M,te]=u.useState(null),[fe,je]=u.useState(new Set),[ve,ge]=u.useState(!1),[be,Se]=u.useState(""),[O,F]=u.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[q,se]=u.useState([]),{toast:v}=Rs(),K=async()=>{try{d(!0);const pe=await t2({page:f,page_size:g,search:j||void 0,chat_id:y==="all"?void 0:y,is_jargon:_==="all"?void 0:_==="true"?!0:_==="false"?!1:void 0});i(pe.data),x(pe.total)}catch(pe){v({title:"加载失败",description:pe instanceof Error?pe.message:"无法加载黑话列表",variant:"destructive"})}finally{d(!1)}},me=async()=>{try{const pe=await c2();pe?.data&&F(pe.data)}catch(pe){console.error("加载统计数据失败:",pe)}},oe=async()=>{try{const pe=await s2();pe?.data&&se(pe.data)}catch(pe){console.error("加载聊天列表失败:",pe)}};u.useEffect(()=>{K(),me(),oe()},[f,g,j,y,_]);const xe=async pe=>{try{const Te=await a2(pe.id);U(Te.data),R(!0)}catch(Te){v({title:"加载详情失败",description:Te instanceof Error?Te.message:"无法加载黑话详情",variant:"destructive"})}},ye=pe=>{U(pe),Y(!0)},de=async pe=>{try{await i2(pe.id),v({title:"删除成功",description:`已删除黑话: ${pe.content}`}),te(null),K(),me()}catch(Te){v({title:"删除失败",description:Te instanceof Error?Te.message:"无法删除黑话",variant:"destructive"})}},W=pe=>{const Te=new Set(fe);Te.has(pe)?Te.delete(pe):Te.add(pe),je(Te)},ae=()=>{fe.size===n.length&&n.length>0?je(new Set):je(new Set(n.map(pe=>pe.id)))},$=async()=>{try{await r2(Array.from(fe)),v({title:"批量删除成功",description:`已删除 ${fe.size} 个黑话`}),je(new Set),ge(!1),K(),me()}catch(pe){v({title:"批量删除失败",description:pe instanceof Error?pe.message:"无法批量删除黑话",variant:"destructive"})}},Z=async pe=>{try{await o2(Array.from(fe),pe),v({title:"操作成功",description:`已将 ${fe.size} 个词条设为${pe?"黑话":"非黑话"}`}),je(new Set),K(),me()}catch(Te){v({title:"操作失败",description:Te instanceof Error?Te.message:"批量设置失败",variant:"destructive"})}},ke=()=>{const pe=parseInt(be),Te=Math.ceil(m/g);pe>=1&&pe<=Te?(p(pe),Se("")):v({title:"无效的页码",description:`请输入1-${Te}之间的页码`,variant:"destructive"})},He=pe=>pe===!0?e.jsxs(Fe,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Vt,{className:"h-3 w-3 mr-1"}),"是黑话"]}):pe===!1?e.jsxs(Fe,{variant:"secondary",children:[e.jsx(il,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(Fe,{variant:"outline",children:[e.jsx(bg,{className:"h-3 w-3 mr-1"}),"未判定"]});return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(fy,{className:"h-8 w-8",strokeWidth:2}),"黑话管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦学习到的黑话和俚语"})]}),e.jsxs(C,{onClick:()=>E(!0),className:"gap-2",children:[e.jsx(rt,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(Ke,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:O.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"已确认黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-green-600",children:O.confirmed_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"确认非黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-gray-500",children:O.confirmed_not_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"待判定"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-yellow-600",children:O.pending})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"全局黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-blue-600",children:O.global_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"推断完成"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-purple-600",children:O.complete_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:O.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(k,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索内容、含义...",value:j,onChange:pe=>w(pe.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(k,{children:"聊天筛选"}),e.jsxs(Oe,{value:y,onValueChange:T,children:[e.jsx(Ae,{children:e.jsx(Re,{placeholder:"全部聊天"})}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部聊天"}),q.map(pe=>e.jsx(ne,{value:pe.chat_id,children:pe.chat_name},pe.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(k,{children:"状态筛选"}),e.jsxs(Oe,{value:_,onValueChange:L,children:[e.jsx(Ae,{children:e.jsx(Re,{placeholder:"全部状态"})}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部状态"}),e.jsx(ne,{value:"true",children:"是黑话"}),e.jsx(ne,{value:"false",children:"非黑话"}),e.jsx(ne,{value:"null",children:"未判定"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(k,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Oe,{value:g.toString(),onValueChange:pe=>{N(parseInt(pe)),p(1),je(new Set)},children:[e.jsx(Ae,{id:"page-size",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"10",children:"10"}),e.jsx(ne,{value:"20",children:"20"}),e.jsx(ne,{value:"50",children:"50"}),e.jsx(ne,{value:"100",children:"100"})]})]})]})]}),fe.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4 pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",fe.size," 个"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>Z(!0),children:[e.jsx(Vt,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>Z(!1),children:[e.jsx(il,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>je(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:()=>ge(!0),children:[e.jsx(Je,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ct,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(ht,{checked:fe.size===n.length&&n.length>0,onCheckedChange:ae})}),e.jsx(Ye,{children:"内容"}),e.jsx(Ye,{children:"含义"}),e.jsx(Ye,{children:"聊天"}),e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{className:"text-center",children:"次数"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:r?e.jsx(ct,{children:e.jsx(Ge,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):n.length===0?e.jsx(ct,{children:e.jsx(Ge,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):n.map(pe=>e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(ht,{checked:fe.has(pe.id),onCheckedChange:()=>W(pe.id)})}),e.jsx(Ge,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[pe.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(Bu,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:pe.content,children:pe.content})]})}),e.jsx(Ge,{className:"max-w-[200px] truncate",title:pe.meaning||"",children:pe.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ge,{className:"max-w-[150px] truncate",title:pe.chat_name||pe.chat_id,children:pe.chat_name||pe.chat_id}),e.jsx(Ge,{children:He(pe.is_jargon)}),e.jsx(Ge,{className:"text-center",children:pe.count}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>ye(pe),children:[e.jsx(nn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>xe(pe),title:"查看详情",children:e.jsx(Ot,{className:"h-4 w-4"})}),e.jsxs(C,{size:"sm",onClick:()=>te(pe),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(Je,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},pe.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):n.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):n.map(pe=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ht,{checked:fe.has(pe.id),onCheckedChange:()=>W(pe.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[pe.is_global&&e.jsx(Bu,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:pe.content})]}),pe.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:pe.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[He(pe.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",pe.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",pe.chat_name||pe.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>ye(pe),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(nn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>xe(pe),className:"text-xs px-2 py-1 h-auto",children:e.jsx(Ot,{className:"h-3 w-3"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>te(pe),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(Je,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},pe.id))}),m>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",m," 条记录,第 ",f," / ",Math.ceil(m/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>p(f-1),disabled:f===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:be,onChange:pe=>Se(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&ke(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/g)}),e.jsx(C,{variant:"outline",size:"sm",onClick:ke,disabled:!be,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>p(f+1),disabled:f>=Math.ceil(m/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(m/g)),disabled:f>=Math.ceil(m/g),className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(u2,{jargon:D,open:I,onOpenChange:R}),e.jsx(m2,{open:Q,onOpenChange:E,chatList:q,onSuccess:()=>{K(),me(),E(!1)}}),e.jsx(x2,{jargon:D,open:z,onOpenChange:Y,chatList:q,onSuccess:()=>{K(),me(),Y(!1)}}),e.jsx(us,{open:!!M,onOpenChange:()=>te(null),children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:['确定要删除黑话 "',M?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>M&&de(M),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(us,{open:ve,onOpenChange:ge,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认批量删除"}),e.jsxs(is,{children:["您即将删除 ",fe.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:$,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function u2({jargon:n,open:i,onOpenChange:r}){return n?e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(As,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"黑话详情"}),e.jsx(Js,{children:"查看黑话的完整信息"})]}),e.jsx(Ke,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ru,{icon:si,label:"记录ID",value:n.id.toString(),mono:!0}),e.jsx(Ru,{label:"使用次数",value:n.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:n.content})]}),n.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{className:"text-xs text-muted-foreground",children:"原始内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const d=JSON.parse(n.raw_content);return Array.isArray(d)?d.map((m,x)=>e.jsxs("div",{children:[x>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:m})]},x)):e.jsx("div",{className:"whitespace-pre-wrap",children:n.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:n.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:n.meaning?e.jsx(Kg,{content:n.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ru,{label:"聊天",value:n.chat_name||n.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[n.is_jargon===!0&&e.jsx(Fe,{variant:"default",className:"bg-green-600",children:"是黑话"}),n.is_jargon===!1&&e.jsx(Fe,{variant:"secondary",children:"非黑话"}),n.is_jargon===null&&e.jsx(Fe,{variant:"outline",children:"未判定"}),n.is_global&&e.jsx(Fe,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),n.is_complete&&e.jsx(Fe,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),n.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{className:"text-xs text-muted-foreground",children:"上下文推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:n.inference_with_context})]}),n.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(k,{className:"text-xs text-muted-foreground",children:"纯词条推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:n.inference_content_only})]})]})}),e.jsx(at,{className:"flex-shrink-0",children:e.jsx(C,{onClick:()=>r(!1),children:"关闭"})})]})}):null}function Ru({icon:n,label:i,value:r,mono:d=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(k,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n&&e.jsx(n,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:G("text-sm",d&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function m2({open:n,onOpenChange:i,chatList:r,onSuccess:d}){const[m,x]=u.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[f,p]=u.useState(!1),{toast:g}=Rs(),N=async()=>{if(!m.content||!m.chat_id){g({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{p(!0),await l2(m),g({title:"创建成功",description:"黑话已创建"}),x({content:"",meaning:"",chat_id:"",is_global:!1}),d()}catch(j){g({title:"创建失败",description:j instanceof Error?j.message:"无法创建黑话",variant:"destructive"})}finally{p(!1)}};return e.jsx(Hs,{open:n,onOpenChange:i,children:e.jsxs(As,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"新增黑话"}),e.jsx(Js,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(k,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"content",value:m.content,onChange:j=>x({...m,content:j.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"meaning",children:"含义"}),e.jsx(Ms,{id:"meaning",value:m.meaning||"",onChange:j=>x({...m,meaning:j.target.value}),placeholder:"输入黑话含义(可选)",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(k,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Oe,{value:m.chat_id,onValueChange:j=>x({...m,chat_id:j}),children:[e.jsx(Ae,{children:e.jsx(Re,{placeholder:"选择关联的聊天"})}),e.jsx(De,{children:r.map(j=>e.jsx(ne,{value:j.chat_id,children:j.chat_name},j.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"is_global",checked:m.is_global,onCheckedChange:j=>x({...m,is_global:j})}),e.jsx(k,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(C,{onClick:N,disabled:f,children:f?"创建中...":"创建"})]})]})})}function x2({jargon:n,open:i,onOpenChange:r,chatList:d,onSuccess:m}){const[x,f]=u.useState({}),[p,g]=u.useState(!1),{toast:N}=Rs();u.useEffect(()=>{n&&f({content:n.content,meaning:n.meaning||"",chat_id:n.stream_id||n.chat_id,is_global:n.is_global,is_jargon:n.is_jargon})},[n]);const j=async()=>{if(n)try{g(!0),await n2(n.id,x),N({title:"保存成功",description:"黑话已更新"}),m()}catch(w){N({title:"保存失败",description:w instanceof Error?w.message:"无法更新黑话",variant:"destructive"})}finally{g(!1)}};return n?e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(As,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"编辑黑话"}),e.jsx(Js,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"edit_content",children:"内容"}),e.jsx(re,{id:"edit_content",value:x.content||"",onChange:w=>f({...x,content:w.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(Ms,{id:"edit_meaning",value:x.meaning||"",onChange:w=>f({...x,meaning:w.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Oe,{value:x.chat_id||"",onValueChange:w=>f({...x,chat_id:w}),children:[e.jsx(Ae,{children:e.jsx(Re,{placeholder:"选择关联的聊天"})}),e.jsx(De,{children:d.map(w=>e.jsx(ne,{value:w.chat_id,children:w.chat_name},w.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:"黑话状态"}),e.jsxs(Oe,{value:x.is_jargon===null?"null":x.is_jargon?.toString()||"null",onValueChange:w=>f({...x,is_jargon:w==="null"?null:w==="true"}),children:[e.jsx(Ae,{children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"null",children:"未判定"}),e.jsx(ne,{value:"true",children:"是黑话"}),e.jsx(ne,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"edit_is_global",checked:x.is_global,onCheckedChange:w=>f({...x,is_global:w})}),e.jsx(k,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(C,{onClick:j,disabled:p,children:p?"保存中...":"保存"})]})]})}):null}const ri="/api/webui/person";async function h2(n){const i=new URLSearchParams;n.page&&i.append("page",n.page.toString()),n.page_size&&i.append("page_size",n.page_size.toString()),n.search&&i.append("search",n.search),n.is_known!==void 0&&i.append("is_known",n.is_known.toString()),n.platform&&i.append("platform",n.platform);const r=await _e(`${ri}/list?${i}`,{headers:Es()});if(!r.ok){const d=await r.json();throw new Error(d.detail||"获取人物列表失败")}return r.json()}async function f2(n){const i=await _e(`${ri}/${n}`,{headers:Es()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取人物详情失败")}return i.json()}async function p2(n,i){const r=await _e(`${ri}/${n}`,{method:"PATCH",headers:Es(),body:JSON.stringify(i)});if(!r.ok){const d=await r.json();throw new Error(d.detail||"更新人物信息失败")}return r.json()}async function g2(n){const i=await _e(`${ri}/${n}`,{method:"DELETE",headers:Es()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除人物信息失败")}return i.json()}async function j2(){const n=await _e(`${ri}/stats/summary`,{headers:Es()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取统计数据失败")}return n.json()}async function v2(n){const i=await _e(`${ri}/batch/delete`,{method:"POST",headers:Es(),body:JSON.stringify({person_ids:n})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除失败")}return i.json()}function b2(){const[n,i]=u.useState([]),[r,d]=u.useState(!0),[m,x]=u.useState(0),[f,p]=u.useState(1),[g,N]=u.useState(20),[j,w]=u.useState(""),[y,T]=u.useState(void 0),[_,L]=u.useState(void 0),[D,U]=u.useState(null),[I,R]=u.useState(!1),[z,Y]=u.useState(!1),[Q,E]=u.useState(null),[M,te]=u.useState({total:0,known:0,unknown:0,platforms:{}}),[fe,je]=u.useState(new Set),[ve,ge]=u.useState(!1),[be,Se]=u.useState(""),{toast:O}=Rs(),F=async()=>{try{d(!0);const $=await h2({page:f,page_size:g,search:j||void 0,is_known:y,platform:_});i($.data),x($.total)}catch($){O({title:"加载失败",description:$ instanceof Error?$.message:"无法加载人物信息",variant:"destructive"})}finally{d(!1)}},q=async()=>{try{const $=await j2();$?.data&&te($.data)}catch($){console.error("加载统计数据失败:",$)}};u.useEffect(()=>{F(),q()},[f,g,j,y,_]);const se=async $=>{try{const Z=await f2($.person_id);U(Z.data),R(!0)}catch(Z){O({title:"加载详情失败",description:Z instanceof Error?Z.message:"无法加载人物详情",variant:"destructive"})}},v=$=>{U($),Y(!0)},K=async $=>{try{await g2($.person_id),O({title:"删除成功",description:`已删除人物信息: ${$.person_name||$.nickname||$.user_id}`}),E(null),F(),q()}catch(Z){O({title:"删除失败",description:Z instanceof Error?Z.message:"无法删除人物信息",variant:"destructive"})}},me=u.useMemo(()=>Object.keys(M.platforms),[M.platforms]),oe=$=>{const Z=new Set(fe);Z.has($)?Z.delete($):Z.add($),je(Z)},xe=()=>{fe.size===n.length&&n.length>0?je(new Set):je(new Set(n.map($=>$.person_id)))},ye=()=>{if(fe.size===0){O({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ge(!0)},de=async()=>{try{const $=await v2(Array.from(fe));O({title:"批量删除完成",description:$.message}),je(new Set),ge(!1),F(),q()}catch($){O({title:"批量删除失败",description:$ instanceof Error?$.message:"批量删除失败",variant:"destructive"})}},W=()=>{const $=parseInt(be),Z=Math.ceil(m/g);$>=1&&$<=Z?(p($),Se("")):O({title:"无效的页码",description:`请输入1-${Z}之间的页码`,variant:"destructive"})},ae=$=>$?new Date($*1e3).toLocaleString("zh-CN"):"-";return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Hu,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(Ke,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:M.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:M.known})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:M.unknown})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(k,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(Mt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:j,onChange:$=>w($.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(k,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Oe,{value:y===void 0?"all":y.toString(),onValueChange:$=>{T($==="all"?void 0:$==="true"),p(1)},children:[e.jsx(Ae,{id:"filter-known",className:"mt-1.5",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部"}),e.jsx(ne,{value:"true",children:"已认识"}),e.jsx(ne,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(k,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Oe,{value:_||"all",onValueChange:$=>{L($==="all"?void 0:$),p(1)},children:[e.jsx(Ae,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部平台"}),me.map($=>e.jsxs(ne,{value:$,children:[$," (",M.platforms[$],")"]},$))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:fe.size>0&&e.jsxs("span",{children:["已选择 ",fe.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Oe,{value:g.toString(),onValueChange:$=>{N(parseInt($)),p(1),je(new Set)},children:[e.jsx(Ae,{id:"page-size",className:"w-20",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"10",children:"10"}),e.jsx(ne,{value:"20",children:"20"}),e.jsx(ne,{value:"50",children:"50"}),e.jsx(ne,{value:"100",children:"100"})]})]}),fe.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>je(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:ye,children:[e.jsx(Je,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ct,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(ht,{checked:n.length>0&&fe.size===n.length,onCheckedChange:xe,"aria-label":"全选"})}),e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"昵称"}),e.jsx(Ye,{children:"平台"}),e.jsx(Ye,{children:"用户ID"}),e.jsx(Ye,{children:"最后更新"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:r?e.jsx(ct,{children:e.jsx(Ge,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):n.length===0?e.jsx(ct,{children:e.jsx(Ge,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):n.map($=>e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(ht,{checked:fe.has($.person_id),onCheckedChange:()=>oe($.person_id),"aria-label":`选择 ${$.person_name||$.nickname||$.user_id}`})}),e.jsx(Ge,{children:e.jsx("div",{className:G("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",$.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:$.is_known?"已认识":"未认识"})}),e.jsx(Ge,{className:"font-medium",children:$.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ge,{children:$.nickname||"-"}),e.jsx(Ge,{children:$.platform}),e.jsx(Ge,{className:"font-mono text-sm",children:$.user_id}),e.jsx(Ge,{className:"text-sm text-muted-foreground",children:ae($.last_know)}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>se($),children:[e.jsx(Ot,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(C,{variant:"default",size:"sm",onClick:()=>v($),children:[e.jsx(nn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(C,{size:"sm",onClick:()=>E($),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(Je,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},$.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):n.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):n.map($=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ht,{checked:fe.has($.person_id),onCheckedChange:()=>oe($.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:G("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",$.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:$.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:$.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),$.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",$.nickname]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),e.jsx("p",{className:"font-medium text-xs",children:$.platform})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),e.jsx("p",{className:"font-mono text-xs truncate",title:$.user_id,children:$.user_id})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),e.jsx("p",{className:"text-xs",children:ae($.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>se($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Ot,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>v($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(nn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>E($),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(Je,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},$.id))}),m>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",m," 条记录,第 ",f," / ",Math.ceil(m/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>p(f-1),disabled:f===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:be,onChange:$=>Se($.target.value),onKeyDown:$=>$.key==="Enter"&&W(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/g)}),e.jsx(C,{variant:"outline",size:"sm",onClick:W,disabled:!be,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>p(f+1),disabled:f>=Math.ceil(m/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(m/g)),disabled:f>=Math.ceil(m/g),className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(N2,{person:D,open:I,onOpenChange:R}),e.jsx(y2,{person:D,open:z,onOpenChange:Y,onSuccess:()=>{F(),q(),Y(!1)}}),e.jsx(us,{open:!!Q,onOpenChange:()=>E(null),children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认删除"}),e.jsxs(is,{children:['确定要删除人物信息 "',Q?.person_name||Q?.nickname||Q?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:()=>Q&&K(Q),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(us,{open:ve,onOpenChange:ge,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"确认批量删除"}),e.jsxs(is,{children:["确定要删除选中的 ",fe.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{children:"取消"}),e.jsx(rs,{onClick:de,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function N2({person:n,open:i,onOpenChange:r}){if(!n)return null;const d=m=>m?new Date(m*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(As,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"人物详情"}),e.jsxs(Js,{children:["查看 ",n.person_name||n.nickname||n.user_id," 的完整信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(al,{icon:Xc,label:"人物名称",value:n.person_name}),e.jsx(al,{icon:Ol,label:"昵称",value:n.nickname}),e.jsx(al,{icon:si,label:"用户ID",value:n.user_id,mono:!0}),e.jsx(al,{icon:si,label:"人物ID",value:n.person_id,mono:!0}),e.jsx(al,{label:"平台",value:n.platform}),e.jsx(al,{label:"状态",value:n.is_known?"已认识":"未认识"})]}),n.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(k,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:n.name_reason})]}),n.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(k,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:n.memory_points})]}),n.group_nick_name&&n.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(k,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:n.group_nick_name.map((m,x)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:m.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:m.group_nick_name})]},x))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(al,{icon:Zn,label:"认识时间",value:d(n.know_times)}),e.jsx(al,{icon:Zn,label:"首次记录",value:d(n.know_since)}),e.jsx(al,{icon:Zn,label:"最后更新",value:d(n.last_know)})]})]}),e.jsx(at,{children:e.jsx(C,{onClick:()=>r(!1),children:"关闭"})})]})})}function al({icon:n,label:i,value:r,mono:d=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(k,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n&&e.jsx(n,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:G("text-sm",d&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function y2({person:n,open:i,onOpenChange:r,onSuccess:d}){const[m,x]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=Rs();u.useEffect(()=>{n&&x({person_name:n.person_name||"",name_reason:n.name_reason||"",nickname:n.nickname||"",memory_points:n.memory_points||"",is_known:n.is_known})},[n]);const N=async()=>{if(n)try{p(!0),await p2(n.person_id,m),g({title:"保存成功",description:"人物信息已更新"}),d()}catch(j){g({title:"保存失败",description:j instanceof Error?j.message:"无法更新人物信息",variant:"destructive"})}finally{p(!1)}};return n?e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(As,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"编辑人物信息"}),e.jsxs(Js,{children:["修改 ",n.person_name||n.nickname||n.user_id," 的信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"person_name",children:"人物名称"}),e.jsx(re,{id:"person_name",value:m.person_name||"",onChange:j=>x({...m,person_name:j.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"nickname",children:"昵称"}),e.jsx(re,{id:"nickname",value:m.nickname||"",onChange:j=>x({...m,nickname:j.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(Ms,{id:"name_reason",value:m.name_reason||"",onChange:j=>x({...m,name_reason:j.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"memory_points",children:"个人印象"}),e.jsx(Ms,{id:"memory_points",value:m.memory_points||"",onChange:j=>x({...m,memory_points:j.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(k,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx(Be,{id:"is_known",checked:m.is_known,onCheckedChange:j=>x({...m,is_known:j})})]})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(C,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}var w2=s0();const yp=Xb(w2),tm="/api/webui";async function _2(n=100,i="all"){const r=`${tm}/knowledge/graph?limit=${n}&node_type=${i}`,d=await fetch(r);if(!d.ok)throw new Error(`获取知识图谱失败: ${d.status}`);return d.json()}async function S2(){const n=await fetch(`${tm}/knowledge/stats`);if(!n.ok)throw new Error("获取知识图谱统计信息失败");return n.json()}async function C2(n){const i=await fetch(`${tm}/knowledge/search?query=${encodeURIComponent(n)}`);if(!i.ok)throw new Error("搜索知识节点失败");return i.json()}const Jg=u.memo(({data:n})=>e.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[e.jsx(Kc,{type:"target",position:Jc.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:n.content,children:n.label}),e.jsx(Kc,{type:"source",position:Jc.Bottom})]}));Jg.displayName="EntityNode";const Pg=u.memo(({data:n})=>e.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[e.jsx(Kc,{type:"target",position:Jc.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:n.content,children:n.label}),e.jsx(Kc,{type:"source",position:Jc.Bottom})]}));Pg.displayName="ParagraphNode";const k2={entity:Jg,paragraph:Pg};function T2(n,i){const r=new yp.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const d=[],m=[];return n.forEach(x=>{r.setNode(x.id,{width:150,height:50})}),i.forEach(x=>{r.setEdge(x.source,x.target)}),yp.layout(r),n.forEach(x=>{const f=r.node(x.id);d.push({id:x.id,type:x.type,position:{x:f.x-75,y:f.y-25},data:{label:x.content.slice(0,20)+(x.content.length>20?"...":""),content:x.content}})}),i.forEach((x,f)=>{const p={id:`edge-${f}`,source:x.source,target:x.target,animated:n.length<=200&&x.weight>5,style:{strokeWidth:Math.min(x.weight/2,5),opacity:.6}};x.weight>10&&n.length<100&&(p.label=`${x.weight.toFixed(0)}`),m.push(p)}),{nodes:d,edges:m}}function E2(){const n=ga(),[i,r]=u.useState(!1),[d,m]=u.useState(null),[x,f]=u.useState(""),[p,g]=u.useState("all"),[N,j]=u.useState(50),[w,y]=u.useState("50"),[T,_]=u.useState(!1),[L,D]=u.useState(!0),[U,I]=u.useState(!1),[R,z]=u.useState(!1),[Y,Q,E]=t0([]),[M,te,fe]=a0([]),[je,ve]=u.useState(0),[ge,be]=u.useState(null),[Se,O]=u.useState(null),{toast:F}=Rs(),q=u.useCallback(de=>de.type==="entity"?"#6366f1":de.type==="paragraph"?"#10b981":"#6b7280",[]),se=u.useCallback(async(de=!1)=>{try{if(!de&&N>200){z(!0);return}r(!0);const[W,ae]=await Promise.all([_2(N,p),S2()]);if(m(ae),W.nodes.length===0){F({title:"提示",description:"知识库为空,请先导入知识数据"}),Q([]),te([]);return}const{nodes:$,edges:Z}=T2(W.nodes,W.edges);Q($),te(Z),ve($.length),ae&&ae.total_nodes>N&&F({title:"提示",description:`知识图谱包含 ${ae.total_nodes} 个节点,当前显示 ${$.length} 个`}),F({title:"加载成功",description:`已加载 ${$.length} 个节点,${Z.length} 条边`})}catch(W){console.error("加载知识图谱失败:",W),F({title:"加载失败",description:W instanceof Error?W.message:"未知错误",variant:"destructive"})}finally{r(!1)}},[N,p,F]),v=u.useCallback(async()=>{if(!x.trim()){F({title:"提示",description:"请输入搜索关键词"});return}try{const de=await C2(x);if(de.length===0){F({title:"未找到",description:"没有找到匹配的节点"});return}const W=new Set(de.map(ae=>ae.id));Q(ae=>ae.map($=>({...$,style:{...$.style,opacity:W.has($.id)?1:.3,filter:W.has($.id)?"brightness(1.2)":"brightness(0.8)"}}))),F({title:"搜索完成",description:`找到 ${de.length} 个匹配节点`})}catch(de){console.error("搜索失败:",de),F({title:"搜索失败",description:de instanceof Error?de.message:"未知错误",variant:"destructive"})}},[x,F]),K=u.useCallback(()=>{Q(de=>de.map(W=>({...W,style:{...W.style,opacity:1,filter:"brightness(1)"}})))},[]),me=u.useCallback(()=>{D(!1),I(!0),se()},[se]),oe=u.useCallback(()=>{z(!1),setTimeout(()=>{se(!0)},0)},[se]),xe=u.useCallback((de,W)=>{Y.find($=>$.id===W.id)&&be({id:W.id,type:W.type,content:W.data.content})},[Y]);u.useEffect(()=>{L||U&&se()},[N,p,L,U]);const ye=u.useCallback((de,W)=>{const ae=Y.find(ke=>ke.id===W.source),$=Y.find(ke=>ke.id===W.target),Z=M.find(ke=>ke.id===W.id);ae&&$&&Z&&O({source:{id:ae.id,type:ae.type,content:ae.data.content},target:{id:$.id,type:$.type,content:$.data.content},edge:{source:W.source,target:W.target,weight:parseFloat(W.label||"0")}})},[Y,M]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),d&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Fe,{variant:"outline",className:"gap-1",children:[e.jsx(Ic,{className:"h-3 w-3"}),"节点: ",d.total_nodes]}),e.jsxs(Fe,{variant:"outline",className:"gap-1",children:[e.jsx(yg,{className:"h-3 w-3"}),"边: ",d.total_edges]}),e.jsxs(Fe,{variant:"outline",className:"gap-1",children:[e.jsx(Ra,{className:"h-3 w-3"}),"实体: ",d.entity_nodes]}),e.jsxs(Fe,{variant:"outline",className:"gap-1",children:[e.jsx(Sa,{className:"h-3 w-3"}),"段落: ",d.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(re,{placeholder:"搜索节点内容...",value:x,onChange:de=>f(de.target.value),onKeyDown:de=>de.key==="Enter"&&v(),className:"flex-1"}),e.jsx(C,{onClick:v,size:"sm",children:e.jsx(Mt,{className:"h-4 w-4"})}),e.jsx(C,{onClick:K,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Oe,{value:p,onValueChange:de=>g(de),children:[e.jsx(Ae,{className:"w-[120px]",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部节点"}),e.jsx(ne,{value:"entity",children:"仅实体"}),e.jsx(ne,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Oe,{value:N===1e4?"all":T?"custom":N.toString(),onValueChange:de=>{de==="custom"?(_(!0),y(N.toString())):de==="all"?(_(!1),j(1e4)):(_(!1),j(Number(de)))},children:[e.jsx(Ae,{className:"w-[120px]",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ne,{value:"50",children:"50 节点"}),e.jsx(ne,{value:"100",children:"100 节点"}),e.jsx(ne,{value:"200",children:"200 节点"}),e.jsx(ne,{value:"500",children:"500 节点"}),e.jsx(ne,{value:"1000",children:"1000 节点"}),e.jsx(ne,{value:"all",children:"全部 (最多10000)"}),e.jsx(ne,{value:"custom",children:"自定义..."})]})]}),T&&e.jsx(re,{type:"number",min:"50",value:w,onChange:de=>y(de.target.value),onBlur:()=>{const de=parseInt(w);!isNaN(de)&&de>=50?j(de):(y("50"),j(50))},onKeyDown:de=>{if(de.key==="Enter"){const W=parseInt(w);!isNaN(W)&&W>=50?j(W):(y("50"),j(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(C,{onClick:()=>se(),variant:"outline",size:"sm",disabled:i,children:e.jsx(Tt,{className:G("h-4 w-4",i&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:i?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Tt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):Y.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Ic,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),e.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):e.jsxs(l0,{nodes:Y,edges:M,onNodesChange:E,onEdgesChange:fe,onNodeClick:xe,onEdgeClick:ye,nodeTypes:k2,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:je<=500,nodesDraggable:je<=1e3,attributionPosition:"bottom-left",children:[e.jsx(n0,{variant:i0.Dots,gap:12,size:1}),e.jsx(r0,{}),je<=500&&e.jsx(c0,{nodeColor:q,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(o0,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[e.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),e.jsx("span",{children:"实体节点"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),e.jsx("span",{children:"段落节点"})]}),je>200&&e.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[e.jsx("div",{className:"font-semibold",children:"性能模式"}),e.jsx("div",{children:"已禁用动画"}),je>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Hs,{open:!!ge,onOpenChange:de=>!de&&be(null),children:e.jsxs(As,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Ds,{children:e.jsx(Os,{children:"节点详情"})}),ge&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),e.jsx("div",{className:"mt-1",children:e.jsx(Fe,{variant:ge.type==="entity"?"default":"secondary",children:ge.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),e.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ge.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(Ke,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ge.content})})]})]})]})}),e.jsx(Hs,{open:!!Se,onOpenChange:de=>!de&&O(null),children:e.jsxs(As,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Ds,{children:e.jsx(Os,{children:"边详情"})}),Se&&e.jsx(Ke,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:Se.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Se.source.id.slice(0,40),"..."]})]}),e.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:Se.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Se.target.id.slice(0,40),"..."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),e.jsx("div",{className:"mt-1",children:e.jsx(Fe,{variant:"outline",className:"text-base font-mono",children:Se.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(us,{open:L,onOpenChange:D,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"加载知识图谱"}),e.jsxs(is,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(ls,{children:[e.jsx(cs,{onClick:()=>n({to:"/"}),children:"取消 (返回首页)"}),e.jsx(rs,{onClick:me,children:"确认加载"})]})]})}),e.jsx(us,{open:R,onOpenChange:z,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ns,{children:"⚠️ 节点数量较多"}),e.jsx(is,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["您正在尝试加载 ",e.jsx("strong",{className:"text-orange-600",children:N>=1e4?"全部 (最多10000个)":N})," 个节点。"]}),e.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),e.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[e.jsx("li",{children:"页面加载时间较长"}),e.jsx("li",{children:"浏览器卡顿或崩溃"}),e.jsx("li",{children:"系统资源占用过高"})]}),e.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),e.jsxs(ls,{children:[e.jsx(cs,{onClick:()=>{z(!1),N>200&&(j(50),_(!1))},children:"取消"}),e.jsx(rs,{onClick:oe,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function wp({className:n,classNames:i,showOutsideDays:r=!0,captionLayout:d="label",buttonVariant:m="ghost",formatters:x,components:f,...p}){const g=kg();return e.jsx(Uy,{showOutsideDays:r,className:G("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,n),captionLayout:d,formatters:{formatMonthDropdown:N=>N.toLocaleString("default",{month:"short"}),...x},classNames:{root:G("w-fit",g.root),months:G("relative flex flex-col gap-4 md:flex-row",g.months),month:G("flex w-full flex-col gap-4",g.month),nav:G("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",g.nav),button_previous:G(xr({variant:m}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",g.button_previous),button_next:G(xr({variant:m}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",g.button_next),month_caption:G("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",g.month_caption),dropdowns:G("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",g.dropdowns),dropdown_root:G("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",g.dropdown_root),dropdown:G("bg-popover absolute inset-0 opacity-0",g.dropdown),caption_label:G("select-none font-medium",d==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",g.caption_label),table:"w-full border-collapse",weekdays:G("flex",g.weekdays),weekday:G("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",g.weekday),week:G("mt-2 flex w-full",g.week),week_number_header:G("w-[--cell-size] select-none",g.week_number_header),week_number:G("text-muted-foreground select-none text-[0.8rem]",g.week_number),day:G("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",g.day),range_start:G("bg-accent rounded-l-md",g.range_start),range_middle:G("rounded-none",g.range_middle),range_end:G("bg-accent rounded-r-md",g.range_end),today:G("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",g.today),outside:G("text-muted-foreground aria-selected:text-muted-foreground",g.outside),disabled:G("text-muted-foreground opacity-50",g.disabled),hidden:G("invisible",g.hidden),...i},components:{Root:({className:N,rootRef:j,...w})=>e.jsx("div",{"data-slot":"calendar",ref:j,className:G(N),...w}),Chevron:({className:N,orientation:j,...w})=>j==="left"?e.jsx(rl,{className:G("size-4",N),...w}):j==="right"?e.jsx(Ba,{className:G("size-4",N),...w}):e.jsx(Rl,{className:G("size-4",N),...w}),DayButton:z2,WeekNumber:({children:N,...j})=>e.jsx("td",{...j,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:N})}),...f},...p})}function z2({className:n,day:i,modifiers:r,...d}){const m=kg(),x=u.useRef(null);return u.useEffect(()=>{r.focused&&x.current?.focus()},[r.focused]),e.jsx(C,{ref:x,variant:"ghost",size:"icon","data-day":i.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:G("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",m.day,n),...d})}const M2={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},A2=(n,i,r)=>{let d;const m=M2[n];return typeof m=="string"?d=m:i===1?d=m.one:d=m.other.replace("{{count}}",String(i)),r?.addSuffix?r.comparison&&r.comparison>0?d+"内":d+"前":d},D2={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},O2={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},R2={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},L2={date:bu({formats:D2,defaultWidth:"full"}),time:bu({formats:O2,defaultWidth:"full"}),dateTime:bu({formats:R2,defaultWidth:"full"})};function _p(n,i,r){const d="eeee p";return Pb(n,i,r)?d:n.getTime()>i.getTime()?"'下个'"+d:"'上个'"+d}const U2={lastWeek:_p,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:_p,other:"PP p"},B2=(n,i,r,d)=>{const m=U2[n];return typeof m=="function"?m(i,r,d):m},H2={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},q2={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},G2={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},F2={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},V2={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},$2={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},Q2=(n,i)=>{const r=Number(n);switch(i?.unit){case"date":return r.toString()+"日";case"hour":return r.toString()+"时";case"minute":return r.toString()+"分";case"second":return r.toString()+"秒";default:return"第 "+r.toString()}},I2={ordinalNumber:Q2,era:Zi({values:H2,defaultWidth:"wide"}),quarter:Zi({values:q2,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Zi({values:G2,defaultWidth:"wide"}),day:Zi({values:F2,defaultWidth:"wide"}),dayPeriod:Zi({values:V2,defaultWidth:"wide",formattingValues:$2,defaultFormattingWidth:"wide"})},Y2=/^(第\s*)?\d+(日|时|分|秒)?/i,X2=/\d+/i,K2={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},J2={any:[/^(前)/i,/^(公元)/i]},P2={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},Z2={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},W2={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},e_={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},s_={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},t_={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},a_={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},l_={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},n_={ordinalNumber:Zb({matchPattern:Y2,parsePattern:X2,valueCallback:n=>parseInt(n,10)}),era:Wi({matchPatterns:K2,defaultMatchWidth:"wide",parsePatterns:J2,defaultParseWidth:"any"}),quarter:Wi({matchPatterns:P2,defaultMatchWidth:"wide",parsePatterns:Z2,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Wi({matchPatterns:W2,defaultMatchWidth:"wide",parsePatterns:e_,defaultParseWidth:"any"}),day:Wi({matchPatterns:s_,defaultMatchWidth:"wide",parsePatterns:t_,defaultParseWidth:"any"}),dayPeriod:Wi({matchPatterns:a_,defaultMatchWidth:"any",parsePatterns:l_,defaultParseWidth:"any"})},Bc={code:"zh-CN",formatDistance:A2,formatLong:L2,formatRelative:B2,localize:I2,match:n_,options:{weekStartsOn:1,firstWeekContainsDate:4}},Hc={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function i_(){const[n,i]=u.useState([]),[r,d]=u.useState(""),[m,x]=u.useState("all"),[f,p]=u.useState("all"),[g,N]=u.useState(void 0),[j,w]=u.useState(void 0),[y,T]=u.useState(!0),[_,L]=u.useState(!1),[D,U]=u.useState("xs"),[I,R]=u.useState(4),z=u.useRef(null);u.useEffect(()=>{const q=sn.getAllLogs();i(q);const se=sn.onLog(()=>{i(sn.getAllLogs())}),v=sn.onConnectionChange(K=>{L(K)});return()=>{se(),v()}},[]);const Y=u.useMemo(()=>{const q=new Set(n.map(se=>se.module).filter(se=>se&&se.trim()!==""));return Array.from(q).sort()},[n]),Q=q=>{switch(q){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},E=q=>{switch(q){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},M=()=>{window.location.reload()},te=()=>{sn.clearLogs(),i([])},fe=()=>{const q=ge.map(me=>`${me.timestamp} [${me.level.padEnd(8)}] [${me.module}] ${me.message}`).join(` -`),se=new Blob([q],{type:"text/plain;charset=utf-8"}),v=URL.createObjectURL(se),K=document.createElement("a");K.href=v,K.download=`logs-${Nu(new Date,"yyyy-MM-dd-HHmmss")}.txt`,K.click(),URL.revokeObjectURL(v)},je=()=>{T(!y)},ve=()=>{N(void 0),w(void 0)},ge=u.useMemo(()=>n.filter(q=>{const se=r===""||q.message.toLowerCase().includes(r.toLowerCase())||q.module.toLowerCase().includes(r.toLowerCase()),v=m==="all"||q.level===m,K=f==="all"||q.module===f;let me=!0;if(g||j){const oe=new Date(q.timestamp);if(g){const xe=new Date(g);xe.setHours(0,0,0,0),me=me&&oe>=xe}if(j){const xe=new Date(j);xe.setHours(23,59,59,999),me=me&&oe<=xe}}return se&&v&&K&&me}),[n,r,m,f,g,j]),be=Hc[D].rowHeight+I,Se=qb({count:ge.length,getScrollElement:()=>z.current,estimateSize:()=>be,overscan:50}),O=u.useRef(!1),F=u.useRef(ge.length);return u.useEffect(()=>{const q=z.current;if(!q)return;const se=()=>{if(O.current)return;const{scrollTop:v,scrollHeight:K,clientHeight:me}=q,oe=K-v-me;oe>100&&y?T(!1):oe<50&&!y&&T(!0)};return q.addEventListener("scroll",se,{passive:!0}),()=>q.removeEventListener("scroll",se)},[y]),u.useEffect(()=>{const q=ge.length>F.current;F.current=ge.length,y&&ge.length>0&&q&&(O.current=!0,Se.scrollToIndex(ge.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{O.current=!1})}))},[ge.length,y,Se]),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:G("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",_?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:_?"已连接":"未连接"})]})]}),e.jsx($e,{className:"p-3 sm:p-4",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索日志...",value:r,onChange:q=>d(q.target.value),className:"pl-9 h-9 text-sm"})]}),e.jsxs(Oe,{value:m,onValueChange:x,children:[e.jsxs(Ae,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[e.jsx(Uu,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{placeholder:"级别"})]}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部级别"}),e.jsx(ne,{value:"DEBUG",children:"DEBUG"}),e.jsx(ne,{value:"INFO",children:"INFO"}),e.jsx(ne,{value:"WARNING",children:"WARNING"}),e.jsx(ne,{value:"ERROR",children:"ERROR"}),e.jsx(ne,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Oe,{value:f,onValueChange:p,children:[e.jsxs(Ae,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[e.jsx(Uu,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{placeholder:"模块"})]}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部模块"}),Y.map(q=>e.jsx(ne,{value:q,children:q},q))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:G("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!g&&"text-muted-foreground"),children:[e.jsx(ep,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:g?Nu(g,"PPP",{locale:Bc}):"开始日期"})]})}),e.jsx(Ta,{className:"w-auto p-0",align:"start",children:e.jsx(wp,{mode:"single",selected:g,onSelect:N,initialFocus:!0,locale:Bc})})]}),e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:G("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!j&&"text-muted-foreground"),children:[e.jsx(ep,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:j?Nu(j,"PPP",{locale:Bc}):"结束日期"})]})}),e.jsx(Ta,{className:"w-auto p-0",align:"start",children:e.jsx(wp,{mode:"single",selected:j,onSelect:w,initialFocus:!0,locale:Bc})})]}),(g||j)&&e.jsxs(C,{variant:"outline",size:"sm",onClick:ve,className:"w-full sm:w-auto h-9",children:[e.jsx(il,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),e.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(C,{variant:y?"default":"outline",size:"sm",onClick:je,className:"flex-1 sm:flex-none h-9",children:[y?e.jsx(py,{className:"h-4 w-4"}):e.jsx(gy,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:y?"自动滚动":"已暂停"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:M,className:"flex-1 sm:flex-none h-9",children:[e.jsx(Tt,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:te,className:"flex-1 sm:flex-none h-9",children:[e.jsx(Je,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:fe,className:"flex-1 sm:flex-none h-9",children:[e.jsx(nl,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),e.jsx("div",{className:"flex-1 hidden sm:block"}),e.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[e.jsxs("span",{className:"font-mono",children:[ge.length," / ",n.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(jy,{className:"h-4 w-4"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Hc).map(q=>e.jsx(C,{variant:D===q?"default":"outline",size:"sm",onClick:()=>U(q),className:"h-7 px-3 text-xs",children:Hc[q].label},q))})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[e.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),e.jsx(ha,{value:[I],onValueChange:([q])=>R(q),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[I,"px"]})]})]})]})})]}),e.jsx("div",{className:"flex-1 min-h-0 px-3 sm:px-4 lg:px-6 pb-3 sm:pb-4 lg:pb-6",children:e.jsx($e,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:z,className:G("h-full overflow-auto","[&::-webkit-scrollbar]:w-2.5","[&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb:hover]:bg-border/80"),children:e.jsx("div",{className:G("p-2 sm:p-3 font-mono relative",Hc[D].class),style:{height:`${Se.getTotalSize()}px`},children:ge.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):Se.getVirtualItems().map(q=>{const se=ge[q.index];return e.jsxs("div",{"data-index":q.index,ref:Se.measureElement,className:G("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",E(se.level)),style:{transform:`translateY(${q.start}px)`,paddingTop:`${I/2}px`,paddingBottom:`${I/2}px`},children:[e.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:se.timestamp}),e.jsxs("span",{className:G("font-semibold",Q(se.level)),children:["[",se.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:se.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:se.message})]}),e.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:se.timestamp}),e.jsxs("span",{className:G("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",Q(se.level)),children:["[",se.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:se.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:se.message})]})]},q.key)})})})})})]})}const r_="Mai-with-u",c_="plugin-repo",o_="main",d_="plugin_details.json";async function u_(){try{const n=await _e("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:r_,repo:c_,branch:o_,file_path:d_})});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const i=await n.json();if(!i.success||!i.data)throw new Error(i.error||"获取插件列表失败");return JSON.parse(i.data).filter(m=>!m?.id||!m?.manifest?(console.warn("跳过无效插件数据:",m),!1):!m.manifest.name||!m.manifest.version?(console.warn("跳过缺少必需字段的插件:",m.id),!1):!0).map(m=>({id:m.id,manifest:{manifest_version:m.manifest.manifest_version||1,name:m.manifest.name,version:m.manifest.version,description:m.manifest.description||"",author:m.manifest.author||{name:"Unknown"},license:m.manifest.license||"Unknown",host_application:m.manifest.host_application||{min_version:"0.0.0"},homepage_url:m.manifest.homepage_url,repository_url:m.manifest.repository_url,keywords:m.manifest.keywords||[],categories:m.manifest.categories||[],default_locale:m.manifest.default_locale||"zh-CN",locales_path:m.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(n){throw console.error("Failed to fetch plugin list:",n),n}}async function m_(){try{const n=await _e("/api/webui/plugins/git-status");if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return await n.json()}catch(n){return console.error("Failed to check Git status:",n),{installed:!1,error:"无法检测 Git 安装状态"}}}async function x_(){try{const n=await _e("/api/webui/plugins/version");if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return await n.json()}catch(n){return console.error("Failed to get Maimai version:",n),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function h_(n,i,r){const d=n.split(".").map(p=>parseInt(p)||0),m=d[0]||0,x=d[1]||0,f=d[2]||0;if(r.version_majorparseInt(w)||0),g=p[0]||0,N=p[1]||0,j=p[2]||0;if(r.version_major>g||r.version_major===g&&r.version_minor>N||r.version_major===g&&r.version_minor===N&&r.version_patch>j)return!1}return!0}function f_(n,i){const r=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,m=new WebSocket(`${r}//${d}/api/webui/ws/plugin-progress`);return m.onopen=()=>{console.log("Plugin progress WebSocket connected");const x=setInterval(()=>{m.readyState===WebSocket.OPEN?m.send("ping"):clearInterval(x)},3e4)},m.onmessage=x=>{try{if(x.data==="pong")return;const f=JSON.parse(x.data);n(f)}catch(f){console.error("Failed to parse progress data:",f)}},m.onerror=x=>{console.error("Plugin progress WebSocket error:",x),i?.(x)},m.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},m}async function ir(){try{const n=await _e("/api/webui/plugins/installed",{headers:Es()});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const i=await n.json();if(!i.success)throw new Error(i.message||"获取已安装插件列表失败");return i.plugins||[]}catch(n){return console.error("Failed to get installed plugins:",n),[]}}function qc(n,i){return i.some(r=>r.id===n)}function Gc(n,i){const r=i.find(d=>d.id===n);if(r)return r.manifest?.version||r.version}async function p_(n,i,r="main"){const d=await _e("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:n,repository_url:i,branch:r})});if(!d.ok){const m=await d.json();throw new Error(m.detail||"安装失败")}return await d.json()}async function g_(n){const i=await _e("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:n})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"卸载失败")}return await i.json()}async function j_(n,i,r="main"){const d=await _e("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:n,repository_url:i,branch:r})});if(!d.ok){const m=await d.json();throw new Error(m.detail||"更新失败")}return await d.json()}async function v_(n){const i=await _e(`/api/webui/plugins/config/${n}/schema`,{headers:Es()});if(!i.ok){const d=await i.json();throw new Error(d.detail||"获取配置 Schema 失败")}const r=await i.json();if(!r.success)throw new Error(r.message||"获取配置 Schema 失败");return r.schema}async function b_(n){const i=await _e(`/api/webui/plugins/config/${n}`,{headers:Es()});if(!i.ok){const d=await i.json();throw new Error(d.detail||"获取配置失败")}const r=await i.json();if(!r.success)throw new Error(r.message||"获取配置失败");return r.config}async function N_(n,i){const r=await _e(`/api/webui/plugins/config/${n}`,{method:"PUT",body:JSON.stringify({config:i})});if(!r.ok){const d=await r.json();throw new Error(d.detail||"保存配置失败")}return await r.json()}async function y_(n){const i=await _e(`/api/webui/plugins/config/${n}/reset`,{method:"POST",headers:Es()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"重置配置失败")}return await i.json()}async function w_(n){const i=await _e(`/api/webui/plugins/config/${n}/toggle`,{method:"POST",headers:Es()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"切换状态失败")}return await i.json()}const vr="https://maibot-plugin-stats.maibot-webui.workers.dev";async function Zg(n){try{const i=await fetch(`${vr}/stats/${n}`);return i.ok?await i.json():(console.error("Failed to fetch plugin stats:",i.statusText),null)}catch(i){return console.error("Error fetching plugin stats:",i),null}}async function __(n,i){try{const r=i||am(),d=await fetch(`${vr}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n,user_id:r})}),m=await d.json();return d.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:d.ok?{success:!0,...m}:{success:!1,error:m.error||"点赞失败"}}catch(r){return console.error("Error liking plugin:",r),{success:!1,error:"网络错误"}}}async function S_(n,i){try{const r=i||am(),d=await fetch(`${vr}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n,user_id:r})}),m=await d.json();return d.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:d.ok?{success:!0,...m}:{success:!1,error:m.error||"点踩失败"}}catch(r){return console.error("Error disliking plugin:",r),{success:!1,error:"网络错误"}}}async function C_(n,i,r,d){if(i<1||i>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const m=d||am(),x=await fetch(`${vr}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n,rating:i,comment:r,user_id:m})}),f=await x.json();return x.status===429?{success:!1,error:"每天最多评分 3 次"}:x.ok?{success:!0,...f}:{success:!1,error:f.error||"评分失败"}}catch(m){return console.error("Error rating plugin:",m),{success:!1,error:"网络错误"}}}async function k_(n){try{const i=await fetch(`${vr}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n})}),r=await i.json();return i.status===429?(console.warn("Download recording rate limited"),{success:!0}):i.ok?{success:!0,...r}:(console.error("Failed to record download:",r.error),{success:!1,error:r.error})}catch(i){return console.error("Error recording download:",i),{success:!1,error:"网络错误"}}}function T_(){const n=navigator,i=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,n.deviceMemory||0].join("|");let r=0;for(let d=0;d{x(!0);const U=await Zg(n);U&&d(U),x(!1)};u.useEffect(()=>{T()},[n]);const _=async()=>{const U=await __(n);U.success?(y({title:"已点赞",description:"感谢你的支持!"}),T()):y({title:"点赞失败",description:U.error||"未知错误",variant:"destructive"})},L=async()=>{const U=await S_(n);U.success?(y({title:"已反馈",description:"感谢你的反馈!"}),T()):y({title:"操作失败",description:U.error||"未知错误",variant:"destructive"})},D=async()=>{if(f===0){y({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const U=await C_(n,f,g||void 0);U.success?(y({title:"评分成功",description:"感谢你的评价!"}),w(!1),p(0),N(""),T()):y({title:"评分失败",description:U.error||"未知错误",variant:"destructive"})};return m?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nl,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ll,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):r?i?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${r.downloads.toLocaleString()}`,children:[e.jsx(nl,{className:"h-4 w-4"}),e.jsx("span",{children:r.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${r.rating.toFixed(1)} (${r.rating_count} 条评价)`,children:[e.jsx(ll,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:r.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${r.likes}`,children:[e.jsx(wu,{className:"h-4 w-4"}),e.jsx("span",{children:r.likes})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(nl,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.downloads.toLocaleString()}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(ll,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:r.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.rating_count," 条评价"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(wu,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.likes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(sp,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.dislikes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:_,children:[e.jsx(wu,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:L,children:[e.jsx(sp,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Hs,{open:j,onOpenChange:w,children:[e.jsx(Zu,{asChild:!0,children:e.jsxs(C,{variant:"default",size:"sm",children:[e.jsx(ll,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(As,{children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"为插件评分"}),e.jsx(Js,{children:"分享你的使用体验,帮助其他用户"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(U=>e.jsx("button",{onClick:()=>p(U),className:"focus:outline-none",children:e.jsx(ll,{className:`h-8 w-8 transition-colors ${U<=f?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},U))}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[f===0&&"点击星星进行评分",f===1&&"很差",f===2&&"一般",f===3&&"还行",f===4&&"不错",f===5&&"非常好"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),e.jsx(Ms,{value:g,onChange:U=>N(U.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[g.length," / 500"]})]})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>w(!1),children:"取消"}),e.jsx(C,{onClick:D,disabled:f===0,children:"提交评分"})]})]})]})]}),r.recent_ratings&&r.recent_ratings.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),e.jsx("div",{className:"space-y-3",children:r.recent_ratings.map((U,I)=>e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(R=>e.jsx(ll,{className:`h-3 w-3 ${R<=U.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},R))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(U.created_at).toLocaleDateString()})]}),U.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:U.comment})]},I))})]})]}):null}const Sp={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function z_(){const n=ga(),[i,r]=u.useState(null),[d,m]=u.useState(""),[x,f]=u.useState("all"),[p,g]=u.useState("all"),[N,j]=u.useState(!0),[w,y]=u.useState([]),[T,_]=u.useState(!0),[L,D]=u.useState(null),[U,I]=u.useState(null),[R,z]=u.useState(null),[Y,Q]=u.useState(null),[,E]=u.useState([]),[M,te]=u.useState({}),{toast:fe}=Rs(),je=async v=>{const K=v.map(async xe=>{try{const ye=await Zg(xe.id);return{id:xe.id,stats:ye}}catch(ye){return console.warn(`Failed to load stats for ${xe.id}:`,ye),{id:xe.id,stats:null}}}),me=await Promise.all(K),oe={};me.forEach(({id:xe,stats:ye})=>{ye&&(oe[xe]=ye)}),te(oe)};u.useEffect(()=>{let v=null,K=!1;return(async()=>{if(v=f_(oe=>{K||(z(oe),oe.stage==="success"?setTimeout(()=>{K||z(null)},2e3):oe.stage==="error"&&(_(!1),D(oe.error||"加载失败")))},oe=>{console.error("WebSocket error:",oe),K||fe({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(oe=>{if(!v){oe();return}const xe=()=>{v&&v.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),oe()):v&&v.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),oe()):setTimeout(xe,100)};xe()}),!K){const oe=await m_();I(oe),oe.installed||fe({title:"Git 未安装",description:oe.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!K){const oe=await x_();Q(oe)}if(!K)try{_(!0),D(null);const oe=await u_();if(!K){const xe=await ir();E(xe);const ye=oe.map(de=>{const W=qc(de.id,xe),ae=Gc(de.id,xe);return{...de,installed:W,installed_version:ae}});for(const de of xe)!ye.some(ae=>ae.id===de.id)&&de.manifest&&ye.push({id:de.id,manifest:{manifest_version:de.manifest.manifest_version||1,name:de.manifest.name,version:de.manifest.version,description:de.manifest.description||"",author:de.manifest.author,license:de.manifest.license||"Unknown",host_application:de.manifest.host_application,homepage_url:de.manifest.homepage_url,repository_url:de.manifest.repository_url,keywords:de.manifest.keywords||[],categories:de.manifest.categories||[],default_locale:de.manifest.default_locale||"zh-CN",locales_path:de.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:de.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});y(ye),je(ye)}}catch(oe){if(!K){const xe=oe instanceof Error?oe.message:"加载插件列表失败";D(xe),fe({title:"加载失败",description:xe,variant:"destructive"})}}finally{K||_(!1)}})(),()=>{K=!0,v&&v.close()}},[fe]);const ve=v=>{if(!v.installed&&Y&&!ge(v))return e.jsxs(Fe,{variant:"destructive",className:"gap-1",children:[e.jsx(zt,{className:"h-3 w-3"}),"不兼容"]});if(v.installed){const K=v.installed_version?.trim(),me=v.manifest.version?.trim();if(K!==me){const oe=K?.split(".").map(Number)||[0,0,0],xe=me?.split(".").map(Number)||[0,0,0];for(let ye=0;ye<3;ye++){if((xe[ye]||0)>(oe[ye]||0))return e.jsxs(Fe,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(zt,{className:"h-3 w-3"}),"可更新"]});if((xe[ye]||0)<(oe[ye]||0))break}}return e.jsxs(Fe,{variant:"default",className:"gap-1",children:[e.jsx(ta,{className:"h-3 w-3"}),"已安装"]})}return null},ge=v=>!Y||!v.manifest?.host_application?!0:h_(v.manifest.host_application.min_version,v.manifest.host_application.max_version,Y),be=v=>{if(!v.installed||!v.installed_version||!v.manifest?.version)return!1;const K=v.installed_version.trim(),me=v.manifest.version.trim();if(K===me)return!1;const oe=K.split(".").map(Number),xe=me.split(".").map(Number);for(let ye=0;ye<3;ye++){if((xe[ye]||0)>(oe[ye]||0))return!0;if((xe[ye]||0)<(oe[ye]||0))return!1}return!1},Se=w.filter(v=>{if(!v.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",v.id),!1;const K=d===""||v.manifest.name?.toLowerCase().includes(d.toLowerCase())||v.manifest.description?.toLowerCase().includes(d.toLowerCase())||v.manifest.keywords&&v.manifest.keywords.some(ye=>ye.toLowerCase().includes(d.toLowerCase())),me=x==="all"||v.manifest.categories&&v.manifest.categories.includes(x);let oe=!0;p==="installed"?oe=v.installed===!0:p==="updates"&&(oe=v.installed===!0&&be(v));const xe=!N||!Y||ge(v);return K&&me&&oe&&xe}),O=()=>{r(null)},F=async v=>{if(!U?.installed){fe({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(Y&&!ge(v)){fe({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await p_(v.id,v.manifest.repository_url||"","main"),k_(v.id).catch(me=>{console.warn("Failed to record download:",me)}),fe({title:"安装成功",description:`${v.manifest.name} 已成功安装`});const K=await ir();E(K),y(me=>me.map(oe=>{if(oe.id===v.id){const xe=qc(oe.id,K),ye=Gc(oe.id,K);return{...oe,installed:xe,installed_version:ye}}return oe}))}catch(K){fe({title:"安装失败",description:K instanceof Error?K.message:"未知错误",variant:"destructive"})}},q=async v=>{try{await g_(v.id),fe({title:"卸载成功",description:`${v.manifest.name} 已成功卸载`});const K=await ir();E(K),y(me=>me.map(oe=>{if(oe.id===v.id){const xe=qc(oe.id,K),ye=Gc(oe.id,K);return{...oe,installed:xe,installed_version:ye}}return oe}))}catch(K){fe({title:"卸载失败",description:K instanceof Error?K.message:"未知错误",variant:"destructive"})}},se=async v=>{if(!U?.installed){fe({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const K=await j_(v.id,v.manifest.repository_url||"","main");fe({title:"更新成功",description:`${v.manifest.name} 已从 ${K.old_version} 更新到 ${K.new_version}`});const me=await ir();E(me),y(oe=>oe.map(xe=>{if(xe.id===v.id){const ye=qc(xe.id,me),de=Gc(xe.id,me);return{...xe,installed:ye,installed_version:de}}return xe}))}catch(K){fe({title:"更新失败",description:K instanceof Error?K.message:"未知错误",variant:"destructive"})}};return e.jsx(Ke,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs(C,{onClick:()=>n({to:"/plugin-mirrors"}),children:[e.jsx(vy,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),U&&!U.installed&&e.jsxs($e,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(We,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ca,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(es,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(st,{className:"text-orange-800 dark:text-orange-200",children:U.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(hs,{children:e.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",e.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),e.jsx($e,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索插件...",value:d,onChange:v=>m(v.target.value),className:"pl-9"})]}),e.jsxs(Oe,{value:x,onValueChange:f,children:[e.jsx(Ae,{className:"w-full sm:w-[200px]",children:e.jsx(Re,{placeholder:"选择分类"})}),e.jsxs(De,{children:[e.jsx(ne,{value:"all",children:"全部分类"}),e.jsx(ne,{value:"Group Management",children:"群组管理"}),e.jsx(ne,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(ne,{value:"Utility Tools",children:"实用工具"}),e.jsx(ne,{value:"Content Generation",children:"内容生成"}),e.jsx(ne,{value:"Multimedia",children:"多媒体"}),e.jsx(ne,{value:"External Integration",children:"外部集成"}),e.jsx(ne,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(ne,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ht,{id:"compatible-only",checked:N,onCheckedChange:v=>j(v===!0)}),e.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),e.jsx(ka,{value:p,onValueChange:g,className:"w-full",children:e.jsxs(fa,{className:"grid w-full grid-cols-3",children:[e.jsxs(ss,{value:"all",children:["全部插件 (",w.filter(v=>{if(!v.manifest)return!1;const K=d===""||v.manifest.name?.toLowerCase().includes(d.toLowerCase())||v.manifest.description?.toLowerCase().includes(d.toLowerCase())||v.manifest.keywords&&v.manifest.keywords.some(xe=>xe.toLowerCase().includes(d.toLowerCase())),me=x==="all"||v.manifest.categories&&v.manifest.categories.includes(x),oe=!N||!Y||ge(v);return K&&me&&oe}).length,")"]}),e.jsxs(ss,{value:"installed",children:["已安装 (",w.filter(v=>{if(!v.manifest)return!1;const K=d===""||v.manifest.name?.toLowerCase().includes(d.toLowerCase())||v.manifest.description?.toLowerCase().includes(d.toLowerCase())||v.manifest.keywords&&v.manifest.keywords.some(xe=>xe.toLowerCase().includes(d.toLowerCase())),me=x==="all"||v.manifest.categories&&v.manifest.categories.includes(x),oe=!N||!Y||ge(v);return v.installed&&K&&me&&oe}).length,")"]}),e.jsxs(ss,{value:"updates",children:["可更新 (",w.filter(v=>{if(!v.manifest)return!1;const K=d===""||v.manifest.name?.toLowerCase().includes(d.toLowerCase())||v.manifest.description?.toLowerCase().includes(d.toLowerCase())||v.manifest.keywords&&v.manifest.keywords.some(xe=>xe.toLowerCase().includes(d.toLowerCase())),me=x==="all"||v.manifest.categories&&v.manifest.categories.includes(x),oe=!N||!Y||ge(v);return v.installed&&be(v)&&K&&me&&oe}).length,")"]})]})}),R&&R.stage==="loading"&&e.jsx($e,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ks,{className:"h-4 w-4 animate-spin"}),e.jsxs("span",{className:"text-sm font-medium",children:[R.operation==="fetch"&&"加载插件列表",R.operation==="install"&&`安装插件${R.plugin_id?`: ${R.plugin_id}`:""}`,R.operation==="uninstall"&&`卸载插件${R.plugin_id?`: ${R.plugin_id}`:""}`,R.operation==="update"&&`更新插件${R.plugin_id?`: ${R.plugin_id}`:""}`]})]}),e.jsxs("span",{className:"text-sm font-medium",children:[R.progress,"%"]})]}),e.jsx(ii,{value:R.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:R.message}),R.operation==="fetch"&&R.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",R.loaded_plugins," / ",R.total_plugins," 个插件"]})]})}),R&&R.stage==="error"&&R.error&&e.jsx($e,{className:"border-destructive bg-destructive/10",children:e.jsx(We,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ca,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(es,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(st,{className:"text-destructive/80",children:R.error})]})]})})}),T?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Ks,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):L?e.jsx($e,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ca,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:L}),e.jsx(C,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):Se.length===0?e.jsx($e,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Mt,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d||x!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Se.map(v=>e.jsxs($e,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(We,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(es,{className:"text-xl",children:v.manifest?.name||v.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[v.manifest?.categories&&v.manifest.categories[0]&&e.jsx(Fe,{variant:"secondary",className:"text-xs whitespace-nowrap",children:Sp[v.manifest.categories[0]]||v.manifest.categories[0]}),ve(v)]})]}),e.jsx(st,{className:"line-clamp-2",children:v.manifest?.description||"无描述"})]}),e.jsx(hs,{className:"flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nl,{className:"h-4 w-4"}),e.jsx("span",{children:(M[v.id]?.downloads??v.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ll,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(M[v.id]?.rating??v.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[v.manifest?.keywords&&v.manifest.keywords.slice(0,3).map(K=>e.jsx(Fe,{variant:"outline",className:"text-xs",children:K},K)),v.manifest?.keywords&&v.manifest.keywords.length>3&&e.jsxs(Fe,{variant:"outline",className:"text-xs",children:["+",v.manifest.keywords.length-3]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[e.jsxs("div",{children:["v",v.manifest?.version||"unknown"," · ",v.manifest?.author?.name||"Unknown"]}),v.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[v.manifest.host_application.min_version,v.manifest.host_application.max_version?` - ${v.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(Tg,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>r(v),children:"查看详情"}),v.installed?be(v)?e.jsxs(C,{size:"sm",disabled:!U?.installed,title:U?.installed?void 0:"Git 未安装",onClick:()=>se(v),children:[e.jsx(Tt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(C,{variant:"destructive",size:"sm",disabled:!U?.installed,title:U?.installed?void 0:"Git 未安装",onClick:()=>q(v),children:[e.jsx(Je,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(C,{size:"sm",disabled:!U?.installed||R?.operation==="install"||Y!==null&&!ge(v),title:U?.installed?Y!==null&&!ge(v)?`不兼容当前版本 (需要 ${v.manifest?.host_application?.min_version||"未知"}${v.manifest?.host_application?.max_version?` - ${v.manifest.host_application.max_version}`:"+"},当前 ${Y?.version})`:void 0:"Git 未安装",onClick:()=>F(v),children:[e.jsx(nl,{className:"h-4 w-4 mr-1"}),R?.operation==="install"&&R?.plugin_id===v.id?"安装中...":"安装"]})]})})]},v.id))}),e.jsx(Hs,{open:i!==null,onOpenChange:O,children:i&&i.manifest&&e.jsx(As,{className:"max-w-2xl max-h-[80vh] p-0 flex flex-col",children:e.jsx(Ke,{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-6",children:[e.jsx(Ds,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(Os,{className:"text-2xl",children:i.manifest.name}),e.jsxs(Js,{children:["作者: ",i.manifest.author?.name||"Unknown",i.manifest.author?.url&&e.jsx("a",{href:i.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:e.jsx(Fc,{className:"h-3 w-3 inline"})})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[i.manifest.categories&&i.manifest.categories[0]&&e.jsx(Fe,{variant:"secondary",children:Sp[i.manifest.categories[0]]||i.manifest.categories[0]}),ve(i)]})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(E_,{pluginId:i.id}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"版本"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",i.manifest?.version||"unknown"]}),i.installed&&i.installed_version&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",i.installed_version]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"下载量"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:(M[i.id]?.downloads??i.downloads??0).toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"评分"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ll,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(M[i.id]?.rating??i.rating??0).toFixed(1)," (",M[i.id]?.rating_count??i.review_count??0,")"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"许可证"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.manifest.license||"Unknown"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.manifest.host_application?.min_version||"未知",i.manifest.host_application?.max_version?` - ${i.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.manifest.keywords&&i.manifest.keywords.map(v=>e.jsx(Fe,{variant:"outline",children:v},v))})]}),i.detailed_description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:i.detailed_description})]}),!i.detailed_description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.manifest.description||"无描述"})]}),e.jsxs("div",{className:"space-y-2",children:[i.manifest.homepage_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"主页: "}),e.jsx("a",{href:i.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i.manifest.homepage_url})]}),i.manifest.repository_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"仓库: "}),e.jsx("a",{href:i.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i.manifest.repository_url})]})]})]}),e.jsxs(at,{children:[i.manifest.homepage_url&&e.jsxs(C,{onClick:()=>window.open(i.manifest.homepage_url,"_blank"),children:[e.jsx(Fc,{className:"h-4 w-4 mr-2"}),"访问主页"]}),i.manifest.repository_url&&e.jsxs(C,{variant:"outline",onClick:()=>window.open(i.manifest.repository_url,"_blank"),children:[e.jsx(Fc,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})})})]})})}const Vu=hN,$u=fN,Qu=pN;function M_({field:n,value:i,onChange:r}){const[d,m]=u.useState(!1);switch(n.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(k,{children:n.label}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]}),e.jsx(Be,{checked:!!i,onCheckedChange:r,disabled:n.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:n.label}),e.jsx(re,{type:"number",value:i??n.default,onChange:x=>r(parseFloat(x.target.value)||0),min:n.min,max:n.max,step:n.step??1,placeholder:n.placeholder,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(k,{children:n.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:i??n.default})]}),e.jsx(ha,{value:[i??n.default],onValueChange:x=>r(x[0]),min:n.min??0,max:n.max??100,step:n.step??1,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:n.label}),e.jsxs(Oe,{value:String(i??n.default),onValueChange:r,disabled:n.disabled,children:[e.jsx(Ae,{children:e.jsx(Re,{placeholder:n.placeholder??"请选择"})}),e.jsx(De,{children:n.choices?.map(x=>e.jsx(ne,{value:String(x),children:String(x)},String(x)))})]}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:n.label}),e.jsx(Ms,{value:i??n.default,onChange:x=>r(x.target.value),placeholder:n.placeholder,rows:n.rows??3,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:n.label}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{type:d?"text":"password",value:i??"",onChange:x=>r(x.target.value),placeholder:n.placeholder,disabled:n.disabled,className:"pr-10"}),e.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>m(!d),children:d?e.jsx(dr,{className:"h-4 w-4"}):e.jsx(Ot,{className:"h-4 w-4"})})]}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:n.label}),e.jsx(re,{type:"text",value:i??n.default??"",onChange:x=>r(x.target.value),placeholder:n.placeholder,maxLength:n.max_length,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]})}}function Cp({section:n,config:i,onChange:r}){const[d,m]=u.useState(!n.collapsed),x=Object.entries(n.fields).filter(([,f])=>!f.hidden).sort(([,f],[,p])=>f.order-p.order);return e.jsx(Vu,{open:d,onOpenChange:m,children:e.jsxs($e,{children:[e.jsx($u,{asChild:!0,children:e.jsxs(We,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[d?e.jsx(Rl,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(es,{className:"text-lg",children:n.title})]}),e.jsxs(Fe,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),n.description&&e.jsx(st,{className:"ml-6",children:n.description})]})}),e.jsx(Qu,{children:e.jsx(hs,{className:"space-y-4 pt-0",children:x.map(([f,p])=>e.jsx(M_,{field:p,value:i[n.name]?.[f],onChange:g=>r(n.name,f,g),sectionName:n.name},f))})})]})})}function A_({plugin:n,onBack:i}){const{toast:r}=Rs(),[d,m]=u.useState(null),[x,f]=u.useState({}),[p,g]=u.useState({}),[N,j]=u.useState(!0),[w,y]=u.useState(!1),[T,_]=u.useState(!1),[L,D]=u.useState(!1),U=u.useCallback(async()=>{j(!0);try{const[M,te]=await Promise.all([v_(n.id),b_(n.id)]);m(M),f(te),g(JSON.parse(JSON.stringify(te)))}catch(M){r({title:"加载配置失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}finally{j(!1)}},[n.id,r]);u.useEffect(()=>{U()},[U]),u.useEffect(()=>{_(JSON.stringify(x)!==JSON.stringify(p))},[x,p]);const I=(M,te,fe)=>{f(je=>({...je,[M]:{...je[M]||{},[te]:fe}}))},R=async()=>{y(!0);try{await N_(n.id,x),g(JSON.parse(JSON.stringify(x))),r({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(M){r({title:"保存失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}finally{y(!1)}},z=async()=>{try{await y_(n.id),r({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),D(!1),U()}catch(M){r({title:"重置失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},Y=async()=>{try{const M=await w_(n.id);r({title:M.message,description:M.note}),U()}catch(M){r({title:"切换状态失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}};if(N)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Ks,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!d)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(zt,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(C,{onClick:i,variant:"outline",children:[e.jsx(ei,{className:"h-4 w-4 mr-2"}),"返回"]})]});const Q=Object.values(d.sections).sort((M,te)=>M.order-te.order),E=x.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(C,{variant:"ghost",size:"icon",onClick:i,children:e.jsx(ei,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:d.plugin_info.name||n.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Fe,{variant:E?"default":"secondary",children:E?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",d.plugin_info.version||n.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:Y,children:[e.jsx(gr,{className:"h-4 w-4 mr-2"}),E?"禁用":"启用"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>D(!0),children:[e.jsx(Qc,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(C,{size:"sm",onClick:R,disabled:!T||w,children:[w?e.jsx(Ks,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(jr,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),T&&e.jsx($e,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(hs,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ra,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),d.layout.type==="tabs"&&d.layout.tabs.length>0?e.jsxs(ka,{defaultValue:d.layout.tabs[0]?.id,children:[e.jsx(fa,{children:d.layout.tabs.map(M=>e.jsxs(ss,{value:M.id,children:[M.title,M.badge&&e.jsx(Fe,{variant:"secondary",className:"ml-2 text-xs",children:M.badge})]},M.id))}),d.layout.tabs.map(M=>e.jsx(ys,{value:M.id,className:"space-y-4 mt-4",children:M.sections.map(te=>{const fe=d.sections[te];return fe?e.jsx(Cp,{section:fe,config:x,onChange:I},te):null})},M.id))]}):e.jsx("div",{className:"space-y-4",children:Q.map(M=>e.jsx(Cp,{section:M,config:x,onChange:I},M.name))}),e.jsx(Hs,{open:L,onOpenChange:D,children:e.jsxs(As,{children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"确认重置配置"}),e.jsx(Js,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>D(!1),children:"取消"}),e.jsx(C,{variant:"destructive",onClick:z,children:"确认重置"})]})]})})]})}function D_(){const{toast:n}=Rs(),[i,r]=u.useState([]),[d,m]=u.useState(!0),[x,f]=u.useState(""),[p,g]=u.useState(null),N=async()=>{m(!0);try{const T=await ir();r(T)}catch(T){n({title:"加载插件列表失败",description:T instanceof Error?T.message:"未知错误",variant:"destructive"})}finally{m(!1)}};u.useEffect(()=>{N()},[]);const j=i.filter(T=>{const _=x.toLowerCase();return T.id.toLowerCase().includes(_)||T.manifest.name.toLowerCase().includes(_)||T.manifest.description?.toLowerCase().includes(_)}),w=i.length,y=0;return p?e.jsx(Ke,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(A_,{plugin:p,onBack:()=>g(null)})})}):e.jsx(Ke,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(Tt,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs($e,{children:[e.jsxs(We,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(an,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsx("div",{className:"text-2xl font-bold",children:i.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d?"正在加载...":"个插件"})]})]}),e.jsxs($e,{children:[e.jsxs(We,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"已启用"}),e.jsx(ta,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(hs,{children:[e.jsx("div",{className:"text-2xl font-bold",children:w}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),e.jsxs($e,{children:[e.jsxs(We,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(zt,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(hs,{children:[e.jsx("div",{className:"text-2xl font-bold",children:y}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索插件...",value:x,onChange:T=>f(T.target.value),className:"pl-9"})]}),e.jsxs($e,{children:[e.jsxs(We,{children:[e.jsx(es,{children:"已安装的插件"}),e.jsx(st,{children:"点击插件查看和编辑配置"})]}),e.jsx(hs,{children:d?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Ks,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(an,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:x?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:x?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:j.map(T=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>g(T),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(an,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:T.manifest.name}),e.jsxs(Fe,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",T.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:T.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(C,{variant:"ghost",size:"sm",children:e.jsx(ai,{className:"h-4 w-4"})}),e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"})]})]},T.id))})})]})]})})}function O_(){const n=ga(),{toast:i}=Rs(),[r,d]=u.useState([]),[m,x]=u.useState(!0),[f,p]=u.useState(null),[g,N]=u.useState(null),[j,w]=u.useState(!1),[y,T]=u.useState(!1),[_,L]=u.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D=u.useCallback(async()=>{try{x(!0),p(null);const E=localStorage.getItem("access-token"),M=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${E}`}});if(!M.ok)throw new Error("获取镜像源列表失败");const te=await M.json();d(te.mirrors||[])}catch(E){const M=E instanceof Error?E.message:"加载镜像源失败";p(M),i({title:"加载失败",description:M,variant:"destructive"})}finally{x(!1)}},[i]);u.useEffect(()=>{D()},[D]);const U=async()=>{try{const E=localStorage.getItem("access-token"),M=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${E}`,"Content-Type":"application/json"},body:JSON.stringify(_)});if(!M.ok){const te=await M.json();throw new Error(te.detail||"添加镜像源失败")}i({title:"添加成功",description:"镜像源已添加"}),w(!1),L({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D()}catch(E){i({title:"添加失败",description:E instanceof Error?E.message:"未知错误",variant:"destructive"})}},I=async()=>{if(g)try{const E=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${g.id}`,{method:"PUT",headers:{Authorization:`Bearer ${E}`,"Content-Type":"application/json"},body:JSON.stringify({name:_.name,raw_prefix:_.raw_prefix,clone_prefix:_.clone_prefix,enabled:_.enabled,priority:_.priority})})).ok)throw new Error("更新镜像源失败");i({title:"更新成功",description:"镜像源已更新"}),T(!1),N(null),D()}catch(E){i({title:"更新失败",description:E instanceof Error?E.message:"未知错误",variant:"destructive"})}},R=async E=>{if(confirm("确定要删除这个镜像源吗?"))try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${E}`,{method:"DELETE",headers:{Authorization:`Bearer ${M}`}})).ok)throw new Error("删除镜像源失败");i({title:"删除成功",description:"镜像源已删除"}),D()}catch(M){i({title:"删除失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},z=async E=>{try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${E.id}`,{method:"PUT",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!E.enabled})})).ok)throw new Error("更新状态失败");D()}catch(M){i({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},Y=E=>{N(E),L({id:E.id,name:E.name,raw_prefix:E.raw_prefix,clone_prefix:E.clone_prefix,enabled:E.enabled,priority:E.priority}),T(!0)},Q=async(E,M)=>{const te=M==="up"?E.priority-1:E.priority+1;if(!(te<1))try{const fe=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${E.id}`,{method:"PUT",headers:{Authorization:`Bearer ${fe}`,"Content-Type":"application/json"},body:JSON.stringify({priority:te})})).ok)throw new Error("更新优先级失败");D()}catch(fe){i({title:"更新失败",description:fe instanceof Error?fe.message:"未知错误",variant:"destructive"})}};return e.jsx(Ke,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>n({to:"/plugins"}),children:e.jsx(ei,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),e.jsxs(C,{onClick:()=>w(!0),children:[e.jsx(rt,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),m?e.jsx($e,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ks,{className:"h-8 w-8 animate-spin text-primary"})})}):f?e.jsx($e,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ca,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:f}),e.jsx(C,{onClick:D,children:"重新加载"})]})}):e.jsxs($e,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ct,{children:[e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"ID"}),e.jsx(Ye,{children:"优先级"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:r.map(E=>e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(Be,{checked:E.enabled,onCheckedChange:()=>z(E)})}),e.jsx(Ge,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:E.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",E.raw_prefix]})]})}),e.jsx(Ge,{children:e.jsx(Fe,{variant:"outline",children:E.id})}),e.jsx(Ge,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:E.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(C,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>Q(E,"up"),disabled:E.priority===1,children:e.jsx(mr,{className:"h-3 w-3"})}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>Q(E,"down"),children:e.jsx(Rl,{className:"h-3 w-3"})})]})]})}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>Y(E),children:e.jsx(ln,{className:"h-4 w-4"})}),e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>R(E.id),children:e.jsx(Je,{className:"h-4 w-4 text-destructive"})})]})})]},E.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:r.map(E=>e.jsx($e,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:E.name}),E.enabled&&e.jsx(Fe,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(Fe,{variant:"outline",className:"mt-1 text-xs",children:E.id})]}),e.jsx(Be,{checked:E.enabled,onCheckedChange:()=>z(E)})]}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Raw: "}),e.jsx("span",{className:"break-all",children:E.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:E.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(C,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>Y(E),children:[e.jsx(ln,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Q(E,"up"),disabled:E.priority===1,children:e.jsx(mr,{className:"h-4 w-4"})}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Q(E,"down"),children:e.jsx(Rl,{className:"h-4 w-4"})}),e.jsx(C,{variant:"destructive",size:"sm",onClick:()=>R(E.id),children:e.jsx(Je,{className:"h-4 w-4"})})]})]})},E.id))})]}),e.jsx(Hs,{open:j,onOpenChange:w,children:e.jsxs(As,{className:"max-w-lg",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"添加镜像源"}),e.jsx(Js,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(re,{id:"add-id",placeholder:"例如: my-mirror",value:_.id,onChange:E=>L({..._,id:E.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"add-name",children:"名称 *"}),e.jsx(re,{id:"add-name",placeholder:"例如: 我的镜像源",value:_.name,onChange:E=>L({..._,name:E.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(re,{id:"add-raw",placeholder:"https://example.com/raw",value:_.raw_prefix,onChange:E=>L({..._,raw_prefix:E.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(re,{id:"add-clone",placeholder:"https://example.com/clone",value:_.clone_prefix,onChange:E=>L({..._,clone_prefix:E.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"add-priority",children:"优先级"}),e.jsx(re,{id:"add-priority",type:"number",min:"1",value:_.priority,onChange:E=>L({..._,priority:parseInt(E.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"add-enabled",checked:_.enabled,onCheckedChange:E=>L({..._,enabled:E})}),e.jsx(k,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>w(!1),children:"取消"}),e.jsx(C,{onClick:U,children:"添加"})]})]})}),e.jsx(Hs,{open:y,onOpenChange:T,children:e.jsxs(As,{className:"max-w-lg",children:[e.jsxs(Ds,{children:[e.jsx(Os,{children:"编辑镜像源"}),e.jsx(Js,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:"镜像源 ID"}),e.jsx(re,{value:_.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(re,{id:"edit-name",value:_.name,onChange:E=>L({..._,name:E.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(re,{id:"edit-raw",value:_.raw_prefix,onChange:E=>L({..._,raw_prefix:E.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(re,{id:"edit-clone",value:_.clone_prefix,onChange:E=>L({..._,clone_prefix:E.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(re,{id:"edit-priority",type:"number",min:"1",value:_.priority,onChange:E=>L({..._,priority:parseInt(E.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Be,{id:"edit-enabled",checked:_.enabled,onCheckedChange:E=>L({..._,enabled:E})}),e.jsx(k,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(at,{children:[e.jsx(C,{variant:"outline",onClick:()=>T(!1),children:"取消"}),e.jsx(C,{onClick:I,children:"保存"})]})]})})]})})}const rr=u.forwardRef(({className:n,...i},r)=>e.jsx(Qp,{ref:r,className:G("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",n),...i}));rr.displayName=Qp.displayName;const R_=u.forwardRef(({className:n,...i},r)=>e.jsx(Ip,{ref:r,className:G("aspect-square h-full w-full",n),...i}));R_.displayName=Ip.displayName;const cr=u.forwardRef(({className:n,...i},r)=>e.jsx(Yp,{ref:r,className:G("flex h-full w-full items-center justify-center rounded-full bg-muted",n),...i}));cr.displayName=Yp.displayName;function L_(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function U_(){const n="maibot_webui_user_id";let i=localStorage.getItem(n);return i||(i=L_(),localStorage.setItem(n,i)),i}function B_(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function H_(n){localStorage.setItem("maibot_webui_user_name",n)}const Wg="maibot_webui_virtual_tabs";function q_(){try{const n=localStorage.getItem(Wg);if(n)return JSON.parse(n)}catch(n){console.error("[Chat] 加载虚拟标签页失败:",n)}return[]}function kp(n){try{localStorage.setItem(Wg,JSON.stringify(n))}catch(i){console.error("[Chat] 保存虚拟标签页失败:",i)}}function G_(){const n={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},i=()=>{const Ue=q_().map(Ee=>{const Qe=Ee.virtualConfig;return!Qe.groupId&&Qe.platform&&Qe.userId&&(Qe.groupId=`webui_virtual_group_${Qe.platform}_${Qe.userId}`),{id:Ee.id,type:"virtual",label:Ee.label,virtualConfig:Qe,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[n,...Ue]},[r,d]=u.useState(i),[m,x]=u.useState("webui-default"),f=r.find(X=>X.id===m)||r[0],[p,g]=u.useState(""),[N,j]=u.useState(!1),[w,y]=u.useState(!0),[T,_]=u.useState(B_()),[L,D]=u.useState(!1),[U,I]=u.useState(""),[R,z]=u.useState(!1),[Y,Q]=u.useState(!1),[E,M]=u.useState([]),[te,fe]=u.useState([]),[je,ve]=u.useState(!1),[ge,be]=u.useState(!1),[Se,O]=u.useState(""),[F,q]=u.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),se=u.useRef(U_()),v=u.useRef(new Map),K=u.useRef(null),me=u.useRef(new Map),oe=u.useRef(0),xe=u.useRef(new Map),{toast:ye}=Rs(),de=X=>(oe.current+=1,`${X}-${Date.now()}-${oe.current}-${Math.random().toString(36).substr(2,9)}`),W=u.useCallback((X,Ue)=>{d(Ee=>Ee.map(Qe=>Qe.id===X?{...Qe,...Ue}:Qe))},[]),ae=u.useCallback((X,Ue)=>{d(Ee=>Ee.map(Qe=>Qe.id===X?{...Qe,messages:[...Qe.messages,Ue]}:Qe))},[]),$=u.useCallback(()=>{K.current?.scrollIntoView({behavior:"smooth"})},[]);u.useEffect(()=>{$()},[f?.messages,$]);const Z=u.useCallback(async()=>{ve(!0);try{const X=await _e("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",X.status,X.headers.get("content-type")),X.ok){const Ue=X.headers.get("content-type");if(Ue&&Ue.includes("application/json")){const Ee=await X.json();console.log("[Chat] 平台列表数据:",Ee),M(Ee.platforms||[])}else{const Ee=await X.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",Ee.substring(0,200)),ye({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",X.status),ye({title:"获取平台失败",description:`服务器返回错误: ${X.status}`,variant:"destructive"})}catch(X){console.error("[Chat] 获取平台列表失败:",X),ye({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{ve(!1)}},[ye]),ke=u.useCallback(async(X,Ue)=>{be(!0);try{const Ee=new URLSearchParams;X&&Ee.append("platform",X),Ue&&Ee.append("search",Ue),Ee.append("limit","50");const Qe=await _e(`/api/chat/persons?${Ee.toString()}`);if(Qe.ok){const qs=Qe.headers.get("content-type");if(qs&&qs.includes("application/json")){const Ne=await Qe.json();fe(Ne.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(Ee){console.error("[Chat] 获取用户列表失败:",Ee)}finally{be(!1)}},[]);u.useEffect(()=>{F.platform&&ke(F.platform,Se)},[F.platform,Se,ke]);const He=u.useCallback(async(X,Ue)=>{y(!0);try{const Ee=new URLSearchParams;Ee.append("user_id",se.current),Ee.append("limit","50"),Ue&&Ee.append("group_id",Ue);const Qe=`/api/chat/history?${Ee.toString()}`;console.log("[Chat] 正在加载历史消息:",Qe);const qs=await _e(Qe);if(qs.ok){const Ne=await qs.text();try{const bs=JSON.parse(Ne);if(bs.messages&&bs.messages.length>0){const Ie=bs.messages.map(Me=>({id:Me.id,type:Me.type,content:Me.content,timestamp:Me.timestamp,sender:{name:Me.sender_name||(Me.is_bot?"麦麦":"WebUI用户"),user_id:Me.user_id,is_bot:Me.is_bot}}));W(X,{messages:Ie});const Ps=xe.current.get(X)||new Set;Ie.forEach(Me=>{if(Me.type==="bot"){const Gs=`bot-${Me.content}-${Math.floor(Me.timestamp*1e3)}`;Ps.add(Gs)}}),xe.current.set(X,Ps)}}catch(bs){console.error("[Chat] JSON 解析失败:",bs)}}}catch(Ee){console.error("[Chat] 加载历史消息失败:",Ee)}finally{y(!1)}},[W]),pe=u.useCallback((X,Ue,Ee)=>{const Qe=v.current.get(X);if(Qe?.readyState===WebSocket.OPEN||Qe?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${X}] WebSocket 已存在,跳过连接`);return}j(!0);const qs=window.location.protocol==="https:"?"wss:":"ws:",Ne=new URLSearchParams;Ue==="virtual"&&Ee?(Ne.append("user_id",Ee.userId),Ne.append("user_name",Ee.userName),Ne.append("platform",Ee.platform),Ne.append("person_id",Ee.personId),Ne.append("group_name",Ee.groupName||"WebUI虚拟群聊"),Ee.groupId&&Ne.append("group_id",Ee.groupId)):(Ne.append("user_id",se.current),Ne.append("user_name",T));const bs=`${qs}//${window.location.host}/api/chat/ws?${Ne.toString()}`;console.log(`[Tab ${X}] 正在连接 WebSocket:`,bs);try{const Ie=new WebSocket(bs);v.current.set(X,Ie),Ie.onopen=()=>{W(X,{isConnected:!0}),j(!1),console.log(`[Tab ${X}] WebSocket 已连接`)},Ie.onmessage=Ps=>{try{const Me=JSON.parse(Ps.data);switch(Me.type){case"session_info":W(X,{sessionInfo:{session_id:Me.session_id,user_id:Me.user_id,user_name:Me.user_name,bot_name:Me.bot_name}});break;case"system":ae(X,{id:de("sys"),type:"system",content:Me.content||"",timestamp:Me.timestamp||Date.now()/1e3});break;case"user_message":{const Gs=Me.sender?.user_id,ot=Ue==="virtual"&&Ee?Ee.userId:se.current;if(Gs===ot)break;ae(X,{id:Me.message_id||de("user"),type:"user",content:Me.content||"",timestamp:Me.timestamp||Date.now()/1e3,sender:Me.sender});break}case"bot_message":{W(X,{isTyping:!1}),z(!1);const Gs=xe.current.get(X)||new Set,ot=`bot-${Me.content}-${Math.floor((Me.timestamp||0)*1e3)}`;if(Gs.has(ot))break;if(Gs.add(ot),xe.current.set(X,Gs),Gs.size>100){const Bs=Gs.values().next().value;Bs&&Gs.delete(Bs)}d(Bs=>Bs.map(Ze=>{if(Ze.id!==X)return Ze;const Fs=Ze.messages.filter(Yt=>Yt.type!=="thinking");return{...Ze,messages:[...Fs,{id:de("bot"),type:"bot",content:Me.content||"",timestamp:Me.timestamp||Date.now()/1e3,sender:Me.sender}]}}));break}case"typing":W(X,{isTyping:Me.is_typing||!1});break;case"error":z(!1),d(Gs=>Gs.map(ot=>{if(ot.id!==X)return ot;const Bs=ot.messages.filter(Ze=>Ze.type!=="thinking");return{...ot,messages:[...Bs,{id:de("error"),type:"error",content:Me.content||"发生错误",timestamp:Me.timestamp||Date.now()/1e3}]}})),ye({title:"错误",description:Me.content,variant:"destructive"});break;case"pong":break;case"history":{const Gs=Me.messages||[];if(Gs.length>0){const ot=xe.current.get(X)||new Set,Bs=Gs.map(Ze=>{const Fs=Ze.is_bot||!1,Yt=Ze.id||de(Fs?"bot":"user"),Et=`${Fs?"bot":"user"}-${Ze.content}-${Math.floor(Ze.timestamp*1e3)}`;return ot.add(Et),{id:Yt,type:Fs?"bot":"user",content:Ze.content,timestamp:Ze.timestamp,sender:{name:Ze.sender_name||(Fs?"麦麦":"用户"),user_id:Ze.sender_id,is_bot:Fs}}});xe.current.set(X,ot),W(X,{messages:Bs}),console.log(`[Tab ${X}] 已加载 ${Bs.length} 条历史消息`)}break}default:console.log("未知消息类型:",Me.type)}}catch(Me){console.error("解析消息失败:",Me)}},Ie.onclose=()=>{W(X,{isConnected:!1}),j(!1),v.current.delete(X),console.log(`[Tab ${X}] WebSocket 已断开`);const Ps=me.current.get(X);Ps&&clearTimeout(Ps);const Me=window.setTimeout(()=>{if(!Te.current){const Gs=r.find(ot=>ot.id===X);Gs&&pe(X,Gs.type,Gs.virtualConfig)}},5e3);me.current.set(X,Me)},Ie.onerror=Ps=>{console.error(`[Tab ${X}] WebSocket 错误:`,Ps),j(!1)}}catch(Ie){console.error(`[Tab ${X}] 创建 WebSocket 失败:`,Ie),j(!1)}},[T,W,ae,ye,r]),Te=u.useRef(!1);u.useEffect(()=>{Te.current=!1;const X=v.current,Ue=me.current,Ee=xe.current;He("webui-default");const Qe=setTimeout(()=>{Te.current||(pe("webui-default","webui"),r.forEach(Ne=>{Ne.type==="virtual"&&Ne.virtualConfig&&(Ee.set(Ne.id,new Set),setTimeout(()=>{Te.current||pe(Ne.id,"virtual",Ne.virtualConfig)},200))}))},100),qs=setInterval(()=>{X.forEach(Ne=>{Ne.readyState===WebSocket.OPEN&&Ne.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{Te.current=!0,clearTimeout(Qe),clearInterval(qs),Ue.forEach(Ne=>{clearTimeout(Ne)}),Ue.clear(),X.forEach(Ne=>{Ne.close()}),X.clear()}},[]);const Qs=u.useCallback(()=>{const X=v.current.get(m);if(!p.trim()||!X||X.readyState!==WebSocket.OPEN||R)return;z(!0);const Ue=f?.type==="virtual"&&f.virtualConfig?.userName||T,Ee=p.trim(),Qe=Date.now()/1e3;X.send(JSON.stringify({type:"message",content:Ee,user_name:Ue}));const qs={id:de("user"),type:"user",content:Ee,timestamp:Qe,sender:{name:Ue,is_bot:!1}};ae(m,qs);const Ne={id:de("thinking"),type:"thinking",content:"",timestamp:Qe+.001,sender:{name:f?.sessionInfo.bot_name||"麦麦",is_bot:!0}};ae(m,Ne),g("")},[p,T,m,f,ae,R]),vt=X=>{X.key==="Enter"&&!X.shiftKey&&(X.preventDefault(),Qs())},ie=()=>{I(T),D(!0)},qe=()=>{const X=U.trim()||"WebUI用户";_(X),H_(X),D(!1);const Ue=v.current.get(m);Ue?.readyState===WebSocket.OPEN&&Ue.send(JSON.stringify({type:"update_nickname",user_name:X}))},gs=()=>{I(""),D(!1)},Ys=X=>new Date(X*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),Ls=()=>{const X=v.current.get(m);X&&(X.close(),v.current.delete(m)),pe(m,f?.type||"webui",f?.virtualConfig)},ft=()=>{q({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),O(""),Z(),Q(!0)},ps=()=>{if(!F.platform||!F.personId){ye({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const X=`webui_virtual_group_${F.platform}_${F.userId}`,Ue=`virtual-${F.platform}-${F.userId}-${Date.now()}`,Ee=F.userName||F.userId,Qe={id:Ue,type:"virtual",label:Ee,virtualConfig:{...F,groupId:X},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};d(qs=>{const Ne=[...qs,Qe],bs=Ne.filter(Ie=>Ie.type==="virtual"&&Ie.virtualConfig).map(Ie=>({id:Ie.id,label:Ie.label,virtualConfig:Ie.virtualConfig,createdAt:Date.now()}));return kp(bs),Ne}),x(Ue),Q(!1),xe.current.set(Ue,new Set),setTimeout(()=>{pe(Ue,"virtual",F)},100),ye({title:"虚拟身份标签页",description:`已创建 ${Ee} 的对话`})},Us=(X,Ue)=>{if(Ue?.stopPropagation(),X==="webui-default")return;const Ee=v.current.get(X);Ee&&(Ee.close(),v.current.delete(X));const Qe=me.current.get(X);Qe&&(clearTimeout(Qe),me.current.delete(X)),xe.current.delete(X),d(qs=>{const Ne=qs.filter(Ie=>Ie.id!==X),bs=Ne.filter(Ie=>Ie.type==="virtual"&&Ie.virtualConfig).map(Ie=>({id:Ie.id,label:Ie.label,virtualConfig:Ie.virtualConfig,createdAt:Date.now()}));return kp(bs),Ne}),m===X&&x("webui-default")},ja=X=>{x(X)},va=X=>{q(Ue=>({...Ue,personId:X.person_id,userId:X.user_id,userName:X.nickname||X.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Hs,{open:Y,onOpenChange:Q,children:e.jsxs(As,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Ds,{children:[e.jsxs(Os,{className:"flex items-center gap-2",children:[e.jsx(_u,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(Js,{children:"选择一个麦麦已认识的用户,以该用户的身份与麦麦对话。麦麦将使用她对该用户的记忆和认知来回应。"})]}),e.jsxs("div",{className:"space-y-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(k,{className:"flex items-center gap-2",children:[e.jsx(Bu,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Oe,{value:F.platform,onValueChange:X=>{q(Ue=>({...Ue,platform:X,personId:"",userId:"",userName:""})),fe([])},children:[e.jsx(Ae,{disabled:je,children:e.jsx(Re,{placeholder:je?"加载中...":"选择平台"})}),e.jsx(De,{children:E.map(X=>e.jsxs(ne,{value:X.platform,children:[X.platform," (",X.count," 人)"]},X.platform))})]})]}),F.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(k,{className:"flex items-center gap-2",children:[e.jsx(Hu,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索用户名...",value:Se,onChange:X=>O(X.target.value),className:"pl-9"})]}),e.jsx(Ke,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:ge?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ks,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):te.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(Hu,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:te.map(X=>e.jsxs("button",{onClick:()=>va(X),className:G("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",F.personId===X.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(rr,{className:"h-8 w-8 shrink-0",children:e.jsx(cr,{className:G("text-xs",F.personId===X.person_id?"bg-primary-foreground/20":"bg-muted"),children:(X.nickname||X.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:X.nickname||X.person_name}),e.jsxs("div",{className:G("text-xs truncate",F.personId===X.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",X.user_id,X.is_known&&" · 已认识"]})]})]},X.person_id))})})})]}),F.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:"虚拟群名(可选)"}),e.jsx(re,{placeholder:"WebUI虚拟群聊",value:F.groupName,onChange:X=>q(Ue=>({...Ue,groupName:X.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(at,{className:"gap-2 sm:gap-0",children:[e.jsx(C,{variant:"outline",onClick:()=>Q(!1),children:"取消"}),e.jsx(C,{onClick:ps,disabled:!F.platform||!F.personId,children:"创建对话"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[r.map(X=>e.jsxs("button",{onClick:()=>ja(X.id),className:G("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors","hover:bg-muted",m===X.id?"bg-background shadow-sm border":"text-muted-foreground"),children:[X.type==="webui"?e.jsx(Ol,{className:"h-3.5 w-3.5"}):e.jsx(_u,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:X.label}),e.jsx("span",{className:G("w-1.5 h-1.5 rounded-full",X.isConnected?"bg-green-500":"bg-muted-foreground/50")}),X.id!=="webui-default"&&e.jsx("button",{onClick:Ue=>Us(X.id,Ue),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20",children:e.jsx(il,{className:"h-3 w-3"})})]},X.id)),e.jsx("button",{onClick:ft,className:"flex items-center gap-1 px-2 py-1.5 rounded-md text-sm text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"新建虚拟身份对话",children:e.jsx(rt,{className:"h-3.5 w-3.5"})})]})})}),e.jsx("div",{className:"shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx(rr,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(cr,{className:"bg-primary/10 text-primary",children:e.jsx(lr,{className:"h-4 w-4 sm:h-5 sm:w-5"})})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:f?.sessionInfo.bot_name||"麦麦"}),e.jsx("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:f?.isConnected?e.jsxs(e.Fragment,{children:[e.jsx(by,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):N?e.jsxs(e.Fragment,{children:[e.jsx(Ks,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ny,{className:"h-3 w-3 text-red-500"}),e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"未连接"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[w&&e.jsx(Ks,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Ls,disabled:N,title:"重新连接",children:e.jsx(Tt,{className:G("h-4 w-4",N&&"animate-spin")})})]})]}),e.jsx("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:f?.type==="virtual"&&f.virtualConfig?e.jsxs(e.Fragment,{children:[e.jsx(_u,{className:"h-3 w-3 text-primary"}),e.jsx("span",{children:"虚拟身份:"}),e.jsx("span",{className:"font-medium text-primary",children:f.virtualConfig.userName}),e.jsxs("span",{className:"text-xs",children:["(",f.virtualConfig.platform,")"]}),f.virtualConfig.groupName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1",children:"·"}),e.jsxs("span",{className:"text-xs",children:["群:",f.virtualConfig.groupName]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Xc,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),L?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{value:U,onChange:X=>I(X.target.value),onKeyDown:X=>{X.key==="Enter"&&qe(),X.key==="Escape"&&gs()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(C,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:qe,children:"保存"}),e.jsx(C,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:gs,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:T}),e.jsx(C,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ie,title:"修改昵称",children:e.jsx(yy,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Ke,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[f?.messages.length===0&&!w&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(lr,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",f?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),f?.messages.map(X=>e.jsxs("div",{className:G("flex gap-2 sm:gap-3",X.type==="user"&&"flex-row-reverse",X.type==="system"&&"justify-center",X.type==="error"&&"justify-center"),children:[X.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:X.content}),X.type==="error"&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:X.content}),X.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(rr,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(cr,{className:"bg-primary/10 text-primary",children:e.jsx(lr,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:"flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",children:[e.jsx("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:e.jsx("span",{className:"hidden sm:inline",children:X.sender?.name||f?.sessionInfo.bot_name})}),e.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"思考中..."})]})})]})]}),(X.type==="user"||X.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(rr,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(cr,{className:G("text-xs",X.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:X.type==="bot"?e.jsx(lr,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(Xc,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:G("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",X.type==="user"&&"items-end"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:X.sender?.name||(X.type==="bot"?f?.sessionInfo.bot_name:T)}),e.jsx("span",{children:Ys(X.timestamp)})]}),e.jsx("div",{className:G("rounded-2xl px-3 py-2 text-sm whitespace-pre-wrap break-words",X.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:X.content})]})]})]},X.id)),e.jsx("div",{ref:K})]})})}),e.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:p,onChange:X=>g(X.target.value),onKeyDown:vt,placeholder:R?"等待响应中...":f?.isConnected?"输入消息...":"等待连接...",disabled:!f?.isConnected||R,className:"flex-1 h-10 sm:h-10"}),e.jsx(C,{onClick:Qs,disabled:!f?.isConnected||!p.trim()||R,size:"icon",className:"h-10 w-10 shrink-0",children:R?e.jsx(Ks,{className:"h-4 w-4 animate-spin"}):e.jsx(wy,{className:"h-4 w-4"})})]})})})]})}var lm="Radio",[F_,ej]=cg(lm),[V_,$_]=F_(lm),sj=u.forwardRef((n,i)=>{const{__scopeRadio:r,name:d,checked:m=!1,required:x,disabled:f,value:p="on",onCheck:g,form:N,...j}=n,[w,y]=u.useState(null),T=Iu(i,D=>y(D)),_=u.useRef(!1),L=w?N||!!w.closest("form"):!0;return e.jsxs(V_,{scope:r,checked:m,disabled:f,children:[e.jsx(Zc.button,{type:"button",role:"radio","aria-checked":m,"data-state":nj(m),"data-disabled":f?"":void 0,disabled:f,value:p,...j,ref:T,onClick:Lu(n.onClick,D=>{m||g?.(),L&&(_.current=D.isPropagationStopped(),_.current||D.stopPropagation())})}),L&&e.jsx(lj,{control:w,bubbles:!_.current,name:d,value:p,checked:m,required:x,disabled:f,form:N,style:{transform:"translateX(-100%)"}})]})});sj.displayName=lm;var tj="RadioIndicator",aj=u.forwardRef((n,i)=>{const{__scopeRadio:r,forceMount:d,...m}=n,x=$_(tj,r);return e.jsx(FN,{present:d||x.checked,children:e.jsx(Zc.span,{"data-state":nj(x.checked),"data-disabled":x.disabled?"":void 0,...m,ref:i})})});aj.displayName=tj;var Q_="RadioBubbleInput",lj=u.forwardRef(({__scopeRadio:n,control:i,checked:r,bubbles:d=!0,...m},x)=>{const f=u.useRef(null),p=Iu(f,x),g=VN(r),N=$N(i);return u.useEffect(()=>{const j=f.current;if(!j)return;const w=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(w,"checked").set;if(g!==r&&T){const _=new Event("click",{bubbles:d});T.call(j,r),j.dispatchEvent(_)}},[g,r,d]),e.jsx(Zc.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...m,tabIndex:-1,ref:p,style:{...m.style,...N,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});lj.displayName=Q_;function nj(n){return n?"checked":"unchecked"}var I_=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ro="RadioGroup",[Y_]=cg(ro,[Xp,ej]),ij=Xp(),rj=ej(),[X_,K_]=Y_(ro),cj=u.forwardRef((n,i)=>{const{__scopeRadioGroup:r,name:d,defaultValue:m,value:x,required:f=!1,disabled:p=!1,orientation:g,dir:N,loop:j=!0,onValueChange:w,...y}=n,T=ij(r),_=qN(N),[L,D]=GN({prop:x,defaultProp:m??null,onChange:w,caller:ro});return e.jsx(X_,{scope:r,name:d,required:f,disabled:p,value:L,onValueChange:D,children:e.jsx(gN,{asChild:!0,...T,orientation:g,dir:_,loop:j,children:e.jsx(Zc.div,{role:"radiogroup","aria-required":f,"aria-orientation":g,"data-disabled":p?"":void 0,dir:_,...y,ref:i})})})});cj.displayName=ro;var oj="RadioGroupItem",dj=u.forwardRef((n,i)=>{const{__scopeRadioGroup:r,disabled:d,...m}=n,x=K_(oj,r),f=x.disabled||d,p=ij(r),g=rj(r),N=u.useRef(null),j=Iu(i,N),w=x.value===m.value,y=u.useRef(!1);return u.useEffect(()=>{const T=L=>{I_.includes(L.key)&&(y.current=!0)},_=()=>y.current=!1;return document.addEventListener("keydown",T),document.addEventListener("keyup",_),()=>{document.removeEventListener("keydown",T),document.removeEventListener("keyup",_)}},[]),e.jsx(jN,{asChild:!0,...p,focusable:!f,active:w,children:e.jsx(sj,{disabled:f,required:x.required,checked:w,...g,...m,name:x.name,ref:j,onCheck:()=>x.onValueChange(m.value),onKeyDown:Lu(T=>{T.key==="Enter"&&T.preventDefault()}),onFocus:Lu(m.onFocus,()=>{y.current&&N.current?.click()})})})});dj.displayName=oj;var J_="RadioGroupIndicator",uj=u.forwardRef((n,i)=>{const{__scopeRadioGroup:r,...d}=n,m=rj(r);return e.jsx(aj,{...m,...d,ref:i})});uj.displayName=J_;var mj=cj,xj=dj,P_=uj;const hj=u.forwardRef(({className:n,...i},r)=>e.jsx(mj,{className:G("grid gap-2",n),...i,ref:r}));hj.displayName=mj.displayName;const fj=u.forwardRef(({className:n,...i},r)=>e.jsx(xj,{ref:r,className:G("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",n),...i,children:e.jsx(P_,{className:"flex items-center justify-center",children:e.jsx(_y,{className:"h-2.5 w-2.5 fill-current text-current"})})}));fj.displayName=xj.displayName;function Z_({question:n,value:i,onChange:r,error:d,disabled:m=!1}){const[x,f]=u.useState(null),p=m||n.readOnly,g=()=>{switch(n.type){case"single":return e.jsx(hj,{value:i||"",onValueChange:r,disabled:p,className:"space-y-2",children:n.options?.map(N=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(fj,{value:N.value,id:`${n.id}-${N.id}`}),e.jsx(k,{htmlFor:`${n.id}-${N.id}`,className:"cursor-pointer font-normal",children:N.label})]},N.id))});case"multiple":{const N=i||[];return e.jsxs("div",{className:"space-y-2",children:[n.options?.map(j=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ht,{id:`${n.id}-${j.id}`,checked:N.includes(j.value),disabled:p||n.maxSelections!==void 0&&N.length>=n.maxSelections&&!N.includes(j.value),onCheckedChange:w=>{r(w?[...N,j.value]:N.filter(y=>y!==j.value))}}),e.jsx(k,{htmlFor:`${n.id}-${j.id}`,className:"cursor-pointer font-normal",children:j.label})]},j.id)),n.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",n.maxSelections," 项"]})]})}case"text":return e.jsx(re,{value:i||"",onChange:N=>r(N.target.value),placeholder:n.placeholder||"请输入...",disabled:p,readOnly:n.readOnly,maxLength:n.maxLength,className:G(n.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(Ms,{value:i||"",onChange:N=>r(N.target.value),placeholder:n.placeholder||"请输入...",disabled:p,readOnly:n.readOnly,maxLength:n.maxLength,rows:4,className:G(n.readOnly&&"bg-muted cursor-not-allowed")}),n.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(i||"").length," / ",n.maxLength]})]});case"rating":{const N=i||0,j=x!==null?x:N;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(w=>e.jsx("button",{type:"button",disabled:p,className:G("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",p&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!p&&f(w),onMouseLeave:()=>f(null),onClick:()=>!p&&r(w),children:e.jsx(ll,{className:G("h-6 w-6 transition-colors",w<=j?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},w)),N>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[N," / 5"]})]})}case"scale":{const N=n.min??1,j=n.max??10,w=n.step??1,y=i??N;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(ha,{value:[y],onValueChange:([T])=>r(T),min:N,max:j,step:w,disabled:p}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:n.minLabel||N}),e.jsx("span",{className:"font-medium text-foreground",children:y}),e.jsx("span",{children:n.maxLabel||j})]})]})}case"dropdown":return e.jsxs(Oe,{value:i||"",onValueChange:r,disabled:p,children:[e.jsx(Ae,{children:e.jsx(Re,{placeholder:n.placeholder||"请选择..."})}),e.jsx(De,{children:n.options?.map(N=>e.jsx(ne,{value:N.value,children:N.label},N.id))})]});default:return e.jsx("div",{className:"text-muted-foreground",children:"不支持的问题类型"})}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(k,{className:"text-base font-medium",children:[n.title,n.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),n.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]}),g(),d&&e.jsx("p",{className:"text-sm text-destructive",children:d})]})}const pj="https://maibot-plugin-stats.maibot-webui.workers.dev";function gj(){const n="maibot_user_id";let i=localStorage.getItem(n);if(!i){const r=Math.random().toString(36).substring(2,10),d=Date.now().toString(36),m=Math.random().toString(36).substring(2,10);i=`fp_${r}_${d}_${m}`,localStorage.setItem(n,i)}return i}async function W_(n,i,r,d){try{const m=d?.userId||gj(),x={surveyId:n,surveyVersion:i,userId:m,answers:r,submittedAt:new Date().toISOString(),allowMultiple:d?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},f=await fetch(`${pj}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}),p=await f.json();return f.status===429?{success:!1,error:"提交过于频繁,请稍后再试"}:f.status===409?{success:!1,error:p.error||"你已经提交过这份问卷了"}:f.ok?{success:!0,submissionId:p.submissionId,message:p.message}:{success:!1,error:p.error||"提交失败"}}catch(m){return console.error("Error submitting survey:",m),{success:!1,error:"网络错误"}}}async function eS(n,i){try{const r=i||gj(),d=new URLSearchParams({user_id:r,survey_id:n}),m=await fetch(`${pj}/survey/check?${d}`);return m.ok?{success:!0,hasSubmitted:(await m.json()).hasSubmitted}:{success:!1,error:(await m.json()).error||"检查失败"}}catch(r){return console.error("Error checking submission:",r),{success:!1,error:"网络错误"}}}function jj({config:n,initialAnswers:i,onSubmitSuccess:r,onSubmitError:d,showProgress:m=!0,paginateQuestions:x=!1,className:f}){const p=u.useCallback(()=>!i||i.length===0?{}:i.reduce((q,se)=>(q[se.questionId]=se.value,q),{}),[i]),[g,N]=u.useState(()=>p()),[j,w]=u.useState({}),[y,T]=u.useState(0),[_,L]=u.useState(!1),[D,U]=u.useState(!1),[I,R]=u.useState(null),[z,Y]=u.useState(null),[Q,E]=u.useState(!1),[M,te]=u.useState(!0);u.useEffect(()=>{i&&i.length>0&&N(q=>({...q,...p()}))},[i,p]),u.useEffect(()=>{(async()=>{if(!n.settings?.allowMultiple){const se=await eS(n.id);se.success&&se.hasSubmitted&&E(!0)}te(!1)})()},[n.id,n.settings?.allowMultiple]);const fe=u.useCallback(()=>{const q=new Date;return!(n.settings?.startTime&&new Date(n.settings.startTime)>q||n.settings?.endTime&&new Date(n.settings.endTime){const se=g[q.id];return se==null?!1:Array.isArray(se)?se.length>0:typeof se=="string"?se.trim()!=="":!0}).length,ve=je/n.questions.length*100,ge=u.useCallback((q,se)=>{N(v=>({...v,[q]:se})),w(v=>{const K={...v};return delete K[q],K})},[]),be=u.useCallback(()=>{const q={};for(const se of n.questions){if(se.required){const v=g[se.id];if(v==null){q[se.id]="此题为必填项";continue}if(Array.isArray(v)&&v.length===0){q[se.id]="请至少选择一项";continue}if(typeof v=="string"&&v.trim()===""){q[se.id]="此题为必填项";continue}}se.minLength&&typeof g[se.id]=="string"&&g[se.id].length{if(!be()){if(x){const q=n.questions.findIndex(se=>j[se.id]);q>=0&&T(q)}return}L(!0),R(null);try{const q=n.questions.filter(v=>g[v.id]!==void 0).map(v=>({questionId:v.id,value:g[v.id]})),se=await W_(n.id,n.version,q,{allowMultiple:n.settings?.allowMultiple});if(se.success&&se.submissionId)U(!0),Y(se.submissionId),r?.(se.submissionId);else{const v=se.error||"提交失败";R(v),d?.(v)}}catch(q){const se=q instanceof Error?q.message:"提交失败";R(se),d?.(se)}finally{L(!1)}},[be,x,n,g,j,r,d]),O=u.useCallback(q=>{q>=0&&qe.jsxs("div",{className:G("p-4 rounded-lg border bg-card",j[q.id]?"border-destructive bg-destructive/5":"border-border"),children:[x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",y+1," / ",n.questions.length]}),!x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[se+1,"."]}),e.jsx(Z_,{question:q,value:g[q.id],onChange:v=>ge(q.id,v),error:j[q.id],disabled:_})]},q.id)),I&&e.jsxs($t,{variant:"destructive",children:[e.jsx(zt,{className:"h-4 w-4"}),e.jsx(Qt,{children:I})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(C,{variant:"outline",onClick:()=>O(y-1),disabled:y===0||_,children:[e.jsx(rl,{className:"h-4 w-4 mr-1"}),"上一题"]}),y===n.questions.length-1?e.jsxs(C,{onClick:Se,disabled:_,children:[_&&e.jsx(Ks,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(C,{onClick:()=>O(y+1),disabled:_,children:["下一题",e.jsx(Ba,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(j).length>0&&e.jsxs("span",{className:"text-destructive",children:["还有 ",Object.keys(j).length," 个必填项未完成"]})}),e.jsxs(C,{onClick:Se,disabled:_,size:"lg",children:[_&&e.jsx(Ks,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const sS={id:"webui-feedback-v1",version:"1.0.0",title:"麦麦 WebUI 使用反馈问卷",description:"感谢您使用麦麦 WebUI!您的反馈将帮助我们不断改进产品体验。",questions:[{id:"webui_version",type:"text",title:"你正在使用的 WebUI 版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"ui_design_satisfaction",type:"single",title:"你觉得当前的 WebUI 界面设计如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"problems_encountered",type:"multiple",title:"你在使用 WebUI 时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"lag",label:"界面卡顿",value:"lag"},{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"complex",label:"操作复杂",value:"complex"},{id:"bugs",label:"存在 Bug",value:"bugs"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"useful_features",type:"textarea",title:"你觉得哪些功能是最有用的?",required:!0,placeholder:"请分享你认为最有价值的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦 WebUI 的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦 WebUI 给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},tS={id:"maibot-feedback-v1",version:"1.0.0",title:"麦麦使用体验反馈问卷",description:"感谢您使用麦麦!您的反馈将帮助我们打造更好的 AI 伙伴。",questions:[{id:"maibot_version",type:"text",title:"你正在使用的麦麦版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"improvement_areas",type:"textarea",title:"你认为麦麦还有哪些部分可以改进?",required:!0,placeholder:"请分享你认为可以改进的方面...",maxLength:1e3},{id:"problems_encountered",type:"multiple",title:"你在使用麦麦时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"slow_response",label:"响应速度慢",value:"slow_response"},{id:"complex",label:"操作复杂",value:"complex"},{id:"unstable",label:"运行不稳定",value:"unstable"},{id:"config_difficult",label:"配置困难",value:"config_difficult"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"helpful_features",type:"textarea",title:"你觉得麦麦的哪些功能对你最有帮助?",required:!0,placeholder:"请分享对你最有帮助的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对麦麦的成长非常重要,我们会认真考虑每一条建议。"}};function aS(){const[n,i]=u.useState(null),[r,d]=u.useState(!0);u.useEffect(()=>{const p=JSON.parse(JSON.stringify(sS));i(p),d(!1)},[]);const m=u.useMemo(()=>[{questionId:"webui_version",value:`v${eo}`}],[]),x=u.useCallback(p=>{console.log("WebUI Survey submitted:",p)},[]),f=u.useCallback(p=>{console.error("WebUI Survey submission error:",p)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Ks,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(wg,{className:"h-8 w-8",strokeWidth:2}),"WebUI 使用反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们持续改进产品体验"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(jj,{config:n,initialAnswers:m,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:x,onSubmitError:f})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs($t,{variant:"destructive",className:"max-w-md",children:[e.jsx(zt,{className:"h-4 w-4"}),e.jsx(Qt,{children:"无法加载问卷配置"})]}),e.jsx(C,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function lS(){const[n,i]=u.useState(null),[r,d]=u.useState(!0),[m,x]=u.useState("未知版本");u.useEffect(()=>{(async()=>{try{const w=await Hg();x(w.version||"未知版本")}catch(w){console.error("Failed to get MaiBot version:",w),x("获取失败")}const j=JSON.parse(JSON.stringify(tS));i(j),d(!1)})()},[]);const f=u.useMemo(()=>[{questionId:"maibot_version",value:m}],[m]),p=u.useCallback(N=>{console.log("MaiBot Survey submitted:",N)},[]),g=u.useCallback(N=>{console.error("MaiBot Survey submission error:",N)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Ks,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(wg,{className:"h-8 w-8",strokeWidth:2}),"麦麦使用体验反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们打造更好的 AI 伙伴"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(jj,{config:n,initialAnswers:f,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:p,onSubmitError:g})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs($t,{variant:"destructive",className:"max-w-md",children:[e.jsx(zt,{className:"h-4 w-4"}),e.jsx(Qt,{children:"无法加载问卷配置"})]}),e.jsx(C,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function nS(){const n=ga(),[i,r]=u.useState(!0);return u.useEffect(()=>{let d=!1;return(async()=>{try{const x=await Wu();!d&&!x&&n({to:"/auth"})}catch{d||n({to:"/auth"})}finally{d||r(!1)}})(),()=>{d=!0}},[n]),{checking:i}}async function iS(){return await Wu()}const rS=ti("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),vj=u.forwardRef(({className:n,size:i,abbrTitle:r,children:d,...m},x)=>e.jsx("kbd",{className:G(rS({size:i,className:n})),ref:x,...m,children:r?e.jsx("abbr",{title:r,children:d}):d}));vj.displayName="Kbd";const cS=[{icon:Wc,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Sa,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:_g,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:Sg,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Yu,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Ol,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:Cg,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:si,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:Sy,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:an,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Xu,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:ai,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function oS({open:n,onOpenChange:i}){const[r,d]=u.useState(""),[m,x]=u.useState(0),f=ga(),p=cS.filter(j=>j.title.toLowerCase().includes(r.toLowerCase())||j.description.toLowerCase().includes(r.toLowerCase())||j.category.toLowerCase().includes(r.toLowerCase()));u.useEffect(()=>{n&&(d(""),x(0))},[n]);const g=u.useCallback(j=>{f({to:j}),i(!1)},[f,i]),N=u.useCallback(j=>{j.key==="ArrowDown"?(j.preventDefault(),x(w=>(w+1)%p.length)):j.key==="ArrowUp"?(j.preventDefault(),x(w=>(w-1+p.length)%p.length)):j.key==="Enter"&&p[m]&&(j.preventDefault(),g(p[m].path))},[p,m,g]);return e.jsx(Hs,{open:n,onOpenChange:i,children:e.jsxs(As,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Ds,{className:"px-4 pt-4 pb-0",children:[e.jsx(Os,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(re,{value:r,onChange:j=>{d(j.target.value),x(0)},onKeyDown:N,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(Ke,{className:"h-[400px]",children:p.length>0?e.jsx("div",{className:"p-2",children:p.map((j,w)=>{const y=j.icon;return e.jsxs("button",{onClick:()=>g(j.path),onMouseEnter:()=>x(w),className:G("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",w===m?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(y,{className:"h-5 w-5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm",children:j.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:j.description})]}),e.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:j.category})]},j.path)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Mt,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),e.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}const dS=IN,uS=YN,mS=XN,bj=u.forwardRef(({className:n,sideOffset:i=4,...r},d)=>e.jsx(QN,{children:e.jsx(og,{ref:d,sideOffset:i,className:G("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]",n),...r})}));bj.displayName=og.displayName;function xS({children:n}){const{checking:i}=nS(),[r,d]=u.useState(!0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),{theme:g,setTheme:N}=Ju(),j=Gb();if(u.useEffect(()=>{const L=D=>{(D.metaKey||D.ctrlKey)&&D.key==="k"&&(D.preventDefault(),p(!0))};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[]),i)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const w=[{title:"概览",items:[{icon:Wc,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Sa,label:"麦麦主程序配置",path:"/config/bot"},{icon:_g,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:Sg,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:tp,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Yu,label:"表情包管理",path:"/resource/emoji"},{icon:Ol,label:"表达方式管理",path:"/resource/expression"},{icon:si,label:"黑话管理",path:"/resource/jargon"},{icon:Cg,label:"人物信息管理",path:"/resource/person"},{icon:yg,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:an,label:"插件市场",path:"/plugins"},{icon:tp,label:"插件配置",path:"/plugin-config"},{icon:Xu,label:"日志查看器",path:"/logs"},{icon:Ol,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:ai,label:"系统设置",path:"/settings"}]}],T=g==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":g,_=async()=>{await X0()};return e.jsx(dS,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:G("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",r?"lg:w-64":"lg:w-16",m?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:G("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!r&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:G("flex items-baseline gap-2",!r&&"lg:hidden"),children:[e.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),e.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:A0()})]}),!r&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(Ke,{className:G("flex-1 overflow-x-hidden",!r&&"lg:w-16"),children:e.jsx("nav",{className:G("p-4",!r&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:G("space-y-6",!r&&"lg:space-y-3 lg:w-full"),children:w.map((L,D)=>e.jsxs("li",{children:[e.jsx("div",{className:G("px-3 h-[1.25rem]","mb-2",!r&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:L.title})}),!r&&D>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:L.items.map(U=>{const I=j({to:U.path}),R=U.icon,z=e.jsxs(e.Fragment,{children:[I&&e.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),e.jsxs("div",{className:G("flex items-center transition-all duration-300",r?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(R,{className:G("h-5 w-5 flex-shrink-0",I&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:G("text-sm font-medium whitespace-nowrap transition-all duration-300",I&&"font-semibold",r?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:U.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(uS,{children:[e.jsx(mS,{asChild:!0,children:e.jsx(Xn,{to:U.path,"data-tour":U.tourId,className:G("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",I?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",r?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>x(!1),children:z})}),!r&&e.jsx(bj,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:U.label})})]})},U.path)})})]},L.title))})})})]}),m&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>x(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>x(!m),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(Cy,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>d(!r),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:r?"收起侧边栏":"展开侧边栏",children:e.jsx(rl,{className:G("h-5 w-5 transition-transform",!r&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>p(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),e.jsxs(vj,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(oS,{open:f,onOpenChange:p}),e.jsxs(C,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(ky,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:L=>{k0(T==="dark"?"light":"dark",N,L)},className:"rounded-lg p-2 hover:bg-accent",title:T==="dark"?"切换到浅色模式":"切换到深色模式",children:T==="dark"?e.jsx(gg,{className:"h-5 w-5"}):e.jsx(jg,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(C,{variant:"ghost",size:"sm",onClick:_,className:"gap-2",title:"登出系统",children:[e.jsx(Ty,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:n})]})]})})}function hS(n){const i=n.split(` -`).slice(1),r=[];for(const d of i){const m=d.trim();if(!m.startsWith("at "))continue;const x=m.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);x?r.push({functionName:x[1]||"",fileName:x[2],lineNumber:x[3],columnNumber:x[4],raw:m}):r.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:m})}return r}function fS({error:n,errorInfo:i}){const[r,d]=u.useState(!0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),g=n.stack?hS(n.stack):[],N=async()=>{const j=` -Error: ${n.name} -Message: ${n.message} - -Stack Trace: -${n.stack||"No stack trace available"} - -Component Stack: -${i?.componentStack||"No component stack available"} - -URL: ${window.location.href} -User Agent: ${navigator.userAgent} -Time: ${new Date().toISOString()} - `.trim();try{await navigator.clipboard.writeText(j),p(!0),setTimeout(()=>p(!1),2e3)}catch(w){console.error("Failed to copy:",w)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs($t,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Ca,{className:"h-4 w-4"}),e.jsxs(Qt,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[n.name,":"]})," ",n.message]})]}),g.length>0&&e.jsxs(Vu,{open:r,onOpenChange:d,children:[e.jsx($u,{asChild:!0,children:e.jsxs(C,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(Ey,{className:"h-4 w-4"}),"Stack Trace (",g.length," frames)"]}),r?e.jsx(mr,{className:"h-4 w-4"}):e.jsx(Rl,{className:"h-4 w-4"})]})}),e.jsx(Qu,{children:e.jsx(Ke,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:g.map((j,w)=>e.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[w+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:j.functionName}),j.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[j.fileName,j.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",j.lineNumber,":",j.columnNumber]})]})]})]})},w))})})})]}),i?.componentStack&&e.jsxs(Vu,{open:m,onOpenChange:x,children:[e.jsx($u,{asChild:!0,children:e.jsxs(C,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(Ca,{className:"h-4 w-4"}),"Component Stack"]}),m?e.jsx(mr,{className:"h-4 w-4"}):e.jsx(Rl,{className:"h-4 w-4"})]})}),e.jsx(Qu,{children:e.jsx(Ke,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:i.componentStack})})})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:N,className:"w-full",children:f?e.jsxs(e.Fragment,{children:[e.jsx(Vt,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(Yc,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function Nj({error:n,errorInfo:i}){const r=()=>{window.location.href="/"},d=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs($e,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(We,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:e.jsx(Ca,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(es,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(st,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(hs,{className:"space-y-4",children:[e.jsx(fS,{error:n,errorInfo:i}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(C,{onClick:d,className:"flex-1",children:[e.jsx(Tt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(C,{onClick:r,variant:"outline",className:"flex-1",children:[e.jsx(Wc,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class pS extends u.Component{constructor(i){super(i),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(i){return{hasError:!0,error:i}}componentDidCatch(i,r){console.error("ErrorBoundary caught an error:",i,r),this.setState({errorInfo:r})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:e.jsx(Nj,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function yj({error:n}){return e.jsx(Nj,{error:n,errorInfo:null})}const br=Fb({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(Tp,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!iS())throw $b({to:"/auth"})}}),gS=lt({getParentRoute:()=>br,path:"/auth",component:K0}),jS=lt({getParentRoute:()=>br,path:"/setup",component:uw}),jt=lt({getParentRoute:()=>br,id:"protected",component:()=>e.jsx(xS,{children:e.jsx(Tp,{})}),errorComponent:({error:n})=>e.jsx(yj,{error:n})}),vS=lt({getParentRoute:()=>jt,path:"/",component:S0}),bS=lt({getParentRoute:()=>jt,path:"/config/bot",component:Fw}),NS=lt({getParentRoute:()=>jt,path:"/config/modelProvider",component:Zw}),yS=lt({getParentRoute:()=>jt,path:"/config/model",component:x1}),wS=lt({getParentRoute:()=>jt,path:"/config/adapter",component:f1}),_S=lt({getParentRoute:()=>jt,path:"/resource/emoji",component:B1}),SS=lt({getParentRoute:()=>jt,path:"/resource/expression",component:J1}),CS=lt({getParentRoute:()=>jt,path:"/resource/person",component:b2}),kS=lt({getParentRoute:()=>jt,path:"/resource/jargon",component:d2}),TS=lt({getParentRoute:()=>jt,path:"/resource/knowledge-graph",component:E2}),ES=lt({getParentRoute:()=>jt,path:"/logs",component:i_}),zS=lt({getParentRoute:()=>jt,path:"/chat",component:G_}),MS=lt({getParentRoute:()=>jt,path:"/plugins",component:z_}),AS=lt({getParentRoute:()=>jt,path:"/plugin-config",component:D_}),DS=lt({getParentRoute:()=>jt,path:"/plugin-mirrors",component:O_}),OS=lt({getParentRoute:()=>jt,path:"/settings",component:F0}),RS=lt({getParentRoute:()=>jt,path:"/survey/webui-feedback",component:aS}),LS=lt({getParentRoute:()=>jt,path:"/survey/maibot-feedback",component:lS}),US=lt({getParentRoute:()=>br,path:"*",component:qg}),BS=br.addChildren([gS,jS,jt.addChildren([vS,bS,NS,yS,wS,_S,SS,kS,CS,TS,MS,AS,DS,ES,zS,OS,RS,LS]),US]),HS=Vb({routeTree:BS,defaultNotFoundComponent:qg,defaultErrorComponent:({error:n})=>e.jsx(yj,{error:n})});function qS({children:n,defaultTheme:i="system",storageKey:r="ui-theme",...d}){const[m,x]=u.useState(()=>localStorage.getItem(r)||i);u.useEffect(()=>{const p=window.document.documentElement;if(p.classList.remove("light","dark"),m==="system"){const g=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";p.classList.add(g);return}p.classList.add(m)},[m]),u.useEffect(()=>{const p=localStorage.getItem("accent-color");if(p){const g=document.documentElement,j={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[p];j&&(g.style.setProperty("--primary",j.hsl),j.gradient?(g.style.setProperty("--primary-gradient",j.gradient),g.classList.add("has-gradient")):(g.style.removeProperty("--primary-gradient"),g.classList.remove("has-gradient")))}},[]);const f={theme:m,setTheme:p=>{localStorage.setItem(r,p),x(p)}};return e.jsx(Dg.Provider,{...d,value:f,children:n})}function GS({children:n,defaultEnabled:i=!0,defaultWavesEnabled:r=!0,storageKey:d="enable-animations",wavesStorageKey:m="enable-waves-background"}){const[x,f]=u.useState(()=>{const j=localStorage.getItem(d);return j!==null?j==="true":i}),[p,g]=u.useState(()=>{const j=localStorage.getItem(m);return j!==null?j==="true":r});u.useEffect(()=>{const j=document.documentElement;x?j.classList.remove("no-animations"):j.classList.add("no-animations"),localStorage.setItem(d,String(x))},[x,d]),u.useEffect(()=>{localStorage.setItem(m,String(p))},[p,m]);const N={enableAnimations:x,setEnableAnimations:f,enableWavesBackground:p,setEnableWavesBackground:g};return e.jsx(Og.Provider,{value:N,children:n})}const FS=KN,wj=u.forwardRef(({className:n,...i},r)=>e.jsx(dg,{ref:r,className:G("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",n),...i}));wj.displayName=dg.displayName;const VS=ti("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),_j=u.forwardRef(({className:n,variant:i,...r},d)=>e.jsx(ug,{ref:d,className:G(VS({variant:i}),n),...r}));_j.displayName=ug.displayName;const $S=u.forwardRef(({className:n,...i},r)=>e.jsx(mg,{ref:r,className:G("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",n),...i}));$S.displayName=mg.displayName;const Sj=u.forwardRef(({className:n,...i},r)=>e.jsx(xg,{ref:r,className:G("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",n),"toast-close":"",...i,children:e.jsx(il,{className:"h-4 w-4"})}));Sj.displayName=xg.displayName;const Cj=u.forwardRef(({className:n,...i},r)=>e.jsx(hg,{ref:r,className:G("text-sm font-semibold [&+div]:text-xs",n),...i}));Cj.displayName=hg.displayName;const kj=u.forwardRef(({className:n,...i},r)=>e.jsx(fg,{ref:r,className:G("text-sm opacity-90",n),...i}));kj.displayName=fg.displayName;function QS(){const{toasts:n}=Rs();return e.jsxs(FS,{children:[n.map(function({id:i,title:r,description:d,action:m,...x}){return e.jsxs(_j,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[r&&e.jsx(Cj,{children:r}),d&&e.jsx(kj,{children:d})]}),m,e.jsx(Sj,{})]},i)}),e.jsx(wj,{})]})}h0.createRoot(document.getElementById("root")).render(e.jsx(u.StrictMode,{children:e.jsx(pS,{children:e.jsx(qS,{defaultTheme:"system",children:e.jsx(GS,{children:e.jsxs(Yw,{children:[e.jsx(Qb,{router:HS}),e.jsx(Jw,{}),e.jsx(QS,{})]})})})})})); diff --git a/webui/dist/assets/index-CWjV9Ftw.css b/webui/dist/assets/index-CWjV9Ftw.css new file mode 100644 index 00000000..37552871 --- /dev/null +++ b/webui/dist/assets/index-CWjV9Ftw.css @@ -0,0 +1 @@ +@charset "UTF-8";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[140px\]{height:140px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[140px\]{min-height:140px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[1px\]{width:1px}.w-\[65px\]{width:65px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[100px\]{max-width:100px}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[1fr_1fr_90px_32px\]{grid-template-columns:1fr 1fr 90px 32px}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900\/30:is(.dark *){background-color:#1e3a8a4d}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-purple-900\/30:is(.dark *){background-color:#581c874d}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-purple-400:is(.dark *){--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-4{padding-bottom:1rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:grid-cols-9{grid-template-columns:repeat(9,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}.lg\:pb-6{padding-bottom:1.5rem}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}.uppy-Root{box-sizing:border-box;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1;position:relative;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.uppy-Root[dir=rtl],[dir=rtl] .uppy-Root{text-align:right}.uppy-Root *,.uppy-Root :after,.uppy-Root :before{box-sizing:inherit}.uppy-Root [hidden]{display:none}.uppy-u-reset{all:initial;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1}[dir=rtl] .uppy-u-reset{text-align:right}.uppy-truncate-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-c-textInput{background-color:#fff;border:1px solid #ddd;border-radius:4px;font-family:inherit;font-size:14px;line-height:1.5;padding:6px 8px}.uppy-size--md .uppy-c-textInput{padding:8px 10px}.uppy-c-textInput:focus{border-color:#1269cf99;box-shadow:0 0 0 3px #1269cf26;outline:none}[data-uppy-theme=dark] .uppy-c-textInput{background-color:#333;border-color:#333;color:#eaeaea}[data-uppy-theme=dark] .uppy-c-textInput:focus{border-color:#525252;box-shadow:none}.uppy-c-icon{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;fill:currentColor}.uppy-c-btn{align-items:center;color:inherit;display:inline-flex;font-family:inherit;font-size:inherit;font-weight:500;justify-content:center;line-height:1;transition-duration:.3s;transition-property:background-color,color;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.uppy-c-btn,[dir=rtl] .uppy-c-btn{text-align:center}.uppy-c-btn:not(:disabled):not(.disabled){cursor:pointer}.uppy-c-btn::-moz-focus-inner{border:0}.uppy-c-btn-primary{background-color:#1269cf;border-radius:4px;color:#fff;font-size:14px;padding:10px 18px}.uppy-c-btn-primary:not(:disabled):hover{background-color:#0e51a0}.uppy-c-btn-primary:focus{box-shadow:0 0 0 3px #1269cf66;outline:none}.uppy-size--md .uppy-c-btn-primary{padding:13px 22px}[data-uppy-theme=dark] .uppy-c-btn-primary{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-primary::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-c-btn-primary.uppy-c-btn--disabled{background-color:#8eb2db}.uppy-c-btn-link{background-color:initial;border-radius:4px;color:#525252;font-size:14px;line-height:1;padding:10px 15px}.uppy-c-btn-link:hover{color:#333}.uppy-c-btn-link:focus{box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-size--md .uppy-c-btn-link{padding:13px 18px}[data-uppy-theme=dark] .uppy-c-btn-link{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-link:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-link::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-link:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-c-btn-link:hover{color:#939393}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;padding:6px}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list:after,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list:after{content:"";flex:auto}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{margin:0;position:relative;width:50%}.uppy-size--md .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--md .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:33.3333%}.uppy-size--lg .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--lg .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:25%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem:before,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem:before{content:"";display:block;padding-top:100%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected svg{opacity:.85}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--disabled,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--disabled{opacity:.5}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#93939333}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#eaeaea33}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{height:30%;width:30%;fill:#000000b3}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{fill:#fffc}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{border-radius:4px;height:calc(100% - 14px);inset:7px;overflow:hidden;position:absolute;text-align:center;width:calc(100% - 14px)}@media(hover:none){.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author{display:block}}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{box-shadow:0 0 0 3px #aae1ffb3}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner img{border-radius:4px;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author{background:#0000004d;bottom:0;color:#fff;display:none;font-size:12px;font-weight:500;left:0;margin:0;padding:5px;position:absolute;text-decoration:none;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author:hover,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author:hover{background:#0006;text-decoration:underline}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-radius:50%;height:26px;opacity:0;position:absolute;right:16px;top:16px;width:26px;z-index:1002}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox:after{height:7px;inset-inline-start:7px;top:8px;width:12px}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{opacity:1}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author{display:block}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus{outline:none}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner{border:0}.uppy-ProviderBrowser-viewType--list{background-color:#fff}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list{background-color:#1f1f1f}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{align-items:center;display:flex;margin:0;padding:7px 15px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{color:#eaeaea}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem--disabled{opacity:.6}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox{background-color:#fff;border:1px solid #cfcfcf;border-radius:3px;height:17px;margin-inline-end:15px;width:17px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border:1px solid #1269cf;box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:after{height:5px;inset-inline-start:3px;opacity:0;top:4px;width:9px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border-color:#02baf2b3;box-shadow:0 0 0 3px #02baf233}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-color:#1269cf}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{opacity:1}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner{align-items:center;color:inherit;display:flex;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;overflow:hidden;padding:2px;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner:focus{outline:none;text-decoration:underline}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner svg{margin-inline-end:8px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner span{line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--disabled .uppy-ProviderBrowserItem-inner{cursor:default}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-iconWrap{margin-inline-end:7px;width:20px}.uppy-ProviderBrowserItem-checkbox{cursor:pointer;flex-shrink:0;position:relative}.uppy-ProviderBrowserItem-checkbox:disabled,.uppy-ProviderBrowserItem-checkbox:disabled:after{cursor:default}[data-uppy-theme=dark] .uppy-ProviderBrowserItem-checkbox{background-color:#1f1f1f;border-color:#939393}[data-uppy-theme=dark] .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{background-color:#333}.uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after{border-bottom:2px solid #eaeaea;border-left:2px solid #eaeaea;content:"";cursor:pointer;position:absolute;transform:rotate(-45deg)}.uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{background-color:#eaeaea!important;content:""!important;height:2px!important;left:20%!important;position:absolute!important;right:20%!important;top:50%!important;transform:translateY(-50%)!important}.uppy-SearchProvider{align-items:center;display:flex;flex:1;flex-direction:column;height:100%;justify-content:center;width:100%}[data-uppy-theme=dark] .uppy-SearchProvider{background-color:#1f1f1f}.uppy-SearchProvider-input{margin-bottom:15px;max-width:650px;width:90%}.uppy-size--md .uppy-SearchProvider-input{margin-bottom:20px}.uppy-SearchProvider-input::-webkit-search-cancel-button{display:none}.uppy-SearchProvider-searchButton{padding:13px 25px}.uppy-size--md .uppy-SearchProvider-searchButton{padding:13px 30px}.uppy-DashboardContent-panelBody{align-items:center;display:flex;flex:1;justify-content:center}[data-uppy-theme=dark] .uppy-DashboardContent-panelBody{background-color:#1f1f1f}.uppy-Provider-auth,.uppy-Provider-empty,.uppy-Provider-error,.uppy-Provider-loading{align-items:center;color:#939393;display:flex;flex:1;flex-flow:column wrap;justify-content:center}.uppy-Provider-empty{color:#939393}.uppy-Provider-authIcon svg{height:75px;width:100px}.uppy-Provider-authTitle{color:#757575;font-size:17px;font-weight:400;line-height:1.4;margin-bottom:30px;max-width:500px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Provider-authTitle{font-size:20px}[data-uppy-theme=dark] .uppy-Provider-authTitle{color:#cfcfcf}.uppy-Provider-btn-google{align-items:center;background:#4285f4;display:flex;padding:8px 12px!important}.uppy-Provider-btn-google:hover{background-color:#1266f1}.uppy-Provider-btn-google:focus{box-shadow:0 0 0 3px #4285f466;outline:none}.uppy-Provider-btn-google svg{margin-right:8px}.uppy-Provider-breadcrumbs{color:#525252;flex:1;font-size:12px;margin-bottom:10px;text-align:start}.uppy-size--md .uppy-Provider-breadcrumbs{margin-bottom:0}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs{color:#eaeaea}.uppy-Provider-breadcrumbsIcon{color:#525252;display:inline-block;line-height:1;margin-inline-end:4px;vertical-align:middle}.uppy-Provider-breadcrumbsIcon svg{height:13px;width:13px;fill:#525252}.uppy-Provider-breadcrumbs button{border-radius:3px;display:inline-block;line-height:inherit;padding:4px}.uppy-Provider-breadcrumbs button:focus{outline:none}.uppy-Provider-breadcrumbs button::-moz-focus-inner{border:0}.uppy-Provider-breadcrumbs button:hover{color:#0e51a0}.uppy-Provider-breadcrumbs button:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button:focus{background-color:#333}.uppy-Provider-breadcrumbs button:not(:last-of-type){text-decoration:underline}.uppy-Provider-breadcrumbs button:last-of-type{color:#333;cursor:normal;font-weight:500;pointer-events:none}.uppy-Provider-breadcrumbs button:hover{cursor:pointer}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button{color:#eaeaea}.uppy-ProviderBrowser{display:flex;flex:1;flex-direction:column;font-size:14px;font-weight:400;height:100%}.uppy-ProviderBrowser-user{color:#333;font-weight:500;margin:0 8px 0 0}[data-uppy-theme=dark] .uppy-ProviderBrowser-user{color:#eaeaea}.uppy-ProviderBrowser-user:after{color:#939393;content:"·";font-weight:400;inset-inline-start:4px;position:relative}.uppy-ProviderBrowser-header{border-bottom:1px solid #eaeaea;position:relative;z-index:1001}[data-uppy-theme=dark] .uppy-ProviderBrowser-header{border-bottom:1px solid #333}.uppy-ProviderBrowser-headerBar{background-color:#fafafa;color:#757575;font-size:12px;line-height:1.4;padding:7px 15px;z-index:1001}.uppy-size--md .uppy-ProviderBrowser-headerBar{align-items:center;display:flex}[data-uppy-theme=dark] .uppy-ProviderBrowser-headerBar{background-color:#1f1f1f}.uppy-ProviderBrowser-headerBar--simple{display:block;justify-content:center;text-align:center}.uppy-ProviderBrowser-headerBar--simple .uppy-Provider-breadcrumbsWrap{display:inline-block;flex:none;vertical-align:middle}.uppy-ProviderBrowser-searchFilter{align-items:center;display:flex;height:30px;margin-bottom:15px;margin-top:15px;padding-left:8px;padding-right:8px;position:relative;width:100%}.uppy-ProviderBrowser-searchFilterInput{background-color:#eaeaea;border:0;border-radius:4px;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;font-size:13px;height:30px;line-height:1.4;outline:0;padding-inline-end:30px;padding-inline-start:30px;width:100%;z-index:1001}.uppy-ProviderBrowser-searchFilterInput::-webkit-search-cancel-button{display:none}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput{background-color:#1f1f1f;color:#eaeaea}.uppy-ProviderBrowser-searchFilterInput:focus{background-color:#cfcfcf;border:0}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput:focus{background-color:#333}.uppy-ProviderBrowser-searchFilterIcon{color:#757575;height:12px;inset-inline-start:16px;position:absolute;width:12px;z-index:1002}.uppy-ProviderBrowser-searchFilterInput::-moz-placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterInput::placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterReset{border-radius:3px;color:#939393;cursor:pointer;height:22px;inset-inline-end:16px;padding:6px;position:absolute;width:22px;z-index:1002}.uppy-ProviderBrowser-searchFilterReset:focus{outline:none}.uppy-ProviderBrowser-searchFilterReset::-moz-focus-inner{border:0}.uppy-ProviderBrowser-searchFilterReset:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-searchFilterReset:hover{color:#757575}.uppy-ProviderBrowser-searchFilterReset svg{vertical-align:text-top}.uppy-ProviderBrowser-userLogout{border-radius:3px;color:#1269cf;cursor:pointer;line-height:inherit;padding:4px}.uppy-ProviderBrowser-userLogout:focus{outline:none}.uppy-ProviderBrowser-userLogout::-moz-focus-inner{border:0}.uppy-ProviderBrowser-userLogout:hover{color:#0e51a0}.uppy-ProviderBrowser-userLogout:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout:focus{background-color:#333}.uppy-ProviderBrowser-userLogout:hover{text-decoration:underline}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout{color:#eaeaea}.uppy-ProviderBrowser-body{flex:1;position:relative}.uppy-ProviderBrowser-list{background-color:#fff;border-spacing:0;display:block;flex:1;height:100%;inset:0;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;width:100%;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-ProviderBrowser-list{background-color:#1f1f1f}.uppy-ProviderBrowser-list:focus{outline:none}.uppy-ProviderBrowserItem-inner{cursor:pointer;font-size:13px;font-weight:500}.uppy-ProviderBrowser-footer{align-items:center;background-color:#fff;border-top:1px solid #eaeaea;display:flex;justify-content:space-between;padding:15px}.uppy-ProviderBrowser-footer button{margin-inline-end:8px}[data-uppy-theme=dark] .uppy-ProviderBrowser-footer{background-color:#1f1f1f;border-top:1px solid #333}.uppy-ProviderBrowser-footer-buttons{flex-shrink:0}.uppy-ProviderBrowser-footer-error{color:#e32437;line-height:18px}@media(max-width:426px){.uppy-ProviderBrowser-footer{align-items:stretch;flex-direction:column-reverse}.uppy-ProviderBrowser-footer-error{padding-bottom:10px}}.picker-dialog-bg{z-index:20000!important}.picker-dialog{z-index:20001!important}.uppy-Dashboard-Item-previewInnerWrap{align-items:center;border-radius:3px;box-shadow:0 0 2px #0006;display:flex;flex-direction:column;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.uppy-size--md .uppy-Dashboard-Item-previewInnerWrap{box-shadow:0 1px 2px #00000026}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewInnerWrap{box-shadow:none}.uppy-Dashboard-Item-previewInnerWrap:after{background-color:#000000a6;content:"";display:none;inset:0;position:absolute;z-index:1001}.uppy-Dashboard-Item-previewLink{inset:0;position:absolute;z-index:1002}.uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #579df0}[data-uppy-theme=dark] .uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #016c8d}.uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;height:100%;-o-object-fit:cover;object-fit:cover;transform:translateZ(0);width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{height:auto;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;padding:10px;width:auto}.uppy-Dashboard-Item-progress{color:#fff;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%);transition:all .35 ease;width:120px;z-index:1002}.uppy-Dashboard-Item-progressIndicator{color:#fff;display:inline-block;height:38px;opacity:.9;width:38px}.uppy-size--md .uppy-Dashboard-Item-progressIndicator{height:55px;width:55px}button.uppy-Dashboard-Item-progressIndicator{cursor:pointer}button.uppy-Dashboard-Item-progressIndicator:focus{outline:none}button.uppy-Dashboard-Item-progressIndicator::-moz-focus-inner{border:0}button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--bg,button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--retry{fill:#579df0}.uppy-Dashboard-Item-progressIcon--circle{height:100%;width:100%}.uppy-Dashboard-Item-progressIcon--bg{stroke:#fff6}.uppy-Dashboard-Item-progressIcon--progress{transition:stroke-dashoffset .5s ease-out;stroke:#fff}.uppy-Dashboard-Item-progressIcon--play{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--cancel{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--pause{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--check{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--retry{fill:#fff}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{inset-inline-end:-8px;inset-inline-start:auto;top:-9px;transform:none;width:auto}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:18px;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:28px;width:28px}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:18px;opacity:1;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:22px;width:22px}.uppy-Dashboard-Item.is-processing .uppy-Dashboard-Item-progress{opacity:0}.uppy-Dashboard-Item-fileInfo{padding-inline-end:5px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:10px}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:15px}.uppy-Dashboard-Item-name{font-size:12px;font-weight:500;line-height:1.3;margin-bottom:5px;word-wrap:anywhere;word-break:break-all}[data-uppy-theme=dark] .uppy-Dashboard-Item-name{color:#eaeaea}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-name{font-size:14px;line-height:1.4}.uppy-Dashboard-Item-fileName{align-items:baseline;display:flex}.uppy-Dashboard-Item-fileName button{margin-left:5px}.uppy-Dashboard-Item-author{color:#757575;display:inline-block;font-size:11px;font-weight:400;line-height:1;margin-bottom:5px;vertical-align:bottom}.uppy-Dashboard-Item-author a{color:#757575}.uppy-Dashboard-Item-status{color:#757575;font-size:11px;font-weight:400;line-height:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-status{color:#bbb}.uppy-Dashboard-Item-statusSize{display:inline-block;margin-bottom:5px;text-transform:uppercase;vertical-align:bottom}.uppy-Dashboard-Item-reSelect{color:#1269cf;font-family:inherit;font-size:inherit;font-weight:600}.uppy-Dashboard-Item-errorMessage{background-color:#fdeff1;color:#a51523;font-size:11px;font-weight:500;line-height:1.3;padding:5px 6px}.uppy-Dashboard-Item-errorMessageBtn{color:#a51523;cursor:pointer;font-size:11px;font-weight:500;text-decoration:underline}.uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{display:none}.uppy-size--md .uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-top:1px solid #f7c2c8;bottom:0;display:block;left:0;line-height:1.4;padding:6px 8px;position:absolute;right:0}.uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{border:1px solid #f7c2c8;border-radius:3px;display:inline-block;position:static}.uppy-size--md .uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{display:none}.uppy-Dashboard-Item-action{color:#939393;cursor:pointer}.uppy-Dashboard-Item-action:focus{outline:none}.uppy-Dashboard-Item-action::-moz-focus-inner{border:0}.uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-Item-action:hover{color:#1f1f1f;opacity:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-action{color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{outline:none}[data-uppy-theme=dark] .uppy-Dashboard-Item-action::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:hover{color:#eaeaea}.uppy-Dashboard-Item-action--remove{color:#1f1f1f;opacity:.95}.uppy-Dashboard-Item-action--remove:hover{color:#000;opacity:1}.uppy-size--md .uppy-Dashboard-Item-action--remove{height:18px;inset-inline-end:-8px;padding:0;position:absolute;top:-8px;width:18px;z-index:1002}.uppy-size--md .uppy-Dashboard-Item-action--remove:focus{border-radius:50%}.uppy-Dashboard--singleFile.uppy-size--height-md .uppy-Dashboard-Item-action--remove{inset-inline-end:8px;position:absolute;top:8px}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove{color:#525252}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove:hover{color:#333}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-actionWrapper{align-items:center;display:flex}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action{height:22px;margin-left:3px;padding:3px;width:22px}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action:focus{border-radius:3px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink,.uppy-size--md .uppy-Dashboard-Item-action--edit{height:16px;padding:0;width:16px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink:focus,.uppy-size--md .uppy-Dashboard-Item-action--edit:focus{border-radius:3px}.uppy-Dashboard-Item{align-items:center;border-bottom:1px solid #eaeaea;display:flex;padding:10px}.uppy-Dashboard:not(.uppy-Dashboard--singleFile) .uppy-Dashboard-Item{padding-inline-end:0}[data-uppy-theme=dark] .uppy-Dashboard-Item{border-bottom:1px solid #333}.uppy-size--md .uppy-Dashboard-Item{border-bottom:0;display:block;float:inline-start;height:215px;margin:5px 15px;padding:0;position:relative;width:calc(33.333% - 30px)}.uppy-size--lg .uppy-Dashboard-Item{height:190px;margin:5px 15px;padding:0;width:calc(25% - 30px)}.uppy-size--xl .uppy-Dashboard-Item{height:210px;padding:0;width:calc(20% - 30px)}.uppy-Dashboard--singleFile .uppy-Dashboard-Item{border-bottom:0;display:flex;flex-direction:column;height:100%;max-width:400px;padding:15px;position:relative;width:100%}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-previewInnerWrap{opacity:.2}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-name{opacity:.7}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='35' height='39' viewBox='0 0 35 39'%3E%3Cpath fill='%2523000' d='M1.708 38.66c1.709 0 3.417-3.417 6.834-3.417s5.125 3.417 8.61 3.417c3.348 0 5.056-3.417 8.473-3.417 4.305 0 5.125 3.417 6.833 3.417.889 0 1.709-.889 1.709-1.709v-19.68C34.167-5.757 0-5.757 0 17.271v19.68c0 .82.888 1.709 1.708 1.709m8.542-17.084a3.383 3.383 0 0 1-3.417-3.416 3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.417 3.417 3.383 3.383 0 0 1-3.417 3.416m13.667 0A3.383 3.383 0 0 1 20.5 18.16a3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.416 3.417 3.383 3.383 0 0 1-3.416 3.416'/%3E%3C/svg%3E");background-position:50% 10px;background-repeat:no-repeat;background-size:25px;content:"";inset:0;opacity:.5;position:absolute;z-index:1005}.uppy-size--md .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:40px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:30%}.uppy-Dashboard-Item-preview{flex-grow:0;flex-shrink:0;height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-Item-preview{height:140px;width:100%}.uppy-size--lg .uppy-Dashboard-Item-preview{height:120px}.uppy-size--xl .uppy-Dashboard-Item-preview{height:140px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview{flex-grow:1;max-height:75%;width:100%}.uppy-Dashboard--singleFile.uppy-size--md .uppy-Dashboard-Item-preview{max-height:100%}.uppy-Dashboard-Item-fileInfoAndButtons{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-inline-end:8px;padding-inline-start:12px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons,.uppy-size--md .uppy-Dashboard-Item-fileInfoAndButtons{align-items:flex-start;padding:9px 0 0}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons{flex-grow:0;width:100%}.uppy-Dashboard-Item-fileInfo{flex-grow:1;flex-shrink:1}.uppy-Dashboard-Item-actionWrapper{flex-grow:0;flex-shrink:0}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-previewInnerWrap:after,.uppy-Dashboard-Item.is-inprogress .uppy-Dashboard-Item-previewInnerWrap:after{display:block}.uppy-Dashboard-Item-errorDetails{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border:none;border-radius:50%;color:#fff;cursor:help;flex-shrink:0;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;width:13px}.uppy-Dashboard-Item-errorDetails:after{line-height:1.3;word-wrap:break-word}.uppy-Dashboard-FileCard{background-color:#fff;border-radius:5px;box-shadow:0 0 10px 4px #0000001a;display:flex;flex-direction:column;height:100%;inset:0;position:absolute;width:100%;z-index:1005}.uppy-Dashboard-FileCard .uppy-DashboardContent-bar{border-top-left-radius:5px;border-top-right-radius:5px}.uppy-Dashboard-FileCard .uppy-Dashboard-FileCard-actions{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.uppy-Dashboard-FileCard-inner{display:flex;flex-direction:column;flex-grow:1;flex-shrink:1;height:100%;min-height:0}.uppy-Dashboard-FileCard-preview{align-items:center;border-bottom:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:1;height:60%;justify-content:center;min-height:0;position:relative}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-preview{background-color:#333;border-bottom:0}.uppy-Dashboard-FileCard-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;box-shadow:0 3px 20px #00000026;flex:0 0 auto;max-height:90%;max-width:90%;-o-object-fit:cover;object-fit:cover}.uppy-Dashboard-FileCard-edit{background-color:#00000080;border-radius:50px;color:#fff;font-size:13px;inset-inline-end:10px;padding:7px 15px;position:absolute;top:10px}.uppy-Dashboard-FileCard-edit:focus{outline:none}.uppy-Dashboard-FileCard-edit::-moz-focus-inner{border:0}.uppy-Dashboard-FileCard-edit:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-FileCard-edit:hover{background-color:#000c}.uppy-Dashboard-FileCard-info{flex-grow:0;flex-shrink:0;height:40%;overflow-y:auto;padding:30px 20px 20px;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-info{background-color:#1f1f1f}.uppy-Dashboard-FileCard-fieldset{border:0;font-size:0;margin:auto auto 12px;max-width:640px;padding:0}.uppy-Dashboard-FileCard-label{color:#525252;display:inline-block;font-size:12px;vertical-align:middle;width:22%}.uppy-size--md .uppy-Dashboard-FileCard-label{font-size:14px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-label{color:#eaeaea}.uppy-Dashboard-FileCard-input{display:inline-block;vertical-align:middle;width:78%}.uppy-Dashboard-FileCard-actions{align-items:center;background-color:#fafafa;border-top:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:0;height:55px;padding:0 15px}.uppy-size--md .uppy-Dashboard-FileCard-actions{height:65px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-actions{background-color:#1f1f1f;border-top:1px solid #333}.uppy-Dashboard-FileCard-actionsBtn{margin-inline-end:10px}.uppy-Informer{bottom:60px;left:0;position:absolute;right:0;text-align:center;z-index:1005}.uppy-Informer span>div{margin-bottom:6px}.uppy-Informer-animated{opacity:0;transform:translateY(350%);transition:all .3s ease-in;z-index:-1000}.uppy-Informer p{background-color:#757575;border-radius:18px;color:#fff;display:inline-block;font-size:12px;font-weight:400;line-height:1.4;margin:0;max-width:90%;padding:6px 15px}.uppy-size--md .uppy-Informer p{font-size:14px;line-height:1.3;max-width:500px;padding:10px 20px}[data-uppy-theme=dark] .uppy-Informer p{background-color:#333}.uppy-Informer p span{background-color:#fff;border-radius:50%;color:#525252;display:inline-block;font-size:10px;height:13px;inset-inline-start:3px;line-height:12px;margin-inline-start:-1px;position:relative;top:-1px;vertical-align:middle;width:13px}.uppy-Informer p span:hover{cursor:help}.uppy-Informer p span:after{line-height:1.3;word-wrap:break-word}.uppy-Root [aria-label][role~=tooltip]{position:relative}.uppy-Root [aria-label][role~=tooltip]:after,.uppy-Root [aria-label][role~=tooltip]:before{backface-visibility:hidden;box-sizing:border-box;opacity:0;pointer-events:none;position:absolute;transform:translateZ(0);transform-origin:top;transition:all var(--microtip-transition-duration,.18s) var(--microtip-transition-easing,ease-in-out) var(--microtip-transition-delay,0s);will-change:transform;z-index:10}.uppy-Root [aria-label][role~=tooltip]:before{background-size:100% auto!important;content:""}.uppy-Root [aria-label][role~=tooltip]:after{background:#111111e6;border-radius:4px;box-sizing:initial;color:#fff;content:attr(aria-label);font-size:var(--microtip-font-size,13px);font-weight:var(--microtip-font-weight,normal);padding:.5em 1em;text-transform:var(--microtip-text-transform,none);white-space:nowrap}.uppy-Root [aria-label][role~=tooltip]:focus:after,.uppy-Root [aria-label][role~=tooltip]:focus:before,.uppy-Root [aria-label][role~=tooltip]:hover:after,.uppy-Root [aria-label][role~=tooltip]:hover:before{opacity:1;pointer-events:auto}.uppy-Root [role~=tooltip][data-microtip-position|=top]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M2.658 0h32.004c-6 0-11.627 12.002-16.002 12.002S8.594 0 2.658 0'/%3E%3C/svg%3E") no-repeat;bottom:100%;height:6px;left:50%;margin-bottom:5px;transform:translate3d(-50%,0,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=top]:after{bottom:100%;left:50%;margin-bottom:11px;transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=top]:hover:before{transform:translate3d(-50%,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:after{bottom:100%;transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:hover:after{transform:translate3d(calc(-100% + 16px),-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:after{bottom:100%;transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:hover:after{transform:translate3d(-16px,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M33.342 12H1.338c6 0 11.627-12.002 16.002-12.002S27.406 12 33.342 12'/%3E%3C/svg%3E") no-repeat;bottom:auto;height:6px;left:50%;margin-bottom:0;margin-top:5px;top:100%;transform:translate3d(-50%,-10px,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:after{left:50%;margin-top:11px;top:100%;transform:translate3d(-50%,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:hover:before{transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:after{top:100%;transform:translate3d(calc(-100% + 16px),-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:hover:after{transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:after{top:100%;transform:translate3d(-16px,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:hover:after{transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:before{inset:50% 100% auto auto;transform:translate3d(10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M0 33.342V1.338c0 6 12.002 11.627 12.002 16.002S0 27.406 0 33.342'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-right:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=left]:after{margin-right:11px}.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:before{bottom:auto;left:100%;top:50%;transform:translate3d(-10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M12 2.658v32.004c0-6-12.002-11.627-12.002-16.002S12 8.594 12 2.658'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-left:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=right]:after{margin-left:11px}.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-size=small]:after{white-space:normal;width:80px}.uppy-Root [role~=tooltip][data-microtip-size=medium]:after{white-space:normal;width:150px}.uppy-Root [role~=tooltip][data-microtip-size=large]:after{white-space:normal;width:260px}.uppy-StatusBar{background-color:#fff;color:#fff;display:flex;font-size:12px;font-weight:400;height:46px;line-height:40px;position:relative;transition:height .2s;z-index:1001}[data-uppy-theme=dark] .uppy-StatusBar{background-color:#1f1f1f}.uppy-StatusBar:before{background-color:#eaeaea;content:"";height:2px;inset:0;position:absolute;width:100%}[data-uppy-theme=dark] .uppy-StatusBar:before{background-color:#757575}.uppy-StatusBar[aria-hidden=true]{height:0;overflow-y:hidden}.uppy-StatusBar.is-complete .uppy-StatusBar-progress{background-color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-progress{background-color:#e32437}.uppy-StatusBar.is-complete .uppy-StatusBar-statusIndicator{color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-statusIndicator{color:#e32437}.uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#fff;border-top:1px solid #eaeaea;height:65px}[data-uppy-theme=dark] .uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#1f1f1f;border-top:1px solid #333}.uppy-StatusBar-progress{background-color:#1269cf;height:2px;position:absolute;transition:background-color,width .3s ease-out;z-index:1001}.uppy-StatusBar-progress.is-indeterminate{animation:uppy-StatusBar-ProgressStripes 1s linear infinite;background-image:linear-gradient(45deg,#0000004d 25%,#0000 0 50%,#0000004d 0 75%,#0000 0,#0000);background-size:64px 64px}@keyframes uppy-StatusBar-ProgressStripes{0%{background-position:0 0}to{background-position:64px 0}}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-progress,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-progress{background-color:#f6a623}.uppy-StatusBar.is-waiting .uppy-StatusBar-progress{display:none}.uppy-StatusBar-content{align-items:center;color:#333;display:flex;height:100%;padding-inline-start:10px;position:relative;text-overflow:ellipsis;white-space:nowrap;z-index:1002}.uppy-size--md .uppy-StatusBar-content{padding-inline-start:15px}[data-uppy-theme=dark] .uppy-StatusBar-content{color:#eaeaea}.uppy-StatusBar-status{display:flex;flex-direction:column;font-weight:400;justify-content:center;line-height:1.4;padding-inline-end:.3em}.uppy-StatusBar-statusPrimary{display:flex;font-weight:500;line-height:1}.uppy-StatusBar-statusPrimary button.uppy-StatusBar-details{margin-left:5px}[data-uppy-theme=dark] .uppy-StatusBar-statusPrimary{color:#eaeaea}.uppy-StatusBar-statusSecondary{color:#757575;display:inline-block;font-size:11px;line-height:1.2;margin-top:1px;white-space:nowrap}[data-uppy-theme=dark] .uppy-StatusBar-statusSecondary{color:#bbb}.uppy-StatusBar-statusSecondaryHint{display:inline-block;line-height:1;margin-inline-end:5px;vertical-align:middle}.uppy-size--md .uppy-StatusBar-statusSecondaryHint{margin-inline-end:8px}.uppy-StatusBar-statusIndicator{color:#525252;margin-inline-end:7px;position:relative;top:1px}.uppy-StatusBar-statusIndicator svg{vertical-align:text-bottom}.uppy-StatusBar-actions{align-items:center;bottom:0;display:flex;inset-inline-end:10px;position:absolute;top:0;z-index:1004}.uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#fafafa;height:100%;padding:0 15px;position:static;width:100%}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#1f1f1f}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:column;height:90px}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:row;height:65px}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:column;justify-content:center}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:row;justify-content:normal}.uppy-StatusBar-actionCircleBtn{cursor:pointer;line-height:1;margin:3px;opacity:.9}.uppy-StatusBar-actionCircleBtn:focus{outline:none}.uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}.uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionCircleBtn:hover{opacity:1}.uppy-StatusBar-actionCircleBtn:focus{border-radius:50%}.uppy-StatusBar-actionCircleBtn svg{vertical-align:bottom}.uppy-StatusBar-actionBtn{color:#1269cf;display:inline-block;font-size:10px;line-height:inherit;vertical-align:middle}.uppy-size--md .uppy-StatusBar-actionBtn{font-size:11px}.uppy-StatusBar-actionBtn--disabled{opacity:.4}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--disabled{opacity:.7}.uppy-StatusBar-actionBtn--retry{background-color:#ff4b23;border-radius:8px;color:#fff;height:16px;line-height:1;margin-inline-end:6px;padding:1px 6px 3px 18px;position:relative}.uppy-StatusBar-actionBtn--retry:focus{outline:none}.uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionBtn--retry:hover{background-color:#f92d00}.uppy-StatusBar-actionBtn--retry svg{inset-inline-start:6px;position:absolute;top:3px}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1bb240;color:#fff;font-size:14px;line-height:1;padding:15px 10px;width:100%}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#189c38}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1c8b37}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#18762f}.uppy-size--md .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{padding:13px 22px;width:auto}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1bb240;cursor:not-allowed}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1c8b37}.uppy-StatusBar:not(.is-waiting) .uppy-StatusBar-actionBtn--upload{background-color:initial;color:#1269cf}.uppy-StatusBar-actionBtn--uploadNewlyAdded{border-radius:3px;padding-inline-end:3px;padding-bottom:1px;padding-inline-start:3px}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}.uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded{display:none}.uppy-StatusBar-actionBtn--done{border-radius:3px;line-height:1;padding:7px 8px}.uppy-StatusBar-actionBtn--done:focus{outline:none}.uppy-StatusBar-actionBtn--done::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--done:hover{color:#0e51a0}.uppy-StatusBar-actionBtn--done:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done:focus{background-color:#333}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done{color:#02baf2}.uppy-size--md .uppy-StatusBar-actionBtn--done{font-size:14px}.uppy-StatusBar-serviceMsg{color:#000;font-size:11px;line-height:1.1;padding-left:10px}.uppy-size--md .uppy-StatusBar-serviceMsg{font-size:14px;padding-left:15px}[data-uppy-theme=dark] .uppy-StatusBar-serviceMsg{color:#eaeaea}.uppy-StatusBar-serviceMsg-ghostsIcon{left:6px;opacity:.5;position:relative;top:2px;vertical-align:text-bottom;width:10px}.uppy-size--md .uppy-StatusBar-serviceMsg-ghostsIcon{left:10px;top:1px;width:15px}.uppy-StatusBar-details{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border-radius:50%;color:#fff;cursor:help;display:inline-block;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;vertical-align:middle;width:13px}.uppy-StatusBar-details:after{line-height:1.3;word-wrap:break-word}.uppy-StatusBar-spinner{animation-duration:1s;animation-iteration-count:infinite;animation-name:uppy-StatusBar-spinnerAnimation;animation-timing-function:linear;fill:#1269cf;margin-inline-end:10px}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-spinner,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-spinner{fill:#f6a623}@keyframes uppy-StatusBar-spinnerAnimation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.uppy-transition-slideDownUp-enter{opacity:.01;transform:translate3d(0,-105%,0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-enter.uppy-transition-slideDownUp-enter-active{opacity:1;transform:translateZ(0)}.uppy-transition-slideDownUp-leave{opacity:1;transform:translateZ(0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-leave.uppy-transition-slideDownUp-leave-active{opacity:.01;transform:translate3d(0,-105%,0)}@keyframes uppy-Dashboard-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes uppy-Dashboard-fadeOut{0%{opacity:1}to{opacity:0}}@keyframes uppy-Dashboard-slideDownAndFadeIn{0%{opacity:0;transform:translate3d(-50%,-70%,0)}to{opacity:1;transform:translate3d(-50%,-50%,0)}}@keyframes uppy-Dashboard-slideDownAndFadeIn--small{0%{opacity:0;transform:translate3d(0,-20%,0)}to{opacity:1;transform:translateZ(0)}}@keyframes uppy-Dashboard-slideUpFadeOut{0%{opacity:1;transform:translate3d(-50%,-50%,0)}to{opacity:0;transform:translate3d(-50%,-70%,0)}}@keyframes uppy-Dashboard-slideUpFadeOut--small{0%{opacity:1;transform:translateZ(0)}to{opacity:0;transform:translate3d(0,-20%,0)}}.uppy-Dashboard--modal{z-index:1001}.uppy-Dashboard--modal[aria-hidden=true]{display:none}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeIn .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeOut .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard-isFixed{height:100vh;overflow:hidden}.uppy-Dashboard--modal .uppy-Dashboard-overlay{background-color:#00000080;inset:0;position:fixed;z-index:1001}.uppy-Dashboard-inner{background-color:#f4f4f4;border:1px solid #eaeaea;border-radius:5px;max-height:100%;max-width:100%;outline:none;position:relative}.uppy-size--md .uppy-Dashboard-inner{min-height:auto}@media only screen and (min-width:820px){.uppy-Dashboard-inner{height:500px;width:650px}}.uppy-Dashboard--modal .uppy-Dashboard-inner{z-index:1002}[data-uppy-theme=dark] .uppy-Dashboard-inner{background-color:#1f1f1f}.uppy-Dashboard--isDisabled .uppy-Dashboard-inner{cursor:not-allowed}.uppy-Dashboard-innerWrap{border-radius:5px;display:flex;flex-direction:column;height:100%;opacity:0;overflow:hidden;position:relative}.uppy-Dashboard--isInnerWrapVisible .uppy-Dashboard-innerWrap{opacity:1}.uppy-Dashboard--isDisabled .uppy-Dashboard-innerWrap{cursor:not-allowed;filter:grayscale(100%);opacity:.6;-webkit-user-select:none;-moz-user-select:none;user-select:none}.uppy-Dashboard--isDisabled .uppy-ProviderIconBg{fill:#9f9f9f}.uppy-Dashboard--isDisabled [aria-disabled],.uppy-Dashboard--isDisabled [disabled]{cursor:not-allowed;pointer-events:none}.uppy-Dashboard--modal .uppy-Dashboard-inner{border:none;inset:35px 15px 15px;position:fixed}@media only screen and (min-width:820px){.uppy-Dashboard--modal .uppy-Dashboard-inner{box-shadow:0 5px 15px 4px #00000026;left:50%;right:auto;top:50%;transform:translate(-50%,-50%)}}.uppy-Dashboard-close{color:#ffffffe6;cursor:pointer;display:block;font-size:27px;inset-inline-end:-2px;position:absolute;top:-33px;z-index:1005}.uppy-Dashboard-close:focus{outline:none}.uppy-Dashboard-close::-moz-focus-inner{border:0}.uppy-Dashboard-close:focus{color:#6eabf2}@media only screen and (min-width:820px){.uppy-Dashboard-close{font-size:35px;inset-inline-end:-35px;top:-10px}}.uppy-Dashboard-serviceMsg{background-color:#fffbf7;border-bottom:1px solid #edd4b9;border-top:1px solid #edd4b9;font-size:12px;font-weight:500;line-height:1.3;padding:12px 0;position:relative;top:-1px;z-index:1004}.uppy-size--md .uppy-Dashboard-serviceMsg{font-size:14px;line-height:1.4}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg{background-color:#1f1f1f;border-bottom:1px solid #333;border-top:1px solid #333;color:#eaeaea}.uppy-Dashboard-serviceMsg-title{display:block;line-height:1;margin-bottom:4px;padding-left:42px}.uppy-Dashboard-serviceMsg-text{padding:0 15px}.uppy-Dashboard-serviceMsg-actionBtn{color:#1269cf;font-size:inherit;font-weight:inherit;vertical-align:initial}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg-actionBtn{color:#02baf2e6}.uppy-Dashboard-serviceMsg-icon{left:15px;position:absolute;top:10px}.uppy-Dashboard-AddFiles{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;position:relative;text-align:center}[data-uppy-drag-drop-supported=true] .uppy-Dashboard-AddFiles{border:1px dashed #dfdfdf;border-radius:3px;height:calc(100% - 14px);margin:7px}.uppy-Dashboard-AddFilesPanel .uppy-Dashboard-AddFiles{border:none;height:calc(100% - 54px)}.uppy-Dashboard--modal .uppy-Dashboard-AddFiles{border-color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles{border-color:#757575}.uppy-Dashboard-AddFiles-info{display:none;margin-top:auto;padding-bottom:15px;padding-top:15px}.uppy-size--height-md .uppy-Dashboard-AddFiles-info{display:block}.uppy-size--md .uppy-Dashboard-AddFiles-info{bottom:25px;left:0;padding-bottom:0;padding-top:30px;position:absolute;right:0}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-info{margin-top:0}.uppy-Dashboard-browse{color:#1269cf;cursor:pointer}.uppy-Dashboard-browse:focus{outline:none}.uppy-Dashboard-browse::-moz-focus-inner{border:0}.uppy-Dashboard-browse:focus,.uppy-Dashboard-browse:hover{border-bottom:1px solid #1269cf}[data-uppy-theme=dark] .uppy-Dashboard-browse{color:#02baf2e6}[data-uppy-theme=dark] .uppy-Dashboard-browse:focus,[data-uppy-theme=dark] .uppy-Dashboard-browse:hover{border-bottom:1px solid #02baf2}.uppy-Dashboard-browseBtn{display:block;font-size:14px;font-weight:500;margin-bottom:5px;margin-top:8px;width:100%}.uppy-size--md .uppy-Dashboard-browseBtn{font-size:15px;margin:15px auto;padding:13px 44px;width:auto}.uppy-Dashboard-AddFiles-list{display:flex;flex:1;flex-direction:column;margin-top:2px;overflow-y:auto;padding:2px 0;width:100%;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-AddFiles-list{flex:none;flex-direction:row;flex-wrap:wrap;justify-content:center;margin-top:15px;max-width:600px;overflow-y:visible;padding-top:0}.uppy-DashboardTab{border-bottom:1px solid #eaeaea;text-align:center;width:100%}[data-uppy-theme=dark] .uppy-DashboardTab{border-bottom:1px solid #333}.uppy-size--md .uppy-DashboardTab{border-bottom:none;display:inline-block;margin-bottom:10px;width:auto}.uppy-DashboardTab-btn{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:initial;color:#525252;cursor:pointer;flex-direction:row;height:100%;justify-content:left;padding:12px 15px;width:100%}.uppy-DashboardTab-btn:focus{outline:none}.uppy-size--md .uppy-DashboardTab-btn{border-radius:5px;flex-direction:column;margin-inline-end:1px;padding:10px 3px;width:86px}[data-uppy-theme=dark] .uppy-DashboardTab-btn{color:#eaeaea}.uppy-DashboardTab-btn::-moz-focus-inner{border:0}.uppy-DashboardTab-btn:hover{background-color:#e9ecef}[data-uppy-theme=dark] .uppy-DashboardTab-btn:hover{background-color:#333}.uppy-DashboardTab-btn:active,.uppy-DashboardTab-btn:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardTab-btn:active,[data-uppy-theme=dark] .uppy-DashboardTab-btn:focus{background-color:#525252}.uppy-DashboardTab-btn svg{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;transition:transform .15s ease-in-out;vertical-align:text-top}.uppy-DashboardTab-inner{align-items:center;background-color:#fff;border-radius:8px;box-shadow:0 1px 1px #0000001a,0 1px 2px #0000001a,0 2px 3px #00000005;display:flex;height:32px;justify-content:center;margin-inline-end:10px;width:32px}.uppy-size--md .uppy-DashboardTab-inner{margin-inline-end:0}[data-uppy-theme=dark] .uppy-DashboardTab-inner{background-color:#323232;box-shadow:0 1px 1px #0003,0 1px 2px #0003,0 2px 3px #00000014}.uppy-DashboardTab-name{font-size:14px;font-weight:400}.uppy-size--md .uppy-DashboardTab-name{font-size:12px;line-height:15px;margin-bottom:0;margin-top:8px}.uppy-DashboardTab-iconMyDevice{color:#1269cf}[data-uppy-theme=dark] .uppy-DashboardTab-iconMyDevice{color:#02baf2}.uppy-DashboardTab-iconBox{color:#0061d5}[data-uppy-theme=dark] .uppy-DashboardTab-iconBox{color:#eaeaea}.uppy-DashboardTab-iconDropbox{color:#0061fe}[data-uppy-theme=dark] .uppy-DashboardTab-iconDropbox{color:#eaeaea}.uppy-DashboardTab-iconUnsplash{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconUnsplash{color:#eaeaea}.uppy-DashboardTab-iconWebdav{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconWebdav{color:#eaeaea}.uppy-DashboardTab-iconScreenRec{color:#2c3e50}[data-uppy-theme=dark] .uppy-DashboardTab-iconScreenRec{color:#eaeaea}.uppy-DashboardTab-iconAudio{color:#8030a3}[data-uppy-theme=dark] .uppy-DashboardTab-iconAudio{color:#bf6ee3}.uppy-Dashboard-input{height:.1px;opacity:0;overflow:hidden;position:absolute;width:.1px;z-index:-1}.uppy-DashboardContent-bar{align-items:center;background-color:#fafafa;border-bottom:1px solid #eaeaea;display:flex;flex-shrink:0;height:40px;justify-content:space-between;padding:0 10px;position:relative;width:100%;z-index:1004}.uppy-size--md .uppy-DashboardContent-bar{height:50px;padding:0 15px}[data-uppy-theme=dark] .uppy-DashboardContent-bar{background-color:#1f1f1f;border-bottom:1px solid #333}.uppy-DashboardContent-title{font-size:12px;font-weight:500;left:0;line-height:40px;margin:auto;max-width:170px;overflow-x:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0;white-space:nowrap;width:100%}.uppy-size--md .uppy-DashboardContent-title{font-size:14px;line-height:50px;max-width:300px}[data-uppy-theme=dark] .uppy-DashboardContent-title{color:#eaeaea}.uppy-DashboardContent-back,.uppy-DashboardContent-save{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-size:12px;font-weight:400;line-height:1;margin:0;margin-inline-start:-6px;padding:7px 6px}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{outline:none}.uppy-DashboardContent-back::-moz-focus-inner,.uppy-DashboardContent-save::-moz-focus-inner{border:0}.uppy-DashboardContent-back:hover,.uppy-DashboardContent-save:hover{color:#0e51a0}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-back:focus,[data-uppy-theme=dark] .uppy-DashboardContent-save:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-back,.uppy-size--md .uppy-DashboardContent-save{font-size:14px}[data-uppy-theme=dark] .uppy-DashboardContent-back,[data-uppy-theme=dark] .uppy-DashboardContent-save{color:#02baf2}.uppy-DashboardContent-addMore{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:500;height:29px;line-height:1;margin:0;margin-inline-end:-5px;padding:7px 8px;width:29px}.uppy-DashboardContent-addMore:focus{outline:none}.uppy-DashboardContent-addMore::-moz-focus-inner{border:0}.uppy-DashboardContent-addMore:hover{color:#0e51a0}.uppy-DashboardContent-addMore:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-addMore:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-addMore{font-size:14px;height:auto;margin-inline-end:-8px;width:auto}[data-uppy-theme=dark] .uppy-DashboardContent-addMore{color:#02baf2}.uppy-DashboardContent-addMore svg{margin-inline-end:4px;vertical-align:initial}.uppy-size--md .uppy-DashboardContent-addMore svg{height:11px;width:11px}.uppy-DashboardContent-addMoreCaption{display:none}.uppy-size--md .uppy-DashboardContent-addMoreCaption{display:inline}.uppy-DashboardContent-panel{background-color:#f5f5f5;flex:1}.uppy-Dashboard-AddFilesPanel,.uppy-DashboardContent-panel{border-radius:5px;display:flex;flex-direction:column;inset:0;overflow:hidden;position:absolute;z-index:1005}.uppy-Dashboard-AddFilesPanel{background:#fafafa;background:linear-gradient(0deg,#fafafa 35%,#fafafad9);box-shadow:0 0 10px 5px #00000026}[data-uppy-theme=dark] .uppy-Dashboard-AddFilesPanel{background-color:#333;background-image:linear-gradient(0deg,#1f1f1f 35%,#1f1f1fd9)}.uppy-Dashboard--isAddFilesPanelVisible .uppy-Dashboard-files{filter:blur(2px)}.uppy-Dashboard-progress{bottom:0;height:12%;left:0;position:absolute;width:100%}.uppy-Dashboard-progressBarContainer.is-active{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1004}.uppy-Dashboard-filesContainer{flex:1;margin:0;overflow-y:hidden;position:relative}.uppy-Dashboard-filesContainer:after{clear:both;content:"";display:table}.uppy-Dashboard-files{flex:1;margin:0;overflow-y:auto;padding:0 0 10px;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-files{padding-top:10px}.uppy-Dashboard--singleFile .uppy-Dashboard-filesInner{align-items:center;display:flex;height:100%;justify-content:center}.uppy-Dashboard-dropFilesHereHint{align-items:center;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%231269CF' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;border:1px dashed #1269cf;border-radius:3px;color:#757575;display:flex;font-size:16px;justify-content:center;inset:7px;padding-top:90px;position:absolute;text-align:center;visibility:hidden;z-index:2000}[data-uppy-theme=dark] .uppy-Dashboard-dropFilesHereHint{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%2302BAF2' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");border-color:#02baf2;color:#bbb}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-dropFilesHereHint{pointer-events:none;visibility:visible}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-files,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-progressindicators,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-serviceMsg,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-DashboardContent-bar{opacity:.15}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-AddFiles{opacity:.03}.uppy-Dashboard-AddFiles-title{color:#000;font-size:17px;font-weight:500;line-height:1.35;margin-bottom:5px;margin-top:15px;padding:0 15px;text-align:inline-start;width:100%}.uppy-size--md .uppy-Dashboard-AddFiles-title{font-size:21px;font-weight:400;margin-top:5px;max-width:480px;padding:0 35px;text-align:center}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-title{text-align:center}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title{color:#eaeaea}.uppy-Dashboard-AddFiles-title button{font-weight:500}.uppy-size--md .uppy-Dashboard-AddFiles-title button{font-weight:400}.uppy-Dashboard-note{color:#757575;font-size:14px;line-height:1.25;margin:auto;max-width:350px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Dashboard-note{line-height:1.35;max-width:600px}[data-uppy-theme=dark] .uppy-Dashboard-note{color:#cfcfcf}a.uppy-Dashboard-poweredBy{color:#939393;display:inline-block;font-size:11px;margin-top:8px;text-align:center;text-decoration:none}.uppy-Dashboard-poweredByIcon{margin-left:1px;margin-right:1px;opacity:.9;position:relative;top:1px;vertical-align:text-top;fill:none;stroke:#939393}.uppy-Dashboard-Item-previewIcon{height:25px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:25px;z-index:100}.uppy-size--md .uppy-Dashboard-Item-previewIcon{height:38px;width:38px}.uppy-Dashboard-Item-previewIcon svg{height:100%;width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIcon{height:100%;max-height:60%;max-width:60%;width:100%}.uppy-Dashboard-Item-previewIconWrap{height:76px;max-height:75%;position:relative}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIconWrap{height:100%;width:100%}.uppy-Dashboard-Item-previewIconBg{filter:drop-shadow(rgba(0,0,0,.1) 0 1px 1px);height:100%;width:100%}.uppy-Dashboard-upload{height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-upload{height:60px;width:60px}.uppy-Dashboard-upload .uppy-c-icon{position:relative;top:1px;width:50%}.uppy-Dashboard-uploadCount{background-color:#1bb240;border-radius:50%;color:#fff;font-size:8px;height:16px;inset-inline-end:-12px;line-height:16px;position:absolute;top:-12px;width:16px}.uppy-size--md .uppy-Dashboard-uploadCount{font-size:9px;height:18px;line-height:18px;width:18px}.uppy-Dashboard-inner{border:none!important;background:transparent!important}.uppy-Dashboard-innerWrap{border-radius:.5rem;overflow:hidden}.uppy-Dashboard-AddFiles{border:2px dashed hsl(var(--border))!important;border-radius:.5rem!important;background:hsl(var(--muted) / .3)!important;transition:all .2s ease}.uppy-Dashboard-AddFiles:hover{border-color:hsl(var(--primary))!important;background:hsl(var(--muted) / .5)!important}.uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important;font-weight:500!important}.uppy-Dashboard-AddFiles-info{color:hsl(var(--muted-foreground))!important}.uppy-Dashboard-browse{color:hsl(var(--primary))!important;font-weight:500!important}.uppy-Dashboard-browse:hover{text-decoration:underline!important}.uppy-Dashboard-files{background:transparent!important}.uppy-Dashboard-Item{border-bottom-color:hsl(var(--border))!important}.uppy-Dashboard-Item-name{color:hsl(var(--foreground))!important}.uppy-Dashboard-Item-status{color:hsl(var(--muted-foreground))!important}.uppy-StatusBar{background:hsl(var(--muted))!important;border-top:1px solid hsl(var(--border))!important}.uppy-StatusBar-progress{background:hsl(var(--primary))!important}.uppy-StatusBar-content{color:hsl(var(--foreground))!important}.uppy-StatusBar-actionBtn--upload{background:hsl(var(--primary))!important;color:hsl(var(--primary-foreground))!important;border-radius:.375rem!important;font-weight:500!important;padding:.5rem 1rem!important}.uppy-StatusBar-actionBtn--upload:hover{background:hsl(var(--primary) / .9)!important}.uppy-Dashboard-note{color:hsl(var(--muted-foreground))!important;font-size:.75rem!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles,.dark .uppy-Dashboard-AddFiles{background:hsl(var(--muted) / .2)!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title,.dark .uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important}[data-uppy-theme=dark] .uppy-StatusBar,.dark .uppy-StatusBar{background:hsl(var(--muted) / .5)!important}.uppy-Dashboard{font-family:inherit!important}.uppy-Dashboard-Item-preview{border-radius:.375rem!important;overflow:hidden}.uppy-Dashboard-Item-action--remove{color:hsl(var(--destructive))!important}.uppy-Dashboard-Item-action--remove:hover{opacity:.8}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{color:hsl(var(--success, 142 76% 36%))!important}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progress{color:hsl(var(--destructive))!important}.uppy-Dashboard-files::-webkit-scrollbar{width:6px}.uppy-Dashboard-files::-webkit-scrollbar-track{background:transparent}.uppy-Dashboard-files::-webkit-scrollbar-thumb{background:hsl(var(--muted-foreground) / .3);border-radius:3px}.uppy-Dashboard-files::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5)}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.27"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/assets/index-CgxOYrz-.js b/webui/dist/assets/index-CgxOYrz-.js new file mode 100644 index 00000000..1f13752a --- /dev/null +++ b/webui/dist/assets/index-CgxOYrz-.js @@ -0,0 +1,54 @@ +import{r as u,j as e,L as Kn,e as va,R as bt,b as Ub,f as Bb,g as Hb,h as qb,k as tt,l as Gb,m as $b,O as _p,n as Fb}from"./router-Bz250laD.js";import{a as Vb,b as Qb,g as Ib}from"./react-vendor-BmxF9s7Q.js";import{N as Yb,c as Kb,O as tr,P as Ac,g as ju}from"./utils-BXc2jIuz.js";import{L as Sp,T as Cp,C as kp,R as Xb,a as Tp,V as Jb,b as Zb,S as Ep,c as Pb,d as zp,I as Wb,e as Ap,f as eN,g as Mp,h as sN,i as tN,j as aN,O as Dp,P as lN,k as Op,l as Rp,D as Lp,A as Up,m as Bp,n as nN,o as rN,p as Hp,q as iN,r as qp,s as cN,t as oN,u as dN,v as uN,w as mN,x as Gp,y as $p,F as Fp,z as Vp,B as xN,E as hN}from"./radix-extra-DDK-u9dm.js";import{R as fN,T as pN,L as gN,g as jN,C as Mc,X as Dc,Y as Pr,h as vN,B as vu,j as Oc,P as bN,k as NN,l as yN}from"./charts-DbiuC1q1.js";import{S as wN,G as Qp,O as Ip,o as _N,C as Yp,p as SN,T as Kp,D as Xp,R as CN,q as kN,H as Jp,I as TN,J as Zp,K as Pp,L as EN,M as Wp,V as zN,N as eg,Q as sg,U as AN,X as MN,Y as tg,Z as DN,_ as ON,$ as ag,a0 as RN,e as LN,f as UN,c as lg,P as Xc,d as Fu,b as Du,h as BN,l as HN,m as qN,a1 as GN,a2 as ng,a3 as $N,a4 as FN,a5 as VN,a6 as rg,a7 as ig,a8 as cg,a9 as og,aa as dg,ab as ug,ac as QN}from"./radix-core-9dEfQl-6.js";import{R as zt,P as hi,C as aa,a as At,Z as an,b as $c,F as Sa,c as IN,S as ar,d as YN,M as Rl,A as KN,D as XN,e as Fc,f as Pn,T as JN,X as rl,g as ZN,h as PN,I as Ra,i as Ca,j as Qt,k as Vc,E as ci,l as Rt,m as mg,H as WN,n as We,o as Oa,U as oi,p as xg,q as hg,L as Jf,K as fg,r as pg,s as ey,t as Hc,u as it,v as sy,B as ti,w as Qc,x as Vu,y as ty,z as ay,G as Mt,J as Jc,N as er,O as dt,Q as Ll,V as di,W as Qu,Y as fi,_ as ly,$ as ny,a0 as ln,a1 as lr,a2 as il,a3 as Ba,a4 as nr,a5 as Iu,a6 as ry,a7 as iy,a8 as cy,a9 as Ol,aa as oy,ab as gg,ac as Ou,ad as nn,ae as dy,af as sr,ag as uy,ah as Ru,ai as Lu,aj as jg,ak as Zf,al as my,am as xy,an as hy,ao as nl,ap as bu,aq as Pf,ar as fy,as as vg,at as Nu,au as py,av as gy,aw as jy,ax as vy,ay as by,az as bg,aA as Ng,aB as yg,aC as wg,aD as Ny,aE as Wf,aF as yy,aG as wy,aH as _y,aI as Sy}from"./icons-CwAZotQh.js";import{S as Cy,p as ky,j as Ty,a as Ey,E as ep,R as zy,o as Ay}from"./codemirror-BEE0n9kQ.js";import{_ as Kt,c as My,g as _g,D as Dy,z as Rc}from"./misc-CKjrIrIJ.js";import{u as Oy,a as sp,D as Ry,c as Ly,S as Uy,h as By,b as Hy,s as qy,K as Gy,P as $y,d as Fy,C as Vy}from"./dnd-CHfCzWUK.js";import{D as Qy,U as Iy}from"./uppy-BMZiFQyG.js";import{M as Yy,r as Ky,a as Xy,b as Jy}from"./markdown-kUhwkcQP.js";import{c as Zy,H as Ic,P as Yc,u as Py,d as Wy,R as e0,B as s0,e as t0,C as a0,M as l0,f as n0}from"./reactflow-DLoXAt4c.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))d(m);new MutationObserver(m=>{for(const x of m)if(x.type==="childList")for(const f of x.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&d(f)}).observe(document,{childList:!0,subtree:!0});function i(m){const x={};return m.integrity&&(x.integrity=m.integrity),m.referrerPolicy&&(x.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?x.credentials="include":m.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function d(m){if(m.ep)return;m.ep=!0;const x=i(m);fetch(m.href,x)}})();var yu={exports:{}},Wr={},wu={exports:{}},_u={};var tp;function r0(){return tp||(tp=1,(function(n){function r(D,J){var q=D.length;D.push(J);e:for(;0>>1,R=D[se];if(0>>1;sem(_e,q))Cem(ze,_e)?(D[se]=ze,D[Ce]=q,se=Ce):(D[se]=_e,D[me]=q,se=me);else if(Cem(ze,q))D[se]=ze,D[Ce]=q,se=Ce;else break e}}return J}function m(D,J){var q=D.sortIndex-J.sortIndex;return q!==0?q:D.id-J.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;n.unstable_now=function(){return x.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var g=[],b=[],j=1,y=null,N=3,k=!1,w=!1,U=!1,O=!1,B=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function z(D){for(var J=i(b);J!==null;){if(J.callback===null)d(b);else if(J.startTime<=D)d(b),J.sortIndex=J.expirationTime,r(g,J);else break;J=i(b)}}function K(D){if(U=!1,z(D),!w)if(i(g)!==null)w=!0,I||(I=!0,pe());else{var J=i(b);J!==null&&be(K,J.startTime-D)}}var I=!1,T=-1,A=5,te=-1;function fe(){return O?!0:!(n.unstable_now()-teD&&fe());){var se=y.callback;if(typeof se=="function"){y.callback=null,N=y.priorityLevel;var R=se(y.expirationTime<=D);if(D=n.unstable_now(),typeof R=="function"){y.callback=R,z(D),J=!0;break s}y===i(g)&&d(g),z(D)}else d(g);y=i(g)}if(y!==null)J=!0;else{var ue=i(b);ue!==null&&be(K,ue.startTime-D),J=!1}}break e}finally{y=null,N=q,k=!1}J=void 0}}finally{J?pe():I=!1}}}var pe;if(typeof L=="function")pe=function(){L(je)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,ve=he.port2;he.port1.onmessage=je,pe=function(){ve.postMessage(null)}}else pe=function(){B(je,0)};function be(D,J){T=B(function(){D(n.unstable_now())},J)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_forceFrameRate=function(D){0>D||125se?(D.sortIndex=q,r(b,D),i(g)===null&&D===i(b)&&(U?(Y(T),T=-1):U=!0,be(K,q-se))):(D.sortIndex=R,r(g,D),w||k||(w=!0,I||(I=!0,pe()))),D},n.unstable_shouldYield=fe,n.unstable_wrapCallback=function(D){var J=N;return function(){var q=N;N=J;try{return D.apply(this,arguments)}finally{N=q}}}})(_u)),_u}var ap;function i0(){return ap||(ap=1,wu.exports=r0()),wu.exports}var lp;function c0(){if(lp)return Wr;lp=1;var n=i0(),r=Vb(),i=Qb();function d(s){var t="https://react.dev/errors/"+s;if(1R||(s.current=se[R],se[R]=null,R--)}function _e(s,t){R++,se[R]=s.current,s.current=t}var Ce=ue(null),ze=ue(null),ge=ue(null),ae=ue(null);function re(s,t){switch(_e(ge,t),_e(ze,s),_e(Ce,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?vf(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=vf(t),s=bf(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}me(Ce),_e(Ce,s)}function F(){me(Ce),me(ze),me(ge)}function P(s){s.memoizedState!==null&&_e(ae,s);var t=Ce.current,a=bf(t,s.type);t!==a&&(_e(ze,s),_e(Ce,a))}function Te(s){ze.current===s&&(me(Ce),me(ze)),ae.current===s&&(me(ae),Kr._currentValue=q)}var Le,E;function xe(s){if(Le===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Le=t&&t[1]||"",E=-1)":-1c||M[l]!==W[c]){var ce=` +`+M[l].replace(" at new "," at ");return s.displayName&&ce.includes("")&&(ce=ce.replace("",s.displayName)),ce}while(1<=l&&0<=c);break}}}finally{Ye=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?xe(a):""}function Q(s,t){switch(s.tag){case 26:case 27:case 5:return xe(s.type);case 16:return xe("Lazy");case 13:return s.child!==t&&t!==null?xe("Suspense Fallback"):xe("Suspense");case 19:return xe("SuspenseList");case 0:case 15:return ke(s.type,!1);case 11:return ke(s.type.render,!1);case 1:return ke(s.type,!0);case 31:return xe("Activity");default:return""}}function Ne(s){try{var t="",a=null;do t+=Q(s,a),a=s,s=s.return;while(s);return t}catch(l){return` +Error generating stack: `+l.message+` +`+l.stack}}var qe=Object.prototype.hasOwnProperty,Fs=n.unstable_scheduleCallback,ks=n.unstable_cancelCallback,xt=n.unstable_shouldYield,js=n.unstable_requestPaint,Vs=n.unstable_now,X=n.unstable_getCurrentPriorityLevel,He=n.unstable_ImmediatePriority,De=n.unstable_UserBlockingPriority,Ke=n.unstable_NormalPriority,Ns=n.unstable_LowPriority,Je=n.unstable_IdlePriority,Ks=n.log,ye=n.unstable_setDisableYieldValue,_s=null,Ae=null;function vs(s){if(typeof Ks=="function"&&ye(s),Ae&&typeof Ae.setStrictMode=="function")try{Ae.setStrictMode(_s,s)}catch{}}var bs=Math.clz32?Math.clz32:Ss,Nt=Math.log,Xs=Math.LN2;function Ss(s){return s>>>=0,s===0?32:31-(Nt(s)/Xs|0)|0}var Es=256,Js=262144,Ha=4194304;function Lt(s){var t=s&42;if(t!==0)return t;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ol(s,t,a){var l=s.pendingLanes;if(l===0)return 0;var c=0,o=s.suspendedLanes,h=s.pingedLanes;s=s.warmLanes;var v=l&134217727;return v!==0?(l=v&~o,l!==0?c=Lt(l):(h&=v,h!==0?c=Lt(h):a||(a=v&~s,a!==0&&(c=Lt(a))))):(v=l&~o,v!==0?c=Lt(v):h!==0?c=Lt(h):a||(a=l&~s,a!==0&&(c=Lt(a)))),c===0?0:t!==0&&t!==c&&(t&o)===0&&(o=c&-c,a=t&-t,o>=a||o===32&&(a&4194048)!==0)?t:c}function ba(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function _(s,t){switch(s){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function G(){var s=Ha;return Ha<<=1,(Ha&62914560)===0&&(Ha=4194304),s}function we(s){for(var t=[],a=0;31>a;a++)t.push(s);return t}function Ms(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Dt(s,t,a,l,c,o){var h=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var v=s.entanglements,M=s.expirationTimes,W=s.hiddenUpdates;for(a=h&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Aj=/[\n"\\]/g;function ra(s){return s.replace(Aj,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function mo(s,t,a,l,c,o,h,v){s.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?s.type=h:s.removeAttribute("type"),t!=null?h==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+na(t)):s.value!==""+na(t)&&(s.value=""+na(t)):h!=="submit"&&h!=="reset"||s.removeAttribute("value"),t!=null?xo(s,h,na(t)):a!=null?xo(s,h,na(a)):l!=null&&s.removeAttribute("value"),c==null&&o!=null&&(s.defaultChecked=!!o),c!=null&&(s.checked=c&&typeof c!="function"&&typeof c!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?s.name=""+na(v):s.removeAttribute("name")}function mm(s,t,a,l,c,o,h,v){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(s.type=o),t!=null||a!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){uo(s);return}a=a!=null?""+na(a):"",t=t!=null?""+na(t):a,v||t===s.value||(s.value=t),s.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,s.checked=v?s.checked:!!l,s.defaultChecked=!!l,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(s.name=h),uo(s)}function xo(s,t,a){t==="number"&&Ni(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function fn(s,t,a,l){if(s=s.options,t){t={};for(var c=0;c"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jo=!1;if($a)try{var mr={};Object.defineProperty(mr,"passive",{get:function(){jo=!0}}),window.addEventListener("test",mr,mr),window.removeEventListener("test",mr,mr)}catch{jo=!1}var ul=null,vo=null,wi=null;function vm(){if(wi)return wi;var s,t=vo,a=t.length,l,c="value"in ul?ul.value:ul.textContent,o=c.length;for(s=0;s=fr),Sm=" ",Cm=!1;function km(s,t){switch(s){case"keyup":return nv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tm(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var vn=!1;function iv(s,t){switch(s){case"compositionend":return Tm(t);case"keypress":return t.which!==32?null:(Cm=!0,Sm);case"textInput":return s=t.data,s===Sm&&Cm?null:s;default:return null}}function cv(s,t){if(vn)return s==="compositionend"||!_o&&km(s,t)?(s=vm(),wi=vo=ul=null,vn=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-s};s=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Lm(a)}}function Bm(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?Bm(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function Hm(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=Ni(s.document);t instanceof s.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)s=t.contentWindow;else break;t=Ni(s.document)}return t}function ko(s){var t=s&&s.nodeName&&s.nodeName.toLowerCase();return t&&(t==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||t==="textarea"||s.contentEditable==="true")}var pv=$a&&"documentMode"in document&&11>=document.documentMode,bn=null,To=null,vr=null,Eo=!1;function qm(s,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Eo||bn==null||bn!==Ni(l)||(l=bn,"selectionStart"in l&&ko(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),vr&&jr(vr,l)||(vr=l,l=pc(To,"onSelect"),0>=h,c-=h,Ta=1<<32-bs(t)+c|a<es?(ps=Me,Me=null):ps=Me.sibling;var ws=ee(V,Me,Z[es],oe);if(ws===null){Me===null&&(Me=ps);break}s&&Me&&ws.alternate===null&&t(V,Me),H=o(ws,H,es),ys===null?Ge=ws:ys.sibling=ws,ys=ws,Me=ps}if(es===Z.length)return a(V,Me),gs&&Va(V,es),Ge;if(Me===null){for(;eses?(ps=Me,Me=null):ps=Me.sibling;var Dl=ee(V,Me,ws.value,oe);if(Dl===null){Me===null&&(Me=ps);break}s&&Me&&Dl.alternate===null&&t(V,Me),H=o(Dl,H,es),ys===null?Ge=Dl:ys.sibling=Dl,ys=Dl,Me=ps}if(ws.done)return a(V,Me),gs&&Va(V,es),Ge;if(Me===null){for(;!ws.done;es++,ws=Z.next())ws=de(V,ws.value,oe),ws!==null&&(H=o(ws,H,es),ys===null?Ge=ws:ys.sibling=ws,ys=ws);return gs&&Va(V,es),Ge}for(Me=l(Me);!ws.done;es++,ws=Z.next())ws=ne(Me,V,es,ws.value,oe),ws!==null&&(s&&ws.alternate!==null&&Me.delete(ws.key===null?es:ws.key),H=o(ws,H,es),ys===null?Ge=ws:ys.sibling=ws,ys=ws);return s&&Me.forEach(function(Lb){return t(V,Lb)}),gs&&Va(V,es),Ge}function Rs(V,H,Z,oe){if(typeof Z=="object"&&Z!==null&&Z.type===U&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case k:e:{for(var Ge=Z.key;H!==null;){if(H.key===Ge){if(Ge=Z.type,Ge===U){if(H.tag===7){a(V,H.sibling),oe=c(H,Z.props.children),oe.return=V,V=oe;break e}}else if(H.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===A&&Xl(Ge)===H.type){a(V,H.sibling),oe=c(H,Z.props),Sr(oe,Z),oe.return=V,V=oe;break e}a(V,H);break}else t(V,H);H=H.sibling}Z.type===U?(oe=Vl(Z.props.children,V.mode,oe,Z.key),oe.return=V,V=oe):(oe=Di(Z.type,Z.key,Z.props,null,V.mode,oe),Sr(oe,Z),oe.return=V,V=oe)}return h(V);case w:e:{for(Ge=Z.key;H!==null;){if(H.key===Ge)if(H.tag===4&&H.stateNode.containerInfo===Z.containerInfo&&H.stateNode.implementation===Z.implementation){a(V,H.sibling),oe=c(H,Z.children||[]),oe.return=V,V=oe;break e}else{a(V,H);break}else t(V,H);H=H.sibling}oe=Lo(Z,V.mode,oe),oe.return=V,V=oe}return h(V);case A:return Z=Xl(Z),Rs(V,H,Z,oe)}if(be(Z))return Ee(V,H,Z,oe);if(pe(Z)){if(Ge=pe(Z),typeof Ge!="function")throw Error(d(150));return Z=Ge.call(Z),Ie(V,H,Z,oe)}if(typeof Z.then=="function")return Rs(V,H,qi(Z),oe);if(Z.$$typeof===L)return Rs(V,H,Li(V,Z),oe);Gi(V,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,H!==null&&H.tag===6?(a(V,H.sibling),oe=c(H,Z),oe.return=V,V=oe):(a(V,H),oe=Ro(Z,V.mode,oe),oe.return=V,V=oe),h(V)):a(V,H)}return function(V,H,Z,oe){try{_r=0;var Ge=Rs(V,H,Z,oe);return An=null,Ge}catch(Me){if(Me===zn||Me===Bi)throw Me;var ys=Jt(29,Me,null,V.mode);return ys.lanes=oe,ys.return=V,ys}finally{}}}var Zl=ox(!0),dx=ox(!1),pl=!1;function Ko(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xo(s,t){s=s.updateQueue,t.updateQueue===s&&(t.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function gl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function jl(s,t,a){var l=s.updateQueue;if(l===null)return null;if(l=l.shared,(Cs&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=Mi(s),Ym(s,null,a),t}return Ai(s,l,t,a),Mi(s)}function Cr(s,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=s.pendingLanes,a|=l,t.lanes=a,cr(s,a)}}function Jo(s,t){var a=s.updateQueue,l=s.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var c=null,o=null;if(a=a.firstBaseUpdate,a!==null){do{var h={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};o===null?c=o=h:o=o.next=h,a=a.next}while(a!==null);o===null?c=o=t:o=o.next=t}else c=o=t;a={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:o,shared:l.shared,callbacks:l.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=t:s.next=t,a.lastBaseUpdate=t}var Zo=!1;function kr(){if(Zo){var s=En;if(s!==null)throw s}}function Tr(s,t,a,l){Zo=!1;var c=s.updateQueue;pl=!1;var o=c.firstBaseUpdate,h=c.lastBaseUpdate,v=c.shared.pending;if(v!==null){c.shared.pending=null;var M=v,W=M.next;M.next=null,h===null?o=W:h.next=W,h=M;var ce=s.alternate;ce!==null&&(ce=ce.updateQueue,v=ce.lastBaseUpdate,v!==h&&(v===null?ce.firstBaseUpdate=W:v.next=W,ce.lastBaseUpdate=M))}if(o!==null){var de=c.baseState;h=0,ce=W=M=null,v=o;do{var ee=v.lane&-536870913,ne=ee!==v.lane;if(ne?(fs&ee)===ee:(l&ee)===ee){ee!==0&&ee===Tn&&(Zo=!0),ce!==null&&(ce=ce.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var Ee=s,Ie=v;ee=t;var Rs=a;switch(Ie.tag){case 1:if(Ee=Ie.payload,typeof Ee=="function"){de=Ee.call(Rs,de,ee);break e}de=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Ie.payload,ee=typeof Ee=="function"?Ee.call(Rs,de,ee):Ee,ee==null)break e;de=y({},de,ee);break e;case 2:pl=!0}}ee=v.callback,ee!==null&&(s.flags|=64,ne&&(s.flags|=8192),ne=c.callbacks,ne===null?c.callbacks=[ee]:ne.push(ee))}else ne={lane:ee,tag:v.tag,payload:v.payload,callback:v.callback,next:null},ce===null?(W=ce=ne,M=de):ce=ce.next=ne,h|=ee;if(v=v.next,v===null){if(v=c.shared.pending,v===null)break;ne=v,v=ne.next,ne.next=null,c.lastBaseUpdate=ne,c.shared.pending=null}}while(!0);ce===null&&(M=de),c.baseState=M,c.firstBaseUpdate=W,c.lastBaseUpdate=ce,o===null&&(c.shared.lanes=0),wl|=h,s.lanes=h,s.memoizedState=de}}function ux(s,t){if(typeof s!="function")throw Error(d(191,s));s.call(t)}function mx(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;so?o:8;var h=D.T,v={};D.T=v,pd(s,!1,t,a);try{var M=c(),W=D.S;if(W!==null&&W(v,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var ce=Sv(M,l);Ar(s,t,ce,sa(s))}else Ar(s,t,l,sa(s))}catch(de){Ar(s,t,{then:function(){},status:"rejected",reason:de},sa())}finally{J.p=o,h!==null&&v.types!==null&&(h.types=v.types),D.T=h}}function Av(){}function hd(s,t,a,l){if(s.tag!==5)throw Error(d(476));var c=Vx(s).queue;Fx(s,c,t,q,a===null?Av:function(){return Qx(s),a(l)})}function Vx(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:q,baseState:q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ka,lastRenderedState:q},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ka,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function Qx(s){var t=Vx(s);t.next===null&&(t=s.alternate.memoizedState),Ar(s,t.next.queue,{},sa())}function fd(){return Ct(Kr)}function Ix(){return ot().memoizedState}function Yx(){return ot().memoizedState}function Mv(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=sa();s=gl(a);var l=jl(t,s,a);l!==null&&(Ft(l,t,a),Cr(l,t,a)),t={cache:Vo()},s.payload=t;return}t=t.return}}function Dv(s,t,a){var l=sa();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Zi(s)?Xx(t,a):(a=Do(s,t,a,l),a!==null&&(Ft(a,s,l),Jx(a,t,l)))}function Kx(s,t,a){var l=sa();Ar(s,t,a,l)}function Ar(s,t,a,l){var c={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Zi(s))Xx(t,c);else{var o=s.alternate;if(s.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var h=t.lastRenderedState,v=o(h,a);if(c.hasEagerState=!0,c.eagerState=v,Xt(v,h))return Ai(s,t,c,0),Hs===null&&zi(),!1}catch{}finally{}if(a=Do(s,t,c,l),a!==null)return Ft(a,s,l),Jx(a,t,l),!0}return!1}function pd(s,t,a,l){if(l={lane:2,revertLane:Kd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Zi(s)){if(t)throw Error(d(479))}else t=Do(s,a,l,2),t!==null&&Ft(t,s,2)}function Zi(s){var t=s.alternate;return s===Pe||t!==null&&t===Pe}function Xx(s,t){Dn=Vi=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function Jx(s,t,a){if((a&4194048)!==0){var l=t.lanes;l&=s.pendingLanes,a|=l,t.lanes=a,cr(s,a)}}var Mr={readContext:Ct,use:Yi,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useLayoutEffect:at,useInsertionEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useSyncExternalStore:at,useId:at,useHostTransitionStatus:at,useFormState:at,useActionState:at,useOptimistic:at,useMemoCache:at,useCacheRefresh:at};Mr.useEffectEvent=at;var Zx={readContext:Ct,use:Yi,useCallback:function(s,t){return Ot().memoizedState=[s,t===void 0?null:t],s},useContext:Ct,useEffect:Ox,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,Xi(4194308,4,Bx.bind(null,t,s),a)},useLayoutEffect:function(s,t){return Xi(4194308,4,s,t)},useInsertionEffect:function(s,t){Xi(4,2,s,t)},useMemo:function(s,t){var a=Ot();t=t===void 0?null:t;var l=s();if(Pl){vs(!0);try{s()}finally{vs(!1)}}return a.memoizedState=[l,t],l},useReducer:function(s,t,a){var l=Ot();if(a!==void 0){var c=a(t);if(Pl){vs(!0);try{a(t)}finally{vs(!1)}}}else c=t;return l.memoizedState=l.baseState=c,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:c},l.queue=s,s=s.dispatch=Dv.bind(null,Pe,s),[l.memoizedState,s]},useRef:function(s){var t=Ot();return s={current:s},t.memoizedState=s},useState:function(s){s=od(s);var t=s.queue,a=Kx.bind(null,Pe,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:md,useDeferredValue:function(s,t){var a=Ot();return xd(a,s,t)},useTransition:function(){var s=od(!1);return s=Fx.bind(null,Pe,s.queue,!0,!1),Ot().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var l=Pe,c=Ot();if(gs){if(a===void 0)throw Error(d(407));a=a()}else{if(a=t(),Hs===null)throw Error(d(349));(fs&127)!==0||jx(l,t,a)}c.memoizedState=a;var o={value:a,getSnapshot:t};return c.queue=o,Ox(bx.bind(null,l,o,s),[s]),l.flags|=2048,Rn(9,{destroy:void 0},vx.bind(null,l,o,a,t),null),a},useId:function(){var s=Ot(),t=Hs.identifierPrefix;if(gs){var a=Ea,l=Ta;a=(l&~(1<<32-bs(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Qi++,0<\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof l.is=="string"?h.createElement("select",{is:l.is}):h.createElement("select"),l.multiple?o.multiple=!0:l.size&&(o.size=l.size);break;default:o=typeof l.is=="string"?h.createElement(c,{is:l.is}):h.createElement(c)}}o[_t]=t,o[Ut]=l;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)o.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=o;e:switch(Tt(o,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Ja(t)}}return Ys(t),zd(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==l&&Ja(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(d(166));if(s=ge.current,Cn(t)){if(s=t.stateNode,a=t.memoizedProps,l=null,c=St,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}s[_t]=t,s=!!(s.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||gf(s.nodeValue,a)),s||hl(t,!0)}else s=gc(s).createTextNode(l),s[_t]=t,t.stateNode=s}return Ys(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(l=Cn(t),a!==null){if(s===null){if(!l)throw Error(d(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(d(557));s[_t]=t}else Ql(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ys(t),s=!1}else a=qo(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(Pt(t),t):(Pt(t),null);if((t.flags&128)!==0)throw Error(d(558))}return Ys(t),null;case 13:if(l=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(c=Cn(t),l!==null&&l.dehydrated!==null){if(s===null){if(!c)throw Error(d(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(d(317));c[_t]=t}else Ql(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ys(t),c=!1}else c=qo(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Pt(t),t):(Pt(t),null)}return Pt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,s=s!==null&&s.memoizedState!==null,a&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==c&&(l.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),tc(t,t.updateQueue),Ys(t),null);case 4:return F(),s===null&&Pd(t.stateNode.containerInfo),Ys(t),null;case 10:return Ia(t.type),Ys(t),null;case 19:if(me(ct),l=t.memoizedState,l===null)return Ys(t),null;if(c=(t.flags&128)!==0,o=l.rendering,o===null)if(c)Or(l,!1);else{if(lt!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(o=Fi(s),o!==null){for(t.flags|=128,Or(l,!1),s=o.updateQueue,t.updateQueue=s,tc(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)Km(a,s),a=a.sibling;return _e(ct,ct.current&1|2),gs&&Va(t,l.treeForkCount),t.child}s=s.sibling}l.tail!==null&&Vs()>ic&&(t.flags|=128,c=!0,Or(l,!1),t.lanes=4194304)}else{if(!c)if(s=Fi(o),s!==null){if(t.flags|=128,c=!0,s=s.updateQueue,t.updateQueue=s,tc(t,s),Or(l,!0),l.tail===null&&l.tailMode==="hidden"&&!o.alternate&&!gs)return Ys(t),null}else 2*Vs()-l.renderingStartTime>ic&&a!==536870912&&(t.flags|=128,c=!0,Or(l,!1),t.lanes=4194304);l.isBackwards?(o.sibling=t.child,t.child=o):(s=l.last,s!==null?s.sibling=o:t.child=o,l.last=o)}return l.tail!==null?(s=l.tail,l.rendering=s,l.tail=s.sibling,l.renderingStartTime=Vs(),s.sibling=null,a=ct.current,_e(ct,c?a&1|2:a&1),gs&&Va(t,l.treeForkCount),s):(Ys(t),null);case 22:case 23:return Pt(t),Wo(),l=t.memoizedState!==null,s!==null?s.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(Ys(t),t.subtreeFlags&6&&(t.flags|=8192)):Ys(t),a=t.updateQueue,a!==null&&tc(t,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),s!==null&&me(Kl),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ia(ht),Ys(t),null;case 25:return null;case 30:return null}throw Error(d(156,t.tag))}function Bv(s,t){switch(Bo(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return Ia(ht),F(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return Te(t),null;case 31:if(t.memoizedState!==null){if(Pt(t),t.alternate===null)throw Error(d(340));Ql()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(Pt(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(d(340));Ql()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return me(ct),null;case 4:return F(),null;case 10:return Ia(t.type),null;case 22:case 23:return Pt(t),Wo(),s!==null&&me(Kl),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return Ia(ht),null;case 25:return null;default:return null}}function Nh(s,t){switch(Bo(t),t.tag){case 3:Ia(ht),F();break;case 26:case 27:case 5:Te(t);break;case 4:F();break;case 31:t.memoizedState!==null&&Pt(t);break;case 13:Pt(t);break;case 19:me(ct);break;case 10:Ia(t.type);break;case 22:case 23:Pt(t),Wo(),s!==null&&me(Kl);break;case 24:Ia(ht)}}function Rr(s,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var c=l.next;a=c;do{if((a.tag&s)===s){l=void 0;var o=a.create,h=a.inst;l=o(),h.destroy=l}a=a.next}while(a!==c)}}catch(v){As(t,t.return,v)}}function Nl(s,t,a){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var o=c.next;l=o;do{if((l.tag&s)===s){var h=l.inst,v=h.destroy;if(v!==void 0){h.destroy=void 0,c=t;var M=a,W=v;try{W()}catch(ce){As(c,M,ce)}}}l=l.next}while(l!==o)}}catch(ce){As(t,t.return,ce)}}function yh(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{mx(t,a)}catch(l){As(s,s.return,l)}}}function wh(s,t,a){a.props=Wl(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(l){As(s,t,l)}}function Lr(s,t){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var l=s.stateNode;break;case 30:l=s.stateNode;break;default:l=s.stateNode}typeof a=="function"?s.refCleanup=a(l):a.current=l}}catch(c){As(s,t,c)}}function za(s,t){var a=s.ref,l=s.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(c){As(s,t,c)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){As(s,t,c)}else a.current=null}function _h(s){var t=s.type,a=s.memoizedProps,l=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(c){As(s,s.return,c)}}function Ad(s,t,a){try{var l=s.stateNode;rb(l,s.type,a,t),l[Ut]=t}catch(c){As(s,s.return,c)}}function Sh(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Tl(s.type)||s.tag===4}function Md(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Sh(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Tl(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Dd(s,t,a){var l=s.tag;if(l===5||l===6)s=s.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(s),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Ga));else if(l!==4&&(l===27&&Tl(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(Dd(s,t,a),s=s.sibling;s!==null;)Dd(s,t,a),s=s.sibling}function ac(s,t,a){var l=s.tag;if(l===5||l===6)s=s.stateNode,t?a.insertBefore(s,t):a.appendChild(s);else if(l!==4&&(l===27&&Tl(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(ac(s,t,a),s=s.sibling;s!==null;)ac(s,t,a),s=s.sibling}function Ch(s){var t=s.stateNode,a=s.memoizedProps;try{for(var l=s.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Tt(t,l,a),t[_t]=s,t[Ut]=a}catch(o){As(s,s.return,o)}}var Za=!1,gt=!1,Od=!1,kh=typeof WeakSet=="function"?WeakSet:Set,wt=null;function Hv(s,t){if(s=s.containerInfo,su=_c,s=Hm(s),ko(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var c=l.anchorOffset,o=l.focusNode;l=l.focusOffset;try{a.nodeType,o.nodeType}catch{a=null;break e}var h=0,v=-1,M=-1,W=0,ce=0,de=s,ee=null;s:for(;;){for(var ne;de!==a||c!==0&&de.nodeType!==3||(v=h+c),de!==o||l!==0&&de.nodeType!==3||(M=h+l),de.nodeType===3&&(h+=de.nodeValue.length),(ne=de.firstChild)!==null;)ee=de,de=ne;for(;;){if(de===s)break s;if(ee===a&&++W===c&&(v=h),ee===o&&++ce===l&&(M=h),(ne=de.nextSibling)!==null)break;de=ee,ee=de.parentNode}de=ne}a=v===-1||M===-1?null:{start:v,end:M}}else a=null}a=a||{start:0,end:0}}else a=null;for(tu={focusedElem:s,selectionRange:a},_c=!1,wt=t;wt!==null;)if(t=wt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,wt=s;else for(;wt!==null;){switch(t=wt,o=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(a=0;a title"))),Tt(o,l,a),o[_t]=s,yt(o),l=o;break e;case"link":var h=Of("link","href",c).get(l+(a.href||""));if(h){for(var v=0;vRs&&(h=Rs,Rs=Ie,Ie=h);var V=Um(v,Ie),H=Um(v,Rs);if(V&&H&&(ne.rangeCount!==1||ne.anchorNode!==V.node||ne.anchorOffset!==V.offset||ne.focusNode!==H.node||ne.focusOffset!==H.offset)){var Z=de.createRange();Z.setStart(V.node,V.offset),ne.removeAllRanges(),Ie>Rs?(ne.addRange(Z),ne.extend(H.node,H.offset)):(Z.setEnd(H.node,H.offset),ne.addRange(Z))}}}}for(de=[],ne=v;ne=ne.parentNode;)ne.nodeType===1&&de.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;va?32:a,D.T=null,a=Gd,Gd=null;var o=Sl,h=tl;if(vt=0,qn=Sl=null,tl=0,(Cs&6)!==0)throw Error(d(331));var v=Cs;if(Cs|=4,Bh(o.current),Rh(o,o.current,h,a),Cs=v,$r(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot=="function")try{Ae.onPostCommitFiberRoot(_s,o)}catch{}return!0}finally{J.p=c,D.T=l,tf(s,t)}}function lf(s,t,a){t=ca(a,t),t=bd(s.stateNode,t,2),s=jl(s,t,2),s!==null&&(Ms(s,2),Aa(s))}function As(s,t,a){if(s.tag===3)lf(s,s,a);else for(;t!==null;){if(t.tag===3){lf(t,s,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(_l===null||!_l.has(l))){s=ca(a,s),a=nh(2),l=jl(t,a,2),l!==null&&(rh(a,l,t,s),Ms(l,2),Aa(l));break}}t=t.return}}function Qd(s,t,a){var l=s.pingCache;if(l===null){l=s.pingCache=new $v;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(a)||(Ud=!0,c.add(a),s=Yv.bind(null,s,t,a),t.then(s,s))}function Yv(s,t,a){var l=s.pingCache;l!==null&&l.delete(t),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,Hs===s&&(fs&a)===a&&(lt===4||lt===3&&(fs&62914560)===fs&&300>Vs()-rc?(Cs&2)===0&&Gn(s,0):Bd|=a,Hn===fs&&(Hn=0)),Aa(s)}function nf(s,t){t===0&&(t=G()),s=Fl(s,t),s!==null&&(Ms(s,t),Aa(s))}function Kv(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),nf(s,a)}function Xv(s,t){var a=0;switch(s.tag){case 31:case 13:var l=s.stateNode,c=s.memoizedState;c!==null&&(a=c.retryLane);break;case 19:l=s.stateNode;break;case 22:l=s.stateNode._retryCache;break;default:throw Error(d(314))}l!==null&&l.delete(t),nf(s,a)}function Jv(s,t){return Fs(s,t)}var xc=null,Fn=null,Id=!1,hc=!1,Yd=!1,kl=0;function Aa(s){s!==Fn&&s.next===null&&(Fn===null?xc=Fn=s:Fn=Fn.next=s),hc=!0,Id||(Id=!0,Pv())}function $r(s,t){if(!Yd&&hc){Yd=!0;do for(var a=!1,l=xc;l!==null;){if(s!==0){var c=l.pendingLanes;if(c===0)var o=0;else{var h=l.suspendedLanes,v=l.pingedLanes;o=(1<<31-bs(42|s)+1)-1,o&=c&~(h&~v),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(a=!0,df(l,o))}else o=fs,o=ol(l,l===Hs?o:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(o&3)===0||ba(l,o)||(a=!0,df(l,o));l=l.next}while(a);Yd=!1}}function Zv(){rf()}function rf(){hc=Id=!1;var s=0;kl!==0&&cb()&&(s=kl);for(var t=Vs(),a=null,l=xc;l!==null;){var c=l.next,o=cf(l,t);o===0?(l.next=null,a===null?xc=c:a.next=c,c===null&&(Fn=a)):(a=l,(s!==0||(o&3)!==0)&&(hc=!0)),l=c}vt!==0&&vt!==5||$r(s),kl!==0&&(kl=0)}function cf(s,t){for(var a=s.suspendedLanes,l=s.pingedLanes,c=s.expirationTimes,o=s.pendingLanes&-62914561;0v)break;var ce=M.transferSize,de=M.initiatorType;ce&&jf(de)&&(M=M.responseEnd,h+=ce*(M"u"?null:document;function zf(s,t,a){var l=Vn;if(l&&typeof t=="string"&&t){var c=ra(t);c='link[rel="'+s+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),Ef.has(c)||(Ef.add(c),s={rel:s,crossOrigin:a,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),Tt(t,"link",s),yt(t),l.head.appendChild(t)))}}function gb(s){al.D(s),zf("dns-prefetch",s,null)}function jb(s,t){al.C(s,t),zf("preconnect",s,t)}function vb(s,t,a){al.L(s,t,a);var l=Vn;if(l&&s&&t){var c='link[rel="preload"][as="'+ra(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+ra(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+ra(a.imageSizes)+'"]')):c+='[href="'+ra(s)+'"]';var o=c;switch(t){case"style":o=Qn(s);break;case"script":o=In(s)}ha.has(o)||(s=y({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),ha.set(o,s),l.querySelector(c)!==null||t==="style"&&l.querySelector(Ir(o))||t==="script"&&l.querySelector(Yr(o))||(t=l.createElement("link"),Tt(t,"link",s),yt(t),l.head.appendChild(t)))}}function bb(s,t){al.m(s,t);var a=Vn;if(a&&s){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+ra(l)+'"][href="'+ra(s)+'"]',o=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=In(s)}if(!ha.has(o)&&(s=y({rel:"modulepreload",href:s},t),ha.set(o,s),a.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Yr(o)))return}l=a.createElement("link"),Tt(l,"link",s),yt(l),a.head.appendChild(l)}}}function Nb(s,t,a){al.S(s,t,a);var l=Vn;if(l&&s){var c=xn(l).hoistableStyles,o=Qn(s);t=t||"default";var h=c.get(o);if(!h){var v={loading:0,preload:null};if(h=l.querySelector(Ir(o)))v.loading=5;else{s=y({rel:"stylesheet",href:s,"data-precedence":t},a),(a=ha.get(o))&&ou(s,a);var M=h=l.createElement("link");yt(M),Tt(M,"link",s),M._p=new Promise(function(W,ce){M.onload=W,M.onerror=ce}),M.addEventListener("load",function(){v.loading|=1}),M.addEventListener("error",function(){v.loading|=2}),v.loading|=4,vc(h,t,l)}h={type:"stylesheet",instance:h,count:1,state:v},c.set(o,h)}}}function yb(s,t){al.X(s,t);var a=Vn;if(a&&s){var l=xn(a).hoistableScripts,c=In(s),o=l.get(c);o||(o=a.querySelector(Yr(c)),o||(s=y({src:s,async:!0},t),(t=ha.get(c))&&du(s,t),o=a.createElement("script"),yt(o),Tt(o,"link",s),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(c,o))}}function wb(s,t){al.M(s,t);var a=Vn;if(a&&s){var l=xn(a).hoistableScripts,c=In(s),o=l.get(c);o||(o=a.querySelector(Yr(c)),o||(s=y({src:s,async:!0,type:"module"},t),(t=ha.get(c))&&du(s,t),o=a.createElement("script"),yt(o),Tt(o,"link",s),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(c,o))}}function Af(s,t,a,l){var c=(c=ge.current)?jc(c):null;if(!c)throw Error(d(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Qn(a.href),a=xn(c).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=Qn(a.href);var o=xn(c).hoistableStyles,h=o.get(s);if(h||(c=c.ownerDocument||c,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(s,h),(o=c.querySelector(Ir(s)))&&!o._p&&(h.instance=o,h.state.loading=5),ha.has(s)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ha.set(s,a),o||_b(c,s,a,h.state))),t&&l===null)throw Error(d(528,""));return h}if(t&&l!==null)throw Error(d(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=In(a),a=xn(c).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(d(444,s))}}function Qn(s){return'href="'+ra(s)+'"'}function Ir(s){return'link[rel="stylesheet"]['+s+"]"}function Mf(s){return y({},s,{"data-precedence":s.precedence,precedence:null})}function _b(s,t,a,l){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=s.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),Tt(t,"link",a),yt(t),s.head.appendChild(t))}function In(s){return'[src="'+ra(s)+'"]'}function Yr(s){return"script[async]"+s}function Df(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=s.querySelector('style[data-href~="'+ra(a.href)+'"]');if(l)return t.instance=l,yt(l),l;var c=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(s.ownerDocument||s).createElement("style"),yt(l),Tt(l,"style",c),vc(l,a.precedence,s),t.instance=l;case"stylesheet":c=Qn(a.href);var o=s.querySelector(Ir(c));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;l=Mf(a),(c=ha.get(c))&&ou(l,c),o=(s.ownerDocument||s).createElement("link"),yt(o);var h=o;return h._p=new Promise(function(v,M){h.onload=v,h.onerror=M}),Tt(o,"link",l),t.state.loading|=4,vc(o,a.precedence,s),t.instance=o;case"script":return o=In(a.src),(c=s.querySelector(Yr(o)))?(t.instance=c,yt(c),c):(l=a,(c=ha.get(o))&&(l=y({},a),du(l,c)),s=s.ownerDocument||s,c=s.createElement("script"),yt(c),Tt(c,"link",l),s.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(d(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,vc(l,a.precedence,s));return t.instance}function vc(s,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,o=c,h=0;h title"):null)}function Sb(s,t,a){if(a===1||t.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return s=t.disabled,typeof t.precedence=="string"&&s==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Lf(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Cb(s,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var c=Qn(l.href),o=t.querySelector(Ir(c));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=Nc.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=o,yt(o);return}o=t.ownerDocument||t,l=Mf(l),(c=ha.get(c))&&ou(l,c),o=o.createElement("link"),yt(o);var h=o;h._p=new Promise(function(v,M){h.onload=v,h.onerror=M}),Tt(o,"link",l),a.instance=o}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=Nc.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var uu=0;function kb(s,t){return s.stylesheets&&s.count===0&&wc(s,s.stylesheets),0uu?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function Nc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)wc(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var yc=null;function wc(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,yc=new Map,t.forEach(Tb,s),yc=null,Nc.call(s))}function Tb(s,t){if(!(t.state.loading&4)){var a=yc.get(s);if(a)var l=a.get(null);else{a=new Map,yc.set(s,a);for(var c=s.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),yu.exports=c0(),yu.exports}var d0=o0();function $(...n){return Yb(Kb(n))}const Fe=u.forwardRef(({className:n,...r},i)=>e.jsx("div",{ref:i,className:$("rounded-xl border bg-card text-card-foreground shadow",n),...r}));Fe.displayName="Card";const ts=u.forwardRef(({className:n,...r},i)=>e.jsx("div",{ref:i,className:$("flex flex-col space-y-1.5 p-6",n),...r}));ts.displayName="CardHeader";const as=u.forwardRef(({className:n,...r},i)=>e.jsx("div",{ref:i,className:$("font-semibold leading-none tracking-tight",n),...r}));as.displayName="CardTitle";const et=u.forwardRef(({className:n,...r},i)=>e.jsx("div",{ref:i,className:$("text-sm text-muted-foreground",n),...r}));et.displayName="CardDescription";const xs=u.forwardRef(({className:n,...r},i)=>e.jsx("div",{ref:i,className:$("p-6 pt-0",n),...r}));xs.displayName="CardContent";const Sg=u.forwardRef(({className:n,...r},i)=>e.jsx("div",{ref:i,className:$("flex items-center p-6 pt-0",n),...r}));Sg.displayName="CardFooter";const ga=Xb,la=u.forwardRef(({className:n,...r},i)=>e.jsx(Sp,{ref:i,className:$("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",n),...r}));la.displayName=Sp.displayName;const ss=u.forwardRef(({className:n,...r},i)=>e.jsx(Cp,{ref:i,className:$("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",n),...r}));ss.displayName=Cp.displayName;const Ts=u.forwardRef(({className:n,...r},i)=>e.jsx(kp,{ref:i,className:$("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",n),...r}));Ts.displayName=kp.displayName;const Ze=u.forwardRef(({className:n,children:r,viewportRef:i,...d},m)=>e.jsxs(Tp,{ref:m,className:$("relative overflow-hidden",n),...d,children:[e.jsx(Jb,{ref:i,className:"h-full w-full rounded-[inherit]",children:r}),e.jsx(Uu,{}),e.jsx(Uu,{orientation:"horizontal"}),e.jsx(Zb,{})]}));Ze.displayName=Tp.displayName;const Uu=u.forwardRef(({className:n,orientation:r="vertical",...i},d)=>e.jsx(Ep,{ref:d,orientation:r,className:$("flex touch-none select-none transition-colors",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",n),...i,children:e.jsx(Pb,{className:"relative flex-1 rounded-full bg-border"})}));Uu.displayName=Ep.displayName;function Cg({className:n,...r}){return e.jsx("div",{className:$("animate-pulse rounded-md bg-primary/10",n),...r})}const rr=u.forwardRef(({className:n,value:r,...i},d)=>e.jsx(zp,{ref:d,className:$("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...i,children:e.jsx(Wb,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(r||0)}%)`}})}));rr.displayName=zp.displayName;const u0={light:"",dark:".dark"},kg=u.createContext(null);function Tg(){const n=u.useContext(kg);if(!n)throw new Error("useChart must be used within a ");return n}const Xn=u.forwardRef(({id:n,className:r,children:i,config:d,...m},x)=>{const f=u.useId(),p=`chart-${n||f.replace(/:/g,"")}`;return e.jsx(kg.Provider,{value:{config:d},children:e.jsxs("div",{"data-chart":p,ref:x,className:$("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",r),...m,children:[e.jsx(m0,{id:p,config:d}),e.jsx(fN,{children:i})]})})});Xn.displayName="Chart";const m0=({id:n,config:r})=>{const i=Object.entries(r).filter(([,d])=>d.theme||d.color);return i.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(u0).map(([d,m])=>` +${m} [data-chart=${n}] { +${i.map(([x,f])=>{const p=f.theme?.[d]||f.color;return p?` --color-${x}: ${p};`:null}).join(` +`)} +} +`).join(` +`)}}):null},ei=pN,Jn=u.forwardRef(({active:n,payload:r,className:i,indicator:d="dot",hideLabel:m=!1,hideIndicator:x=!1,label:f,labelFormatter:p,labelClassName:g,formatter:b,color:j,nameKey:y,labelKey:N},k)=>{const{config:w}=Tg(),U=u.useMemo(()=>{if(m||!r?.length)return null;const[B]=r,Y=`${N||B?.dataKey||B?.name||"value"}`,L=Bu(w,B,Y),z=!N&&typeof f=="string"?w[f]?.label||f:L?.label;return p?e.jsx("div",{className:$("font-medium",g),children:p(z,r)}):z?e.jsx("div",{className:$("font-medium",g),children:z}):null},[f,p,r,m,g,w,N]);if(!n||!r?.length)return null;const O=r.length===1&&d!=="dot";return e.jsxs("div",{ref:k,className:$("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",i),children:[O?null:U,e.jsx("div",{className:"grid gap-1.5",children:r.filter(B=>B.type!=="none").map((B,Y)=>{const L=`${y||B.name||B.dataKey||"value"}`,z=Bu(w,B,L),K=j||B.payload.fill||B.color;return e.jsx("div",{className:$("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",d==="dot"&&"items-center"),children:b&&B?.value!==void 0&&B.name?b(B.value,B.name,B,Y,B.payload):e.jsxs(e.Fragment,{children:[z?.icon?e.jsx(z.icon,{}):!x&&e.jsx("div",{className:$("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":d==="dot","w-1":d==="line","w-0 border-[1.5px] border-dashed bg-transparent":d==="dashed","my-0.5":O&&d==="dashed"}),style:{"--color-bg":K,"--color-border":K}}),e.jsxs("div",{className:$("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[O?U:null,e.jsx("span",{className:"text-muted-foreground",children:z?.label||B.name})]}),B.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:B.value.toLocaleString()})]})]})},B.dataKey)})})]})});Jn.displayName="ChartTooltip";const x0=gN,Eg=u.forwardRef(({className:n,hideIcon:r=!1,payload:i,verticalAlign:d="bottom",nameKey:m},x)=>{const{config:f}=Tg();return i?.length?e.jsx("div",{ref:x,className:$("flex items-center justify-center gap-4",d==="top"?"pb-3":"pt-3",n),children:i.filter(p=>p.type!=="none").map(p=>{const g=`${m||p.dataKey||"value"}`,b=Bu(f,p,g);return e.jsxs("div",{className:$("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[b?.icon&&!r?e.jsx(b.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:p.color}}),b?.label]},p.value)})}):null});Eg.displayName="ChartLegend";function Bu(n,r,i){if(typeof r!="object"||r===null)return;const d="payload"in r&&typeof r.payload=="object"&&r.payload!==null?r.payload:void 0;let m=i;return i in r&&typeof r[i]=="string"?m=r[i]:d&&i in d&&typeof d[i]=="string"&&(m=d[i]),m in n?n[m]:n[i]}const ui=tr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),S=u.forwardRef(({className:n,variant:r,size:i,asChild:d=!1,...m},x)=>{const f=d?wN:"button";return e.jsx(f,{className:$(ui({variant:r,size:i,className:n})),ref:x,...m})});S.displayName="Button";const h0=tr("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Qe({className:n,variant:r,...i}){return e.jsx("div",{className:$(h0({variant:r}),n),...i})}const f0=5,p0=5e3;let Su=0;function g0(){return Su=(Su+1)%Number.MAX_SAFE_INTEGER,Su.toString()}const Cu=new Map,rp=n=>{if(Cu.has(n))return;const r=setTimeout(()=>{Cu.delete(n),ii({type:"REMOVE_TOAST",toastId:n})},p0);Cu.set(n,r)},j0=(n,r)=>{switch(r.type){case"ADD_TOAST":return{...n,toasts:[r.toast,...n.toasts].slice(0,f0)};case"UPDATE_TOAST":return{...n,toasts:n.toasts.map(i=>i.id===r.toast.id?{...i,...r.toast}:i)};case"DISMISS_TOAST":{const{toastId:i}=r;return i?rp(i):n.toasts.forEach(d=>{rp(d.id)}),{...n,toasts:n.toasts.map(d=>d.id===i||i===void 0?{...d,open:!1}:d)}}case"REMOVE_TOAST":return r.toastId===void 0?{...n,toasts:[]}:{...n,toasts:n.toasts.filter(i=>i.id!==r.toastId)}}},qc=[];let Gc={toasts:[]};function ii(n){Gc=j0(Gc,n),qc.forEach(r=>{r(Gc)})}function v0({...n}){const r=g0(),i=m=>ii({type:"UPDATE_TOAST",toast:{...m,id:r}}),d=()=>ii({type:"DISMISS_TOAST",toastId:r});return ii({type:"ADD_TOAST",toast:{...n,id:r,open:!0,onOpenChange:m=>{m||d()}}}),{id:r,dismiss:d,update:i}}function $s(){const[n,r]=u.useState(Gc);return u.useEffect(()=>(qc.push(r),()=>{const i=qc.indexOf(r);i>-1&&qc.splice(i,1)}),[n]),{...n,toast:v0,dismiss:i=>ii({type:"DISMISS_TOAST",toastId:i})}}const b0=n=>{const r=[];for(let i=0;i{try{k(!0);const R=await Ac.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");y({hitokoto:R.data.hitokoto,from:R.data.from||R.data.from_who||"未知"})}catch(R){console.error("获取一言失败:",R),y({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{k(!1)}},[]),z=u.useCallback(async()=>{try{const R=localStorage.getItem("access-token"),ue=await Ac.get("/api/webui/system/status",{headers:{Authorization:`Bearer ${R}`}});U(ue.data)}catch(R){console.error("获取机器人状态失败:",R),U(null)}},[]),K=async()=>{if(!O)try{B(!0);const R=localStorage.getItem("access-token");await Ac.post("/api/webui/system/restart",{},{headers:{Authorization:`Bearer ${R}`}}),Y({title:"重启中",description:"麦麦正在重启,请稍候..."}),setTimeout(()=>{z(),B(!1)},3e3)}catch(R){console.error("重启失败:",R),Y({title:"重启失败",description:"无法重启麦麦,请检查控制台",variant:"destructive"}),B(!1)}},I=u.useCallback(async()=>{try{const R=localStorage.getItem("access-token"),ue=await Ac.get(`/api/webui/statistics/dashboard?hours=${f}`,{headers:{Authorization:`Bearer ${R}`}});r(ue.data),d(!1),x(100)}catch(R){console.error("Failed to fetch dashboard data:",R),d(!1),x(100)}},[f]);if(u.useEffect(()=>{if(!i)return;x(0);const R=setTimeout(()=>x(15),200),ue=setTimeout(()=>x(30),800),me=setTimeout(()=>x(45),2e3),_e=setTimeout(()=>x(60),4e3),Ce=setTimeout(()=>x(75),6500),ze=setTimeout(()=>x(85),9e3),ge=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(R),clearTimeout(ue),clearTimeout(me),clearTimeout(_e),clearTimeout(Ce),clearTimeout(ze),clearTimeout(ge)}},[i]),u.useEffect(()=>{I(),L(),z()},[I,L,z]),u.useEffect(()=>{if(!g)return;const R=setInterval(()=>{I(),z()},3e4);return()=>clearInterval(R)},[g,I,z]),i||!n)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(zt,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(rr,{value:m,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m,"%"]})]})]})});const{summary:T,model_stats:A=[],hourly_data:te=[],daily_data:fe=[],recent_activity:je=[]}=n,pe=T??{total_requests:0,total_cost:0,total_tokens:0,online_time:0,total_messages:0,total_replies:0,avg_response_time:0,cost_per_hour:0,tokens_per_hour:0},he=R=>{const ue=Math.floor(R/3600),me=Math.floor(R%3600/60);return`${ue}小时${me}分钟`},ve=R=>{const ue=R.toLocaleString("zh-CN");return R>=1e9?{display:`${(R/1e9).toFixed(2)}B`,exact:ue,needsExact:!0}:R>=1e6?{display:`${(R/1e6).toFixed(2)}M`,exact:ue,needsExact:!0}:R>=1e4?{display:`${(R/1e3).toFixed(1)}K`,exact:ue,needsExact:!0}:R>=1e3?{display:`${(R/1e3).toFixed(2)}K`,exact:ue,needsExact:!0}:{display:ue,exact:ue,needsExact:!1}},be=R=>{const ue=`¥${R.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return R>=1e6?{display:`¥${(R/1e6).toFixed(2)}M`,exact:ue,needsExact:!0}:R>=1e4?{display:`¥${(R/1e3).toFixed(1)}K`,exact:ue,needsExact:!0}:R>=1e3?{display:`¥${(R/1e3).toFixed(2)}K`,exact:ue,needsExact:!0}:{display:ue,exact:ue,needsExact:!1}},D=R=>new Date(R).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),J=b0(A.length),q=A.map((R,ue)=>({name:R.model_name,value:R.request_count,fill:J[ue]})),se={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ga,{value:f.toString(),onValueChange:R=>p(Number(R)),children:e.jsxs(la,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(ss,{value:"24",children:"24小时"}),e.jsx(ss,{value:"168",children:"7天"}),e.jsx(ss,{value:"720",children:"30天"})]})}),e.jsxs(S,{variant:g?"default":"outline",size:"sm",onClick:()=>b(!g),className:"gap-2",children:[e.jsx(zt,{className:`h-4 w-4 ${g?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:I,children:e.jsx(zt,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[N?e.jsx(Cg,{className:"h-5 flex-1"}):j?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',j.hitokoto,'" —— ',j.from]}):null,e.jsx(S,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:L,disabled:N,children:e.jsx(zt,{className:`h-3.5 w-3.5 ${N?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(Fe,{className:"lg:col-span-1",children:[e.jsx(ts,{className:"pb-3",children:e.jsxs(as,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(hi,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(xs,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:w?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs(Qe,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(aa,{className:"h-3 w-3 mr-1"}),"运行中"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-500"}),e.jsxs(Qe,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(At,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),w&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",w.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["运行 ",he(w.uptime)]})]})]})})]}),e.jsxs(Fe,{children:[e.jsx(ts,{className:"pb-3",children:e.jsxs(as,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(an,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(xs,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:K,disabled:O,className:"gap-2",children:[e.jsx($c,{className:`h-4 w-4 ${O?"animate-spin":""}`}),O?"重启中...":"重启麦麦"]}),e.jsx(S,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/logs",children:[e.jsx(Sa,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(S,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/plugins",children:[e.jsx(IN,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(S,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/settings",children:[e.jsx(ar,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"pb-3",children:[e.jsxs(as,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(YN,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(et,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(xs,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/survey/webui-feedback",children:[e.jsx(Sa,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(S,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/survey/maibot-feedback",children:[e.jsx(Rl,{className:"h-4 w-4"}),"麦麦反馈"]})})]})})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(KN,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(xs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ve(pe.total_requests).display,ve(pe.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ve(pe.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",f<48?f+"小时":Math.floor(f/24)+"天"]})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"总花费"}),e.jsx(XN,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(xs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[be(pe.total_cost).display,be(pe.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",be(pe.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:pe.cost_per_hour>0?`¥${pe.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(Fc,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(xs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ve(pe.total_tokens).display,ve(pe.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ve(pe.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:pe.tokens_per_hour>0?`${ve(pe.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(an,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(xs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[pe.avg_response_time.toFixed(2),"s"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(Pn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(xs,{children:e.jsxs("div",{className:"text-xl font-bold",children:[he(pe.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",pe.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(Rl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(xs,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[ve(pe.total_messages).display,ve(pe.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ve(pe.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",ve(pe.total_replies).display,ve(pe.total_replies).needsExact&&e.jsxs("span",{children:["(",ve(pe.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(JN,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(xs,{children:[e.jsx("div",{className:"text-xl font-bold",children:pe.total_messages>0?`¥${(pe.total_cost/pe.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(ga,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(la,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(ss,{value:"trends",children:"趋势"}),e.jsx(ss,{value:"models",children:"模型"}),e.jsx(ss,{value:"activity",children:"活动"}),e.jsx(ss,{value:"daily",children:"日统计"})]}),e.jsxs(Ts,{value:"trends",className:"space-y-4",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"请求趋势"}),e.jsxs(et,{children:["最近",f,"小时的请求量变化"]})]}),e.jsx(xs,{children:e.jsx(Xn,{config:se,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(jN,{data:te,children:[e.jsx(Mc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Dc,{dataKey:"timestamp",tickFormatter:R=>D(R),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Pr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(ei,{content:e.jsx(Jn,{labelFormatter:R=>D(R)})}),e.jsx(vN,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"花费趋势"}),e.jsx(et,{children:"API调用成本变化"})]}),e.jsx(xs,{children:e.jsx(Xn,{config:se,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(vu,{data:te,children:[e.jsx(Mc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Dc,{dataKey:"timestamp",tickFormatter:R=>D(R),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Pr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(ei,{content:e.jsx(Jn,{labelFormatter:R=>D(R)})}),e.jsx(Oc,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"Token消耗"}),e.jsx(et,{children:"Token使用量变化"})]}),e.jsx(xs,{children:e.jsx(Xn,{config:se,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(vu,{data:te,children:[e.jsx(Mc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Dc,{dataKey:"timestamp",tickFormatter:R=>D(R),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Pr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(ei,{content:e.jsx(Jn,{labelFormatter:R=>D(R)})}),e.jsx(Oc,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(Ts,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"模型请求分布"}),e.jsxs(et,{children:["各模型使用占比 (共 ",A.length," 个模型)"]})]}),e.jsx(xs,{children:e.jsx(Xn,{config:Object.fromEntries(A.map((R,ue)=>[R.model_name,{label:R.model_name,color:J[ue]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(bN,{children:[e.jsx(ei,{content:e.jsx(Jn,{})}),e.jsx(NN,{data:q,cx:"50%",cy:"50%",labelLine:!1,label:({name:R,percent:ue})=>ue&&ue<.05?"":`${R} ${ue?(ue*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:q.map((R,ue)=>e.jsx(yN,{fill:R.fill},`cell-${ue}`))})]})})})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"模型详细统计"}),e.jsx(et,{children:"请求数、花费和性能"})]}),e.jsx(xs,{children:e.jsx(Ze,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:A.map((R,ue)=>e.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:R.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${ue%5+1}))`}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),e.jsx("span",{className:"ml-1 font-medium",children:R.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",R.total_cost.toFixed(2)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[(R.total_tokens/1e3).toFixed(1),"K"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[R.avg_response_time.toFixed(2),"s"]})]})]})]},ue))})})})]})]})}),e.jsx(Ts,{value:"activity",children:e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"最近活动"}),e.jsx(et,{children:"最新的API调用记录"})]}),e.jsx(xs,{children:e.jsx(Ze,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:je.map((R,ue)=>e.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:R.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:R.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:D(R.timestamp)})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsx("span",{className:"ml-1",children:R.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",R.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[R.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${R.status==="success"?"text-green-600":"text-red-600"}`,children:R.status})]})]})]},ue))})})})]})}),e.jsx(Ts,{value:"daily",children:e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"每日统计"}),e.jsx(et,{children:"最近7天的数据汇总"})]}),e.jsx(xs,{children:e.jsx(Xn,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:e.jsxs(vu,{data:fe,children:[e.jsx(Mc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Dc,{dataKey:"timestamp",tickFormatter:R=>{const ue=new Date(R);return`${ue.getMonth()+1}/${ue.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Pr,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Pr,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(ei,{content:e.jsx(Jn,{labelFormatter:R=>new Date(R).toLocaleDateString("zh-CN")})}),e.jsx(x0,{content:e.jsx(Eg,{})}),e.jsx(Oc,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Oc,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]})]})})}const y0={theme:"system",setTheme:()=>null},zg=u.createContext(y0),Yu=()=>{const n=u.useContext(zg);if(n===void 0)throw new Error("useTheme must be used within a ThemeProvider");return n},w0=(n,r,i)=>{const d=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||d){r(n);return}const m=i.clientX,x=i.clientY,f=Math.hypot(Math.max(m,innerWidth-m),Math.max(x,innerHeight-x));document.startViewTransition(()=>{r(n)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${m}px ${x}px)`,`circle(${f}px at ${m}px ${x}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Ag=u.createContext(void 0),Mg=()=>{const n=u.useContext(Ag);if(n===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return n},$e=u.forwardRef(({className:n,...r},i)=>e.jsx(Ap,{className:$("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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",n),...r,ref:i,children:e.jsx(eN,{className:$("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));$e.displayName=Ap.displayName;const _0=tr("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),C=u.forwardRef(({className:n,...r},i)=>e.jsx(Qp,{ref:i,className:$(_0(),n),...r}));C.displayName=Qp.displayName;const ie=u.forwardRef(({className:n,type:r,...i},d)=>e.jsx("input",{type:r,className:$("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:d,...i}));ie.displayName="Input";const S0=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:n=>n.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:n=>/[A-Z]/.test(n)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:n=>/[a-z]/.test(n)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:n=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(n)}];function C0(n){const r=S0.map(d=>({id:d.id,label:d.label,description:d.description,passed:d.validate(n)}));return{isValid:r.every(d=>d.passed),rules:r}}const Zc="0.12.0 Beta",Ku="MaiBot Dashboard",k0=`${Ku} v${Zc}`,T0=(n="v")=>`${n}${Zc}`,Vt={THEME:"maibot-ui-theme",ACCENT_COLOR:"accent-color",ENABLE_ANIMATIONS:"maibot-animations",ENABLE_WAVES_BACKGROUND:"maibot-waves-background",LOG_CACHE_SIZE:"maibot-log-cache-size",LOG_AUTO_SCROLL:"maibot-log-auto-scroll",LOG_FONT_SIZE:"maibot-log-font-size",LOG_LINE_SPACING:"maibot-log-line-spacing",DATA_SYNC_INTERVAL:"maibot-data-sync-interval",WS_RECONNECT_INTERVAL:"maibot-ws-reconnect-interval",WS_MAX_RECONNECT_ATTEMPTS:"maibot-ws-max-reconnect-attempts",COMPLETED_TOURS:"maibot-completed-tours"},Da={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function nt(n){const r=Dg(n),i=localStorage.getItem(r);if(i===null)return Da[n];const d=Da[n];if(typeof d=="boolean")return i==="true";if(typeof d=="number"){const m=parseFloat(i);return isNaN(m)?d:m}return i}function Zn(n,r){const i=Dg(n);localStorage.setItem(i,String(r)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:n,value:r}}))}function E0(){return{theme:nt("theme"),accentColor:nt("accentColor"),enableAnimations:nt("enableAnimations"),enableWavesBackground:nt("enableWavesBackground"),logCacheSize:nt("logCacheSize"),logAutoScroll:nt("logAutoScroll"),logFontSize:nt("logFontSize"),logLineSpacing:nt("logLineSpacing"),dataSyncInterval:nt("dataSyncInterval"),wsReconnectInterval:nt("wsReconnectInterval"),wsMaxReconnectAttempts:nt("wsMaxReconnectAttempts")}}function z0(){const n=E0(),r=localStorage.getItem(Vt.COMPLETED_TOURS),i=r?JSON.parse(r):[];return{...n,completedTours:i}}function A0(n){const r=[],i=[];for(const[d,m]of Object.entries(n)){if(d==="completedTours"){Array.isArray(m)?(localStorage.setItem(Vt.COMPLETED_TOURS,JSON.stringify(m)),r.push("completedTours")):i.push("completedTours");continue}if(d in Da){const x=d,f=Da[x];if(typeof m==typeof f){if(x==="theme"&&!["light","dark","system"].includes(m)){i.push(d);continue}if(x==="logFontSize"&&!["xs","sm","base"].includes(m)){i.push(d);continue}Zn(x,m),r.push(d)}else i.push(d)}else i.push(d)}return{success:r.length>0,imported:r,skipped:i}}function M0(){for(const n of Object.keys(Da))Zn(n,Da[n]);localStorage.removeItem(Vt.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function D0(){const n=[],r=[],i=[];for(let d=0;dd.size-i.size),{used:n,items:localStorage.length,details:r}}function O0(n){if(n===0)return"0 B";const r=1024,i=["B","KB","MB"],d=Math.floor(Math.log(n)/Math.log(r));return parseFloat((n/Math.pow(r,d)).toFixed(2))+" "+i[d]}function Dg(n){return{theme:Vt.THEME,accentColor:Vt.ACCENT_COLOR,enableAnimations:Vt.ENABLE_ANIMATIONS,enableWavesBackground:Vt.ENABLE_WAVES_BACKGROUND,logCacheSize:Vt.LOG_CACHE_SIZE,logAutoScroll:Vt.LOG_AUTO_SCROLL,logFontSize:Vt.LOG_FONT_SIZE,logLineSpacing:Vt.LOG_LINE_SPACING,dataSyncInterval:Vt.DATA_SYNC_INTERVAL,wsReconnectInterval:Vt.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:Vt.WS_MAX_RECONNECT_ATTEMPTS}[n]}const pa=u.forwardRef(({className:n,...r},i)=>e.jsxs(Mp,{ref:i,className:$("relative flex w-full touch-none select-none items-center",n),...r,children:[e.jsx(sN,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(tN,{className:"absolute h-full bg-primary"})}),e.jsx(aN,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));pa.displayName=Mp.displayName;class R0{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return nt("logCacheSize")}getMaxReconnectAttempts(){return nt("wsMaxReconnectAttempts")}getReconnectInterval(){return nt("wsReconnectInterval")}getWebSocketUrl(){{const r=window.location.protocol==="https:"?"wss:":"ws:",i=window.location.host;return`${r}//${i}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const r=this.getWebSocketUrl();try{this.ws=new WebSocket(r),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=i=>{try{if(i.data==="pong")return;const d=JSON.parse(i.data);this.notifyLog(d)}catch(d){console.error("解析日志消息失败:",d)}},this.ws.onerror=i=>{console.error("❌ WebSocket 错误:",i),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(i){console.error("创建 WebSocket 连接失败:",i),this.attemptReconnect()}}attemptReconnect(){const r=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=r)return;this.reconnectAttempts+=1;const i=this.getReconnectInterval(),d=Math.min(i*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},d)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(r){return this.logCallbacks.add(r),()=>this.logCallbacks.delete(r)}onConnectionChange(r){return this.connectionCallbacks.add(r),r(this.isConnected),()=>this.connectionCallbacks.delete(r)}notifyLog(r){if(!this.logCache.some(d=>d.id===r.id)){this.logCache.push(r);const d=this.getMaxCacheSize();this.logCache.length>d&&(this.logCache=this.logCache.slice(-d)),this.logCallbacks.forEach(m=>{try{m(r)}catch(x){console.error("日志回调执行失败:",x)}})}}notifyConnection(r){this.connectionCallbacks.forEach(i=>{try{i(r)}catch(d){console.error("连接状态回调执行失败:",d)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const tn=new R0;typeof window<"u"&&tn.connect();const qs=CN,Xu=kN,L0=_N,Og=u.forwardRef(({className:n,...r},i)=>e.jsx(Ip,{ref:i,className:$("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...r}));Og.displayName=Ip.displayName;const Ls=u.forwardRef(({className:n,children:r,preventOutsideClose:i=!1,...d},m)=>e.jsxs(L0,{children:[e.jsx(Og,{}),e.jsxs(Yp,{ref:m,className:$("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),onPointerDownOutside:i?x=>x.preventDefault():void 0,onInteractOutside:i?x=>x.preventDefault():void 0,...d,children:[r,e.jsxs(SN,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(rl,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ls.displayName=Yp.displayName;const Us=({className:n,...r})=>e.jsx("div",{className:$("flex flex-col space-y-1.5 text-center sm:text-left",n),...r});Us.displayName="DialogHeader";const st=({className:n,...r})=>e.jsx("div",{className:$("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...r});st.displayName="DialogFooter";const Bs=u.forwardRef(({className:n,...r},i)=>e.jsx(Kp,{ref:i,className:$("text-lg font-semibold leading-none tracking-tight",n),...r}));Bs.displayName=Kp.displayName;const Ps=u.forwardRef(({className:n,...r},i)=>e.jsx(Xp,{ref:i,className:$("text-sm text-muted-foreground",n),...r}));Ps.displayName=Xp.displayName;const hs=nN,rt=rN,U0=lN,Rg=u.forwardRef(({className:n,...r},i)=>e.jsx(Dp,{className:$("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...r,ref:i}));Rg.displayName=Dp.displayName;const ls=u.forwardRef(({className:n,...r},i)=>e.jsxs(U0,{children:[e.jsx(Rg,{}),e.jsx(Op,{ref:i,className:$("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...r})]}));ls.displayName=Op.displayName;const ns=({className:n,...r})=>e.jsx("div",{className:$("flex flex-col space-y-2 text-center sm:text-left",n),...r});ns.displayName="AlertDialogHeader";const rs=({className:n,...r})=>e.jsx("div",{className:$("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...r});rs.displayName="AlertDialogFooter";const is=u.forwardRef(({className:n,...r},i)=>e.jsx(Rp,{ref:i,className:$("text-lg font-semibold",n),...r}));is.displayName=Rp.displayName;const cs=u.forwardRef(({className:n,...r},i)=>e.jsx(Lp,{ref:i,className:$("text-sm text-muted-foreground",n),...r}));cs.displayName=Lp.displayName;const os=u.forwardRef(({className:n,...r},i)=>e.jsx(Up,{ref:i,className:$(ui(),n),...r}));os.displayName=Up.displayName;const ds=u.forwardRef(({className:n,...r},i)=>e.jsx(Bp,{ref:i,className:$(ui({variant:"outline"}),"mt-2 sm:mt-0",n),...r}));ds.displayName=Bp.displayName;function B0(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),e.jsxs(ga,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(la,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(ss,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ZN,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(ss,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(PN,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(ss,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ar,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(ss,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Ra,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(Ze,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ts,{value:"appearance",className:"mt-0",children:e.jsx(H0,{})}),e.jsx(Ts,{value:"security",className:"mt-0",children:e.jsx(q0,{})}),e.jsx(Ts,{value:"other",className:"mt-0",children:e.jsx(G0,{})}),e.jsx(Ts,{value:"about",className:"mt-0",children:e.jsx($0,{})})]})]})]})}function cp(n){const r=document.documentElement,d={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[n];if(d)r.style.setProperty("--primary",d.hsl),d.gradient?(r.style.setProperty("--primary-gradient",d.gradient),r.classList.add("has-gradient")):(r.style.removeProperty("--primary-gradient"),r.classList.remove("has-gradient"));else if(n.startsWith("#")){const m=x=>{x=x.replace("#","");const f=parseInt(x.substring(0,2),16)/255,p=parseInt(x.substring(2,4),16)/255,g=parseInt(x.substring(4,6),16)/255,b=Math.max(f,p,g),j=Math.min(f,p,g);let y=0,N=0;const k=(b+j)/2;if(b!==j){const w=b-j;switch(N=k>.5?w/(2-b-j):w/(b+j),b){case f:y=((p-g)/w+(plocalStorage.getItem("accent-color")||"blue");u.useEffect(()=>{const b=localStorage.getItem("accent-color")||"blue";cp(b)},[]);const g=b=>{p(b),localStorage.setItem("accent-color",b),cp(b)};return e.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[e.jsx(ku,{value:"light",current:n,onChange:r,label:"浅色",description:"始终使用浅色主题"}),e.jsx(ku,{value:"dark",current:n,onChange:r,label:"深色",description:"始终使用深色主题"}),e.jsx(ku,{value:"system",current:n,onChange:r,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(fa,{value:"blue",current:f,onChange:g,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(fa,{value:"purple",current:f,onChange:g,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(fa,{value:"green",current:f,onChange:g,label:"绿色",colorClass:"bg-green-500"}),e.jsx(fa,{value:"orange",current:f,onChange:g,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(fa,{value:"pink",current:f,onChange:g,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(fa,{value:"red",current:f,onChange:g,label:"红色",colorClass:"bg-red-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(fa,{value:"gradient-sunset",current:f,onChange:g,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(fa,{value:"gradient-ocean",current:f,onChange:g,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(fa,{value:"gradient-forest",current:f,onChange:g,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(fa,{value:"gradient-aurora",current:f,onChange:g,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(fa,{value:"gradient-fire",current:f,onChange:g,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(fa,{value:"gradient-twilight",current:f,onChange:g,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"color",value:f.startsWith("#")?f:"#3b82f6",onChange:b=>g(b.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),e.jsx("div",{className:"flex-1",children:e.jsx(ie,{type:"text",value:f,onChange:b=>g(b.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),e.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[e.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(C,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx($e,{id:"animations",checked:i,onCheckedChange:d})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(C,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx($e,{id:"waves-background",checked:m,onCheckedChange:x})]})})]})]})]})}function q0(){const n=va(),[r,i]=u.useState(""),[d,m]=u.useState(""),[x,f]=u.useState(!1),[p,g]=u.useState(!1),[b,j]=u.useState(!1),[y,N]=u.useState(!1),[k,w]=u.useState(!1),[U,O]=u.useState(!1),[B,Y]=u.useState(""),[L,z]=u.useState(!1),{toast:K}=$s(),I=u.useMemo(()=>C0(d),[d]),T=async he=>{if(!r){K({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(he),w(!0),K({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>w(!1),2e3)}catch{K({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},A=async()=>{if(!d.trim()){K({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!I.isValid){const he=I.rules.filter(ve=>!ve.passed).map(ve=>ve.label).join(", ");K({title:"格式错误",description:`Token 不符合要求: ${he}`,variant:"destructive"});return}j(!0);try{const he=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:d.trim()})}),ve=await he.json();he.ok&&ve.success?(m(""),i(d.trim()),K({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{n({to:"/auth"})},1500)):K({title:"更新失败",description:ve.message||"无法更新 Token",variant:"destructive"})}catch(he){console.error("更新 Token 错误:",he),K({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{j(!1)}},te=async()=>{N(!0);try{const he=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),ve=await he.json();he.ok&&ve.success?(i(ve.token),Y(ve.token),O(!0),z(!1),K({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):K({title:"生成失败",description:ve.message||"无法生成新 Token",variant:"destructive"})}catch(he){console.error("生成 Token 错误:",he),K({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{N(!1)}},fe=async()=>{try{await navigator.clipboard.writeText(B),z(!0),K({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{K({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},je=()=>{O(!1),setTimeout(()=>{Y(""),z(!1)},300),setTimeout(()=>{n({to:"/auth"})},500)},pe=he=>{he||je()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(qs,{open:U,onOpenChange:pe,children:e.jsxs(Ls,{className:"sm:max-w-md",children:[e.jsxs(Us,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(Ca,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(Ps,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[e.jsx(C,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),e.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:B})]}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ca,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"重要提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),e.jsx("li",{children:"请立即复制并保存到安全的位置"}),e.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),e.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),e.jsxs(st,{className:"gap-2 sm:gap-0",children:[e.jsx(S,{variant:"outline",onClick:fe,className:"gap-2",children:L?e.jsxs(e.Fragment,{children:[e.jsx(Qt,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(Vc,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(S,{onClick:je,children:"我已保存,关闭"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ie,{id:"current-token",type:x?"text":"password",value:r||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{r?f(!x):K({title:"无法查看",description:'Token 存储在安全 Cookie 中,如需新 Token 请点击"重新生成"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:x?"隐藏":"显示",children:x?e.jsx(ci,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Rt,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(S,{variant:"outline",size:"icon",onClick:()=>T(r),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!r,children:k?e.jsx(Qt,{className:"h-4 w-4 text-green-500"}):e.jsx(Vc,{className:"h-4 w-4"})}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs(S,{variant:"outline",disabled:y,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(zt,{className:$("h-4 w-4",y&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认重新生成 Token"}),e.jsx(cs,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:te,children:"确认生成"})]})]})]})]})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(ie,{id:"new-token",type:p?"text":"password",value:d,onChange:he=>m(he.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),e.jsx("button",{onClick:()=>g(!p),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:p?"隐藏":"显示",children:p?e.jsx(ci,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Rt,{className:"h-4 w-4 text-muted-foreground"})})]}),d&&e.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),e.jsx("div",{className:"space-y-1.5",children:I.rules.map(he=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[he.passed?e.jsx(aa,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(mg,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:$(he.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:he.label})]},he.id))}),I.isValid&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(S,{onClick:A,disabled:b||!I.isValid||!d,className:"w-full sm:w-auto",children:b?"更新中...":"更新自定义 Token"})]})]}),e.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[e.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),e.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),e.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),e.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),e.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),e.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),e.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function G0(){const n=va(),{toast:r}=$s(),[i,d]=u.useState(!1),[m,x]=u.useState(!1),[f,p]=u.useState(()=>nt("logCacheSize")),[g,b]=u.useState(()=>nt("wsReconnectInterval")),[j,y]=u.useState(()=>nt("wsMaxReconnectAttempts")),[N,k]=u.useState(()=>nt("dataSyncInterval")),[w,U]=u.useState(()=>ip()),[O,B]=u.useState(!1),[Y,L]=u.useState(!1),z=u.useRef(null);if(m)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const K=()=>{U(ip())},I=D=>{const J=D[0];p(J),Zn("logCacheSize",J)},T=D=>{const J=D[0];b(J),Zn("wsReconnectInterval",J)},A=D=>{const J=D[0];y(J),Zn("wsMaxReconnectAttempts",J)},te=D=>{const J=D[0];k(J),Zn("dataSyncInterval",J)},fe=()=>{tn.clearLogs(),r({title:"日志已清除",description:"日志缓存已清空"})},je=()=>{const D=D0();K(),r({title:"缓存已清除",description:`已清除 ${D.clearedKeys.length} 项缓存数据`})},pe=()=>{B(!0);try{const D=z0(),J=JSON.stringify(D,null,2),q=new Blob([J],{type:"application/json"}),se=URL.createObjectURL(q),R=document.createElement("a");R.href=se,R.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(R),R.click(),document.body.removeChild(R),URL.revokeObjectURL(se),r({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(D){console.error("导出设置失败:",D),r({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{B(!1)}},he=D=>{const J=D.target.files?.[0];if(!J)return;L(!0);const q=new FileReader;q.onload=se=>{try{const R=se.target?.result,ue=JSON.parse(R),me=A0(ue);me.success?(p(nt("logCacheSize")),b(nt("wsReconnectInterval")),y(nt("wsMaxReconnectAttempts")),k(nt("dataSyncInterval")),K(),r({title:"导入成功",description:`成功导入 ${me.imported.length} 项设置${me.skipped.length>0?`,跳过 ${me.skipped.length} 项`:""}`}),(me.imported.includes("theme")||me.imported.includes("accentColor"))&&r({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):r({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(R){console.error("导入设置失败:",R),r({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{L(!1),z.current&&(z.current.value="")}},q.readAsText(J)},ve=()=>{M0(),p(Da.logCacheSize),b(Da.wsReconnectInterval),y(Da.wsMaxReconnectAttempts),k(Da.dataSyncInterval),K(),r({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},be=async()=>{d(!0);try{const D=localStorage.getItem("access-token"),J=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${D}`}}),q=await J.json();J.ok&&q.success?(r({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{n({to:"/setup"})},1e3)):r({title:"重置失败",description:q.message||"无法重置配置状态",variant:"destructive"})}catch(D){console.error("重置配置状态错误:",D),r({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{d(!1)}};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Fc,{className:"h-5 w-5"}),"性能与存储"]}),e.jsxs("div",{className:"space-y-4 sm:space-y-5",children:[e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(WN,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(S,{variant:"ghost",size:"sm",onClick:K,className:"h-7 px-2",children:e.jsx(zt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:O0(w.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[w.items," 个存储项"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[f," 条"]})]}),e.jsx(pa,{value:[f],onValueChange:I,min:100,max:5e3,step:100,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制日志查看器最多缓存的日志条数,较大的值会占用更多内存"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," 秒"]})]}),e.jsx(pa,{value:[N],onValueChange:te,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制首页统计数据的自动刷新间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[g/1e3," 秒"]})]}),e.jsx(pa,{value:[g],onValueChange:T,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"日志 WebSocket 连接断开后的重连基础间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[j," 次"]})]}),e.jsx(pa,{value:[j],onValueChange:A,min:3,max:30,step:1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"连接失败后的最大重连尝试次数"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:fe,className:"gap-2",children:[e.jsx(We,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(We,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认清除本地缓存"}),e.jsx(cs,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:je,children:"确认清除"})]})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Oa,{className:"h-5 w-5"}),"导入/导出设置"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"导出当前的界面设置以便备份,或从之前导出的文件中恢复设置。"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(S,{variant:"outline",onClick:pe,disabled:O,className:"gap-2",children:[e.jsx(Oa,{className:"h-4 w-4"}),O?"导出中...":"导出设置"]}),e.jsx("input",{ref:z,type:"file",accept:".json",onChange:he,className:"hidden"}),e.jsxs(S,{variant:"outline",onClick:()=>z.current?.click(),disabled:Y,className:"gap-2",children:[e.jsx(oi,{className:"h-4 w-4"}),Y?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx($c,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认重置所有设置"}),e.jsx(cs,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:ve,children:"确认重置"})]})]})]})})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs(S,{variant:"outline",disabled:i,className:"gap-2",children:[e.jsx($c,{className:$("h-4 w-4",i&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认重新配置"}),e.jsx(cs,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:be,children:"确认重置"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Ca,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs(S,{variant:"destructive",className:"gap-2",children:[e.jsx(Ca,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认触发错误"}),e.jsx(cs,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>x(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function $0(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:e.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),e.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:$("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",Ku]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",Zc]}),e.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",e.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"React 19.2.0"}),e.jsx("li",{children:"TypeScript 5.7.2"}),e.jsx("li",{children:"Vite 6.0.7"}),e.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"shadcn/ui"}),e.jsx("li",{children:"Radix UI"}),e.jsx("li",{children:"Tailwind CSS 3.4.17"}),e.jsx("li",{children:"Lucide Icons"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"后端"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Python 3.12+"}),e.jsx("li",{children:"FastAPI"}),e.jsx("li",{children:"Uvicorn"}),e.jsx("li",{children:"WebSocket"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Bun / npm"}),e.jsx("li",{children:"ESLint 9.17.0"}),e.jsx("li",{children:"PostCSS"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),e.jsx(Ze,{className:"h-[300px] sm:h-[400px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ws,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(Ws,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(Ws,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(Ws,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(Ws,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ws,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(Ws,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ws,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(Ws,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ws,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(Ws,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(Ws,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(Ws,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ws,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(Ws,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ws,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(Ws,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(Ws,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(Ws,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ws,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(Ws,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(Ws,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(Ws,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:e.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Ws({name:n,description:r,license:i}){return e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:n}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:r})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:i})]})}function ku({value:n,current:r,onChange:i,label:d,description:m}){const x=r===n;return e.jsxs("button",{onClick:()=>i(n),className:$("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:d}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:m})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[n==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),n==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),n==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function fa({value:n,current:r,onChange:i,label:d,colorClass:m}){const x=r===n;return e.jsxs("button",{onClick:()=>i(n),className:$("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:$("h-8 w-8 sm:h-10 sm:w-10 rounded-full",m)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:d})]})]})}class F0{grad3;p;perm;constructor(r=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let i=0;i<256;i++)this.p[i]=Math.floor(Math.random()*256);this.perm=[];for(let i=0;i<512;i++)this.perm[i]=this.p[i&255]}dot(r,i,d){return r[0]*i+r[1]*d}mix(r,i,d){return(1-d)*r+d*i}fade(r){return r*r*r*(r*(r*6-15)+10)}perlin2(r,i){const d=Math.floor(r)&255,m=Math.floor(i)&255;r-=Math.floor(r),i-=Math.floor(i);const x=this.fade(r),f=this.fade(i),p=this.perm[d]+m,g=this.perm[p],b=this.perm[p+1],j=this.perm[d+1]+m,y=this.perm[j],N=this.perm[j+1];return this.mix(this.mix(this.dot(this.grad3[g%12],r,i),this.dot(this.grad3[y%12],r-1,i),x),this.mix(this.dot(this.grad3[b%12],r,i-1),this.dot(this.grad3[N%12],r-1,i-1),x),f)}}function op(){const n=u.useRef(null),r=u.useRef(null),i=u.useRef(void 0),d=u.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new F0(Math.random()),bounding:null});return u.useEffect(()=>{const m=r.current,x=n.current;if(!m||!x)return;const f=d.current,p=()=>{const U=m.getBoundingClientRect();f.bounding=U,x.style.width=`${U.width}px`,x.style.height=`${U.height}px`},g=()=>{if(!f.bounding)return;const{width:U,height:O}=f.bounding;f.lines=[],f.paths.forEach(te=>te.remove()),f.paths=[];const B=10,Y=32,L=U+200,z=O+30,K=Math.ceil(L/B),I=Math.ceil(z/Y),T=(U-B*K)/2,A=(O-Y*I)/2;for(let te=0;te<=K;te++){const fe=[];for(let pe=0;pe<=I;pe++){const he={x:T+B*te,y:A+Y*pe,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};fe.push(he)}const je=document.createElementNS("http://www.w3.org/2000/svg","path");x.appendChild(je),f.paths.push(je),f.lines.push(fe)}},b=U=>{const{lines:O,mouse:B,noise:Y}=f;O.forEach(L=>{L.forEach(z=>{const K=Y.perlin2((z.x+U*.0125)*.002,(z.y+U*.005)*.0015)*12;z.wave.x=Math.cos(K)*32,z.wave.y=Math.sin(K)*16;const I=z.x-B.sx,T=z.y-B.sy,A=Math.hypot(I,T),te=Math.max(175,B.vs);if(A{const B={x:U.x+U.wave.x+(O?U.cursor.x:0),y:U.y+U.wave.y+(O?U.cursor.y:0)};return B.x=Math.round(B.x*10)/10,B.y=Math.round(B.y*10)/10,B},y=()=>{const{lines:U,paths:O}=f;U.forEach((B,Y)=>{let L=j(B[0],!1),z=`M ${L.x} ${L.y}`;B.forEach((K,I)=>{const T=I===B.length-1;L=j(K,!T),z+=`L ${L.x} ${L.y}`}),O[Y].setAttribute("d",z)})},N=U=>{const{mouse:O}=f;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const B=O.x-O.lx,Y=O.y-O.ly,L=Math.hypot(B,Y);O.v=L,O.vs+=(L-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(Y,B),m&&(m.style.setProperty("--x",`${O.sx}px`),m.style.setProperty("--y",`${O.sy}px`)),b(U),y(),i.current=requestAnimationFrame(N)},k=U=>{if(!f.bounding)return;const{mouse:O}=f;O.x=U.pageX-f.bounding.left,O.y=U.pageY-f.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},w=()=>{p(),g()};return p(),g(),window.addEventListener("resize",w),window.addEventListener("mousemove",k),i.current=requestAnimationFrame(N),()=>{window.removeEventListener("resize",w),window.removeEventListener("mousemove",k),i.current&&cancelAnimationFrame(i.current)}},[]),e.jsxs("div",{ref:r,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:n,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` + path { + fill: none; + stroke: hsl(var(--primary) / 0.20); + stroke-width: 1px; + } + `})})]})}async function Se(n,r){const i={...r,credentials:"include",headers:{"Content-Type":"application/json",...r?.headers}},d=await fetch(n,i);if(d.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return d}function Gs(){return{"Content-Type":"application/json"}}async function V0(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(n){console.error("登出请求失败:",n)}window.location.href="/auth"}async function Ju(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}function Q0(){const[n,r]=u.useState(""),[i,d]=u.useState(!1),[m,x]=u.useState(""),[f,p]=u.useState(!0),g=va(),{enableWavesBackground:b,setEnableWavesBackground:j}=Mg(),{theme:y,setTheme:N}=Yu();u.useEffect(()=>{(async()=>{try{await Ju()&&g({to:"/"})}catch{}finally{p(!1)}})()},[g]);const w=y==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":y,U=()=>{N(w==="dark"?"light":"dark")},O=async B=>{if(B.preventDefault(),x(""),!n.trim()){x("请输入 Access Token");return}d(!0);try{const Y=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:n.trim()})}),L=await Y.json();Y.ok&&L.valid?L.is_first_setup?g({to:"/setup"}):g({to:"/"}):x(L.message||"Token 验证失败,请检查后重试")}catch(Y){console.error("Token 验证错误:",Y),x("连接服务器失败,请检查网络连接")}finally{d(!1)}};return f?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[b&&e.jsx(op,{}),e.jsx("div",{className:"text-muted-foreground",children:"正在检查登录状态..."})]}):e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[b&&e.jsx(op,{}),e.jsxs(Fe,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[e.jsx("button",{onClick:U,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(xg,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(hg,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(ts,{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(Jf,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(as,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(et,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(xs,{children:e.jsxs("form",{onSubmit:O,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(fg,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(ie,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:n,onChange:B=>r(B.target.value),className:$("pl-10",m&&"border-red-500 focus-visible:ring-red-500"),disabled:i,autoFocus:!0,autoComplete:"off"})]})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(At,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:m})]}),e.jsx(S,{type:"submit",className:"w-full",disabled:i,children:i?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),e.jsxs(qs,{children:[e.jsx(Xu,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(pg,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Ls,{className:"sm:max-w-md",children:[e.jsxs(Us,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(Jf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(Ps,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ey,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),e.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),e.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Sa,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),e.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:e.jsx("code",{className:"text-primary",children:"data/webui.json"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",e.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(At,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"安全提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),e.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(an,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsxs(is,{className:"flex items-center gap-2",children:[e.jsx(an,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(cs,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>j(!1),children:"关闭动画"})]})]})]})]})})]}),e.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:e.jsx("p",{children:k0})})]})}const Qs=u.forwardRef(({className:n,...r},i)=>e.jsx("textarea",{className:$("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:i,...r}));Qs.displayName="Textarea";const Pc=u.forwardRef(({className:n,orientation:r="horizontal",decorative:i=!0,...d},m)=>e.jsx(Hp,{ref:m,decorative:i,orientation:r,className:$("shrink-0 bg-border",r==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...d}));Pc.displayName=Hp.displayName;function I0({config:n,onChange:r}){const i=m=>{m.trim()&&!n.alias_names.includes(m.trim())&&r({...n,alias_names:[...n.alias_names,m.trim()]})},d=m=>{r({...n,alias_names:n.alias_names.filter((x,f)=>f!==m)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(ie,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:n.qq_account||"",onChange:m=>r({...n,qq_account:Number(m.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(ie,{id:"nickname",placeholder:"请输入机器人的昵称",value:n.nickname,onChange:m=>r({...n,nickname:m.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:n.alias_names.map((m,x)=>e.jsxs(Qe,{variant:"secondary",className:"gap-1",children:[m,e.jsx("button",{type:"button",onClick:()=>d(x),className:"ml-1 hover:text-destructive",children:e.jsx(rl,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:m=>{m.key==="Enter"&&(i(m.target.value),m.target.value="")}}),e.jsx(S,{type:"button",variant:"outline",onClick:()=>{const m=document.getElementById("alias_input");m&&(i(m.value),m.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function Y0({config:n,onChange:r}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(Qs,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:n.personality,onChange:i=>r({...n,personality:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(Qs,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:n.reply_style,onChange:i=>r({...n,reply_style:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(Qs,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:n.interest,onChange:i=>r({...n,interest:i.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(Pc,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(Qs,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:n.plan_style,onChange:i=>r({...n,plan_style:i.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(Qs,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:n.private_plan_style,onChange:i=>r({...n,private_plan_style:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function K0({config:n,onChange:r}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(n.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(ie,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:n.emoji_chance,onChange:i=>r({...n,emoji_chance:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(ie,{id:"max_reg_num",type:"number",min:"1",max:"200",value:n.max_reg_num,onChange:i=>r({...n,max_reg_num:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx($e,{id:"do_replace",checked:n.do_replace,onCheckedChange:i=>r({...n,do_replace:i})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ie,{id:"check_interval",type:"number",min:"1",max:"120",value:n.check_interval,onChange:i=>r({...n,check_interval:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(Pc,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx($e,{id:"steal_emoji",checked:n.steal_emoji,onCheckedChange:i=>r({...n,steal_emoji:i})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx($e,{id:"content_filtration",checked:n.content_filtration,onCheckedChange:i=>r({...n,content_filtration:i})})]}),n.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ie,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:n.filtration_prompt,onChange:i=>r({...n,filtration_prompt:i.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function X0({config:n,onChange:r}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx($e,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:i=>r({...n,enable_tool:i})})]}),e.jsx(Pc,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx($e,{id:"all_global",checked:n.all_global,onCheckedChange:i=>r({...n,all_global:i})})]})]})}function J0({config:n,onChange:r}){const[i,d]=u.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx(Hc,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(ie,{id:"siliconflow_api_key",type:i?"text":"password",placeholder:"sk-...",value:n.api_key,onChange:m=>r({api_key:m.target.value}),className:"font-mono pr-10"}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>d(!i),children:i?e.jsx(ci,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Rt,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[e.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[e.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),e.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),e.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),e.jsx("li",{children:"SenseVoice - 语音识别"}),e.jsx("li",{children:"BGE-M3 - 文本嵌入"}),e.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),e.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:e.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function Z0(){const n=await Se("/api/webui/config/bot",{method:"GET",headers:Gs()});if(!n.ok)throw new Error("读取Bot配置失败");const i=(await n.json()).config.bot||{};return{qq_account:i.qq_account||0,nickname:i.nickname||"",alias_names:i.alias_names||[]}}async function P0(){const n=await Se("/api/webui/config/bot",{method:"GET",headers:Gs()});if(!n.ok)throw new Error("读取人格配置失败");const i=(await n.json()).config.personality||{};return{personality:i.personality||"",reply_style:i.reply_style||"",interest:i.interest||"",plan_style:i.plan_style||"",private_plan_style:i.private_plan_style||""}}async function W0(){const n=await Se("/api/webui/config/bot",{method:"GET",headers:Gs()});if(!n.ok)throw new Error("读取表情包配置失败");const i=(await n.json()).config.emoji||{};return{emoji_chance:i.emoji_chance??.4,max_reg_num:i.max_reg_num??40,do_replace:i.do_replace??!0,check_interval:i.check_interval??10,steal_emoji:i.steal_emoji??!0,content_filtration:i.content_filtration??!1,filtration_prompt:i.filtration_prompt||""}}async function ew(){const n=await Se("/api/webui/config/bot",{method:"GET",headers:Gs()});if(!n.ok)throw new Error("读取其他配置失败");const i=(await n.json()).config,d=i.tool||{},m=i.expression||{};return{enable_tool:d.enable_tool??!0,all_global:m.all_global_jargon??!0}}async function sw(){const n=await Se("/api/webui/config/model",{method:"GET",headers:Gs()});if(!n.ok)throw new Error("读取模型配置失败");return{api_key:((await n.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function tw(n){const r=await Se("/api/webui/config/bot/section/bot",{method:"POST",headers:Gs(),body:JSON.stringify(n)});if(!r.ok){const i=await r.json();throw new Error(i.detail||"保存Bot基础配置失败")}return await r.json()}async function aw(n){const r=await Se("/api/webui/config/bot/section/personality",{method:"POST",headers:Gs(),body:JSON.stringify(n)});if(!r.ok){const i=await r.json();throw new Error(i.detail||"保存人格配置失败")}return await r.json()}async function lw(n){const r=await Se("/api/webui/config/bot/section/emoji",{method:"POST",headers:Gs(),body:JSON.stringify(n)});if(!r.ok){const i=await r.json();throw new Error(i.detail||"保存表情包配置失败")}return await r.json()}async function nw(n){const r=[];r.push(Se("/api/webui/config/bot/section/tool",{method:"POST",headers:Gs(),body:JSON.stringify({enable_tool:n.enable_tool})})),r.push(Se("/api/webui/config/bot/section/expression",{method:"POST",headers:Gs(),body:JSON.stringify({all_global_jargon:n.all_global})}));const i=await Promise.all(r);for(const d of i)if(!d.ok){const m=await d.json();throw new Error(m.detail||"保存其他配置失败")}return{success:!0}}async function rw(n){const r=await Se("/api/webui/config/model",{method:"GET",headers:Gs()});if(!r.ok)throw new Error("读取模型配置失败");const d=(await r.json()).config,m=d.api_providers||[],x=m.findIndex(g=>g.name==="SiliconFlow");x>=0?m[x]={...m[x],api_key:n.api_key}:m.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:n.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const f={...d,api_providers:m},p=await Se("/api/webui/config/model",{method:"POST",headers:Gs(),body:JSON.stringify(f)});if(!p.ok){const g=await p.json();throw new Error(g.detail||"保存模型配置失败")}return await p.json()}async function dp(){const n=localStorage.getItem("access-token"),r=await Se("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${n}`}});if(!r.ok){const i=await r.json();throw new Error(i.message||"标记配置完成失败")}return await r.json()}async function Wc(){const n=await Se("/api/webui/system/restart",{method:"POST",headers:Gs()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"重启失败")}return await n.json()}async function Lg(){const n=await Se("/api/webui/system/status",{method:"GET",headers:Gs()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取状态失败")}return await n.json()}function iw(){const n=va(),{toast:r}=$s(),[i,d]=u.useState(0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),[g,b]=u.useState(!0),[j,y]=u.useState({qq_account:0,nickname:"",alias_names:[]}),[N,k]=u.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.请控制你的发言频率,不要太过频繁的发言 +4.如果有人对你感到厌烦,请减少回复 +5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.某句话如果已经被回复过,不要重复回复`}),[w,U]=u.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,B]=u.useState({enable_tool:!0,all_global:!0}),[Y,L]=u.useState({api_key:""}),[z,K]=u.useState(!1),[I,T]=u.useState(""),A=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:ti},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:Qc},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Vu},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:ar},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:fg}],te=(i+1)/A.length*100;u.useEffect(()=>{(async()=>{try{b(!0);const[J,q,se,R,ue]=await Promise.all([Z0(),P0(),W0(),ew(),sw()]);y(J),k(q),U(se),B(R),L(ue)}catch(J){r({title:"加载配置失败",description:J instanceof Error?J.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{b(!1)}})()},[r]);const fe=async()=>{p(!0);try{switch(i){case 0:await tw(j);break;case 1:await aw(N);break;case 2:await lw(w);break;case 3:await nw(O);break;case 4:await rw(Y);break}return r({title:"保存成功",description:`${A[i].title}配置已保存`}),!0}catch(D){return r({title:"保存失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},je=async()=>{await fe()&&i{i>0&&d(i-1)},he=async()=>{x(!0),K(!0);try{if(T("正在保存API配置..."),!await fe()){x(!1),K(!1);return}T("正在完成初始化..."),await dp(),T("正在重启麦麦..."),await Wc(),r({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),T("等待麦麦重启完成...");const J=60;let q=0,se=!1;for(;qsetTimeout(R,1e3));try{(await Lg()).running&&(se=!0,T("重启成功!正在跳转..."))}catch{q++}}if(!se)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{n({to:"/"})},1e3)}catch(D){K(!1),r({title:"配置失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}finally{x(!1)}},ve=async()=>{try{await dp(),n({to:"/"})}catch(D){r({title:"跳过失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}},be=()=>{switch(i){case 0:return e.jsx(I0,{config:j,onChange:y});case 1:return e.jsx(Y0,{config:N,onChange:k});case 2:return e.jsx(K0,{config:w,onChange:U});case 3:return e.jsx(X0,{config:O,onChange:B});case 4:return e.jsx(J0,{config:Y,onChange:L});default:return null}};return e.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[z&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[e.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(it,{className:"h-10 w-10 animate-spin text-primary"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),e.jsx("p",{className:"text-muted-foreground",children:I})]}),e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),e.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),g?e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:e.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),e.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[e.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(sy,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),e.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",Ku," 的初始配置"]})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",i+1," / ",A.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(te),"%"]})]}),e.jsx(rr,{value:te,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:A.map((D,J)=>{const q=D.icon;return e.jsxs("div",{className:$("flex flex-1 flex-col items-center gap-1 md:gap-2",Jn({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Jc,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(S,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx(er,{className:"h-4 w-4"}),"返回上一页"]})]}),e.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}const cw=bt.memo(function({config:r,onChange:i}){const d=()=>{i({...r,platforms:[...r.platforms,""]})},m=b=>{i({...r,platforms:r.platforms.filter((j,y)=>y!==b)})},x=(b,j)=>{const y=[...r.platforms];y[b]=j,i({...r,platforms:y})},f=()=>{i({...r,alias_names:[...r.alias_names,""]})},p=b=>{i({...r,alias_names:r.alias_names.filter((j,y)=>y!==b)})},g=(b,j)=>{const y=[...r.alias_names];y[b]=j,i({...r,alias_names:y})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"platform",children:"平台"}),e.jsx(ie,{id:"platform",value:r.platform,onChange:b=>i({...r,platform:b.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(ie,{id:"qq_account",value:r.qq_account,onChange:b=>i({...r,qq_account:b.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称"}),e.jsx(ie,{id:"nickname",value:r.nickname,onChange:b=>i({...r,nickname:b.target.value}),placeholder:"麦麦"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"其他平台账号"}),e.jsxs(S,{onClick:d,size:"sm",variant:"outline",children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[r.platforms.map((b,j)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{value:b,onChange:y=>x(j,y.target.value),placeholder:"wx:114514"}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:['确定要删除平台账号 "',b||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>m(j),children:"删除"})]})]})]})]},j)),r.platforms.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"别名"}),e.jsxs(S,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[r.alias_names.map((b,j)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{value:b,onChange:y=>g(j,y.target.value),placeholder:"小麦"}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:['确定要删除别名 "',b||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>p(j),children:"删除"})]})]})]})]},j)),r.alias_names.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}),ow=bt.memo(function({config:r,onChange:i}){const d=()=>{i({...r,states:[...r.states,""]})},m=f=>{i({...r,states:r.states.filter((p,g)=>g!==f)})},x=(f,p)=>{const g=[...r.states];g[f]=p,i({...r,states:g})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"personality",children:"人格特质"}),e.jsx(Qs,{id:"personality",value:r.personality,onChange:f=>i({...r,personality:f.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(Qs,{id:"reply_style",value:r.reply_style,onChange:f=>i({...r,reply_style:f.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"interest",children:"兴趣"}),e.jsx(Qs,{id:"interest",value:r.interest,onChange:f=>i({...r,interest:f.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(Qs,{id:"plan_style",value:r.plan_style,onChange:f=>i({...r,plan_style:f.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(Qs,{id:"visual_style",value:r.visual_style,onChange:f=>i({...r,visual_style:f.target.value}),placeholder:"识图时的处理规则",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"private_plan_style",children:"私聊规则"}),e.jsx(Qs,{id:"private_plan_style",value:r.private_plan_style,onChange:f=>i({...r,private_plan_style:f.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"状态列表(人格多样性)"}),e.jsxs(S,{onClick:d,size:"sm",variant:"outline",children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),e.jsx("div",{className:"space-y-2",children:r.states.map((f,p)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qs,{value:f,onChange:g=>x(p,g.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsx(cs,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>m(p),children:"删除"})]})]})]})]},p))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"state_probability",children:"状态替换概率"}),e.jsx(ie,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:r.state_probability,onChange:f=>i({...r,state_probability:parseFloat(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}),Ue=DN,Be=ON,Oe=u.forwardRef(({className:n,children:r,...i},d)=>e.jsxs(Jp,{ref:d,className:$("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...i,children:[r,e.jsx(TN,{asChild:!0,children:e.jsx(Ll,{className:"h-4 w-4 opacity-50"})})]}));Oe.displayName=Jp.displayName;const Bg=u.forwardRef(({className:n,...r},i)=>e.jsx(Zp,{ref:i,className:$("flex cursor-default items-center justify-center py-1",n),...r,children:e.jsx(di,{className:"h-4 w-4"})}));Bg.displayName=Zp.displayName;const Hg=u.forwardRef(({className:n,...r},i)=>e.jsx(Pp,{ref:i,className:$("flex cursor-default items-center justify-center py-1",n),...r,children:e.jsx(Ll,{className:"h-4 w-4"})}));Hg.displayName=Pp.displayName;const Re=u.forwardRef(({className:n,children:r,position:i="popper",...d},m)=>e.jsx(EN,{children:e.jsxs(Wp,{ref:m,className:$("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg 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 origin-[--radix-select-content-transform-origin]",i==="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",n),position:i,...d,children:[e.jsx(Bg,{}),e.jsx(zN,{className:$("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),e.jsx(Hg,{})]})}));Re.displayName=Wp.displayName;const dw=u.forwardRef(({className:n,...r},i)=>e.jsx(eg,{ref:i,className:$("px-2 py-1.5 text-sm font-semibold",n),...r}));dw.displayName=eg.displayName;const le=u.forwardRef(({className:n,children:r,...i},d)=>e.jsxs(sg,{ref:d,className:$("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...i,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(AN,{children:e.jsx(Qt,{className:"h-4 w-4"})})}),e.jsx(MN,{children:r})]}));le.displayName=sg.displayName;const uw=u.forwardRef(({className:n,...r},i)=>e.jsx(tg,{ref:i,className:$("-mx-1 my-1 h-px bg-muted",n),...r}));uw.displayName=tg.displayName;const La=cN,Ua=oN,ka=u.forwardRef(({className:n,align:r="center",sideOffset:i=4,...d},m)=>e.jsx(iN,{children:e.jsx(qp,{ref:m,align:r,sideOffset:i,className:$("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 origin-[--radix-popover-content-transform-origin]",n),...d})}));ka.displayName=qp.displayName;const mw=bt.memo(function({value:r,onChange:i}){const[d,m]=u.useState("00"),[x,f]=u.useState("00"),[p,g]=u.useState("23"),[b,j]=u.useState("59");u.useEffect(()=>{const N=r.split("-");if(N.length===2){const[k,w]=N,[U,O]=k.split(":"),[B,Y]=w.split(":");U&&m(U.padStart(2,"0")),O&&f(O.padStart(2,"0")),B&&g(B.padStart(2,"0")),Y&&j(Y.padStart(2,"0"))}},[r]);const y=(N,k,w,U)=>{const O=`${N}:${k}-${w}:${U}`;i(O)};return e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(S,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(Pn,{className:"h-4 w-4 mr-2"}),r||"选择时间段"]})}),e.jsx(ka,{className:"w-72 sm:w-80",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"小时"}),e.jsxs(Ue,{value:d,onValueChange:N=>{m(N),y(N,x,p,b)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:24},(N,k)=>k).map(N=>e.jsx(le,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"分钟"}),e.jsxs(Ue,{value:x,onValueChange:N=>{f(N),y(d,N,p,b)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:60},(N,k)=>k).map(N=>e.jsx(le,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"小时"}),e.jsxs(Ue,{value:p,onValueChange:N=>{g(N),y(d,x,N,b)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:24},(N,k)=>k).map(N=>e.jsx(le,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"分钟"}),e.jsxs(Ue,{value:b,onValueChange:N=>{j(N),y(d,x,p,N)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:60},(N,k)=>k).map(N=>e.jsx(le,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]})]})})]})}),xw=bt.memo(function({rule:r}){const i=`{ target = "${r.target}", time = "${r.time}", value = ${r.value.toFixed(1)} }`;return e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",children:[e.jsx(Rt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(ka,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:i}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})}),hw=bt.memo(function({config:r,onChange:i}){const d=()=>{i({...r,talk_value_rules:[...r.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},m=f=>{i({...r,talk_value_rules:r.talk_value_rules.filter((p,g)=>g!==f)})},x=(f,p,g)=>{const b=[...r.talk_value_rules];b[f]={...b[f],[p]:g},i({...r,talk_value_rules:b})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(ie,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:r.talk_value,onChange:f=>i({...r,talk_value:parseFloat(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"mentioned_bot_reply",checked:r.mentioned_bot_reply,onCheckedChange:f=>i({...r,mentioned_bot_reply:f})}),e.jsx(C,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(ie,{id:"max_context_size",type:"number",min:"1",value:r.max_context_size,onChange:f=>i({...r,max_context_size:parseInt(f.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(ie,{id:"planner_smooth",type:"number",step:"1",min:"0",value:r.planner_smooth,onChange:f=>i({...r,planner_smooth:parseFloat(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"enable_talk_value_rules",checked:r.enable_talk_value_rules,onCheckedChange:f=>i({...r,enable_talk_value_rules:f})}),e.jsx(C,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"include_planner_reasoning",checked:r.include_planner_reasoning,onCheckedChange:f=>i({...r,include_planner_reasoning:f})}),e.jsx(C,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),r.enable_talk_value_rules&&e.jsxs("div",{className:"border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),e.jsxs(S,{onClick:d,size:"sm",children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),r.talk_value_rules&&r.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:r.talk_value_rules.map((f,p)=>e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",p+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xw,{rule:f}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",children:e.jsx(We,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:["确定要删除规则 #",p+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>m(p),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Ue,{value:f.target===""?"global":"specific",onValueChange:g=>{g==="global"?x(p,"target",""):x(p,"target","qq::group")},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"global",children:"全局配置"}),e.jsx(le,{value:"specific",children:"详细配置"})]})]})]}),f.target!==""&&(()=>{const g=f.target.split(":"),b=g[0]||"qq",j=g[1]||"",y=g[2]||"group";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ue,{value:b,onValueChange:N=>{x(p,"target",`${N}:${j}:${y}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ie,{value:j,onChange:N=>{x(p,"target",`${b}:${N.target.value}:${y}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ue,{value:y,onValueChange:N=>{x(p,"target",`${b}:${j}:${N}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"group",children:"群组(group)"}),e.jsx(le,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",f.target||"(未设置)"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(mw,{value:f.time,onChange:g=>x(p,"time",g)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{htmlFor:`rule-value-${p}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(ie,{id:`rule-value-${p}`,type:"number",step:"0.01",min:"0.01",max:"1",value:f.value,onChange:g=>{const b=parseFloat(g.target.value);isNaN(b)||x(p,"value",Math.max(.01,Math.min(1,b)))},className:"w-20 h-8 text-xs"})]}),e.jsx(pa,{value:[f.value],onValueChange:g=>x(p,"value",g[0]),min:.01,max:1,step:.01,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0.01 (极少发言)"}),e.jsx("span",{children:"0.5"}),e.jsx("span",{children:"1.0 (正常)"})]})]})]})]},p))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),e.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}),fw=bt.memo(function({config:r,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{checked:r.enable_asr,onCheckedChange:d=>i({...r,enable_asr:d})}),e.jsx(C,{className:"cursor-pointer",children:"启用语音识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}),pw=bt.memo(function({config:r,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{checked:r.enable,onCheckedChange:d=>i({...r,enable:d})}),e.jsx(C,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),r.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"LPMM 模式"}),e.jsxs(Ue,{value:r.lpmm_mode,onValueChange:d=>i({...r,lpmm_mode:d}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"classic",children:"经典模式"}),e.jsx(le,{value:"agent",children:"Agent 模式"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"同义词搜索 TopK"}),e.jsx(ie,{type:"number",min:"1",value:r.rag_synonym_search_top_k,onChange:d=>i({...r,rag_synonym_search_top_k:parseInt(d.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"同义词阈值"}),e.jsx(ie,{type:"number",step:"0.1",min:"0",max:"1",value:r.rag_synonym_threshold,onChange:d=>i({...r,rag_synonym_threshold:parseFloat(d.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"实体提取线程数"}),e.jsx(ie,{type:"number",min:"1",value:r.info_extraction_workers,onChange:d=>i({...r,info_extraction_workers:parseInt(d.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"嵌入向量维度"}),e.jsx(ie,{type:"number",min:"1",value:r.embedding_dimension,onChange:d=>i({...r,embedding_dimension:parseInt(d.target.value)})})]})]})]})]})]})}),gw=bt.memo(function({config:r,onChange:i}){const[d,m]=u.useState(""),[x,f]=u.useState("WARNING"),p=()=>{d&&!r.suppress_libraries.includes(d)&&(i({...r,suppress_libraries:[...r.suppress_libraries,d]}),m(""))},g=w=>{i({...r,suppress_libraries:r.suppress_libraries.filter(U=>U!==w)})},b=()=>{d&&!r.library_log_levels[d]&&(i({...r,library_log_levels:{...r.library_log_levels,[d]:x}}),m(""),f("WARNING"))},j=w=>{const U={...r.library_log_levels};delete U[w],i({...r,library_log_levels:U})},y=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],N=["FULL","compact","lite"],k=["none","title","full"];return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"日期格式"}),e.jsx(ie,{value:r.date_style,onChange:w=>i({...r,date_style:w.target.value}),placeholder:"例如: m-d H:i:s"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"日志级别样式"}),e.jsxs(Ue,{value:r.log_level_style,onValueChange:w=>i({...r,log_level_style:w}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:N.map(w=>e.jsx(le,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"日志文本颜色"}),e.jsxs(Ue,{value:r.color_text,onValueChange:w=>i({...r,color_text:w}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:k.map(w=>e.jsx(le,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"全局日志级别"}),e.jsxs(Ue,{value:r.log_level,onValueChange:w=>i({...r,log_level:w}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:y.map(w=>e.jsx(le,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"控制台日志级别"}),e.jsxs(Ue,{value:r.console_log_level,onValueChange:w=>i({...r,console_log_level:w}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:y.map(w=>e.jsx(le,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"文件日志级别"}),e.jsxs(Ue,{value:r.file_log_level,onValueChange:w=>i({...r,file_log_level:w}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:y.map(w=>e.jsx(le,{value:w,children:w},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ie,{value:d,onChange:w=>m(w.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),p())}}),e.jsx(S,{onClick:p,size:"sm",className:"flex-shrink-0",children:e.jsx(dt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.suppress_libraries.map(w=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[e.jsx("span",{className:"text-sm",children:w}),e.jsx(S,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>g(w),children:e.jsx(We,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},w))})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ie,{value:d,onChange:w=>m(w.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Ue,{value:x,onValueChange:f,children:[e.jsx(Oe,{className:"w-32",children:e.jsx(Be,{})}),e.jsx(Re,{children:y.map(w=>e.jsx(le,{value:w,children:w},w))})]}),e.jsx(S,{onClick:b,size:"sm",children:e.jsx(dt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(r.library_log_levels).map(([w,U])=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-medium",children:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:U}),e.jsx(S,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>j(w),children:e.jsx(We,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},w))})]})]})}),jw=bt.memo(function({config:r,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx($e,{checked:r.show_prompt,onCheckedChange:d=>i({...r,show_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx($e,{checked:r.show_replyer_prompt,onCheckedChange:d=>i({...r,show_replyer_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx($e,{checked:r.show_replyer_reasoning,onCheckedChange:d=>i({...r,show_replyer_reasoning:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx($e,{checked:r.show_jargon_prompt,onCheckedChange:d=>i({...r,show_jargon_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx($e,{checked:r.show_memory_prompt,onCheckedChange:d=>i({...r,show_memory_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx($e,{checked:r.show_planner_prompt,onCheckedChange:d=>i({...r,show_planner_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx($e,{checked:r.show_lpmm_paragraph,onCheckedChange:d=>i({...r,show_lpmm_paragraph:d})})]})]})]})}),vw=bt.memo(function({config:r,onChange:i}){const[d,m]=u.useState(""),x=()=>{d&&!r.auth_token.includes(d)&&(i({...r,auth_token:[...r.auth_token,d]}),m(""))},f=p=>{i({...r,auth_token:r.auth_token.filter((g,b)=>b!==p)})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"启用自定义服务器"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),e.jsx($e,{checked:r.use_custom,onCheckedChange:p=>i({...r,use_custom:p})})]}),r.use_custom&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"主机地址"}),e.jsx(ie,{value:r.host,onChange:p=>i({...r,host:p.target.value}),placeholder:"127.0.0.1"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"端口号"}),e.jsx(ie,{type:"number",value:r.port,onChange:p=>i({...r,port:parseInt(p.target.value)}),placeholder:"8090"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"连接模式"}),e.jsxs(Ue,{value:r.mode,onValueChange:p=>i({...r,mode:p}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"ws",children:"WebSocket (ws)"}),e.jsx(le,{value:"tcp",children:"TCP"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{checked:r.use_wss,onCheckedChange:p=>i({...r,use_wss:p}),disabled:r.mode!=="ws"}),e.jsx(C,{children:"使用 WSS 安全连接"})]})]}),r.use_wss&&r.mode==="ws"&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"SSL 证书文件路径"}),e.jsx(ie,{value:r.cert_file,onChange:p=>i({...r,cert_file:p.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"SSL 密钥文件路径"}),e.jsx(ie,{value:r.key_file,onChange:p=>i({...r,key_file:p.target.value}),placeholder:"key.pem"})]})]})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"认证令牌"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ie,{value:d,onChange:p=>m(p.target.value),placeholder:"输入认证令牌",onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),x())}}),e.jsx(S,{onClick:x,size:"sm",children:e.jsx(dt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:r.auth_token.map((p,g)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:p}),e.jsx(S,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>f(g),children:e.jsx(We,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},g))})]})]})}),bw=bt.memo(function({config:r,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx($e,{checked:r.enable,onCheckedChange:d=>i({...r,enable:d})})]})]})}),Nw=bt.memo(function({emojiConfig:r,memoryConfig:i,toolConfig:d,onEmojiChange:m,onMemoryChange:x,onToolChange:f}){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"enable_tool",checked:d.enable_tool,onCheckedChange:p=>f({...d,enable_tool:p})}),e.jsx(C,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(ie,{id:"max_agent_iterations",type:"number",min:"1",value:i.max_agent_iterations,onChange:p=>x({...i,max_agent_iterations:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"agent_timeout_seconds",children:"最长回忆时间(秒)"}),e.jsx(ie,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:i.agent_timeout_seconds??120,onChange:p=>x({...i,agent_timeout_seconds:parseFloat(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"记忆检索的超时时间,避免过长的等待"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"enable_jargon_detection",checked:i.enable_jargon_detection??!0,onCheckedChange:p=>x({...i,enable_jargon_detection:p})}),e.jsx(C,{htmlFor:"enable_jargon_detection",className:"cursor-pointer",children:"启用黑话识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"记忆检索过程中是否启用黑话识别"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"global_memory",checked:i.global_memory??!1,onCheckedChange:p=>x({...i,global_memory:p})}),e.jsx(C,{htmlFor:"global_memory",className:"cursor-pointer",children:"全局记忆查询"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许记忆检索在所有聊天记录中进行全局查询(忽略当前聊天流)"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(ie,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:r.emoji_chance,onChange:p=>m({...r,emoji_chance:parseFloat(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(ie,{id:"max_reg_num",type:"number",min:"1",value:r.max_reg_num,onChange:p=>m({...r,max_reg_num:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ie,{id:"check_interval",type:"number",min:"1",value:r.check_interval,onChange:p=>m({...r,check_interval:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"do_replace",checked:r.do_replace,onCheckedChange:p=>m({...r,do_replace:p})}),e.jsx(C,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"steal_emoji",checked:r.steal_emoji,onCheckedChange:p=>m({...r,steal_emoji:p})}),e.jsx(C,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"content_filtration",checked:r.content_filtration,onCheckedChange:p=>m({...r,content_filtration:p})}),e.jsx(C,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),r.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(C,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ie,{id:"filtration_prompt",value:r.filtration_prompt,onChange:p=>m({...r,filtration_prompt:p.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),yw=bt.memo(function({member:r,groupIndex:i,memberIndex:d,availableChatIds:m,onUpdate:x,onRemove:f}){const p=m.includes(r)||r==="*",[g,b]=u.useState(!p);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:g?e.jsxs(e.Fragment,{children:[e.jsx(ie,{value:r,onChange:j=>x(i,d,j.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),m.length>0&&e.jsx(S,{size:"sm",variant:"outline",onClick:()=>b(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ue,{value:r,onValueChange:j=>x(i,d,j),children:[e.jsx(Oe,{className:"flex-1",children:e.jsx(Be,{placeholder:"选择聊天流"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"*",children:"* (全局共享)"}),m.map((j,y)=>e.jsx(le,{value:j,children:j},y))]})]}),e.jsx(S,{size:"sm",variant:"outline",onClick:()=>b(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:['确定要删除组成员 "',r||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>f(i,d),children:"删除"})]})]})]})]})}),ww=bt.memo(function({config:r,onChange:i}){const d=()=>{i({...r,learning_list:[...r.learning_list,["","enable","enable","1.0"]]})},m=N=>{i({...r,learning_list:r.learning_list.filter((k,w)=>w!==N)})},x=(N,k,w)=>{const U=[...r.learning_list];U[N][k]=w,i({...r,learning_list:U})},f=({rule:N})=>{const k=`["${N[0]}", "${N[1]}", "${N[2]}", "${N[3]}"]`;return e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",children:[e.jsx(Rt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(ka,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:k}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},p=()=>{i({...r,expression_groups:[...r.expression_groups,[]]})},g=N=>{i({...r,expression_groups:r.expression_groups.filter((k,w)=>w!==N)})},b=N=>{const k=[...r.expression_groups];k[N]=[...k[N],""],i({...r,expression_groups:k})},j=(N,k)=>{const w=[...r.expression_groups];w[N]=w[N].filter((U,O)=>O!==k),i({...r,expression_groups:w})},y=(N,k,w)=>{const U=[...r.expression_groups];U[N][k]=w,i({...r,expression_groups:U})};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),e.jsxs(S,{onClick:d,size:"sm",variant:"outline",children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[r.learning_list.map((N,k)=>{const w=r.learning_list.some((z,K)=>K!==k&&z[0]===""),U=N[0]==="",O=N[0].split(":"),B=O[0]||"qq",Y=O[1]||"",L=O[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["规则 ",k+1," ",U&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{rule:N}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:["确定要删除学习规则 ",k+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>m(k),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Ue,{value:U?"global":"specific",onValueChange:z=>{z==="global"?x(k,0,""):x(k,0,"qq::group")},disabled:w&&!U,children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"global",children:"全局配置"}),e.jsx(le,{value:"specific",disabled:w&&!U,children:"详细配置"})]})]}),w&&!U&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!U&&e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ue,{value:B,onValueChange:z=>{x(k,0,`${z}:${Y}:${L}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ie,{value:Y,onChange:z=>{x(k,0,`${B}:${z.target.value}:${L}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ue,{value:L,onValueChange:z=>{x(k,0,`${B}:${Y}:${z}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"group",children:"群组(group)"}),e.jsx(le,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",N[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx($e,{checked:N[1]==="enable",onCheckedChange:z=>x(k,1,z?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx($e,{checked:N[2]==="enable",onCheckedChange:z=>x(k,2,z?"enable":"disable")})]})}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-xs font-medium",children:"学习强度"}),e.jsx(ie,{type:"number",step:"0.1",min:"0",max:"5",value:N[3],onChange:z=>{const K=parseFloat(z.target.value);isNaN(K)||x(k,3,Math.max(0,Math.min(5,K)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),e.jsx(pa,{value:[parseFloat(N[3])||1],onValueChange:z=>x(k,3,z[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0 (不学习)"}),e.jsx("span",{children:"2.5"}),e.jsx("span",{children:"5.0 (快速学习)"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},k)}),r.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达反思配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦主动向管理员询问表达方式是否合适的功能"})]}),e.jsx($e,{checked:r.reflect,onCheckedChange:N=>i({...r,reflect:N})})]}),r.reflect&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"反思操作员"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const k=(r.reflect_operator_id||"").split(":"),w=k[0]||"qq",U=k[1]||"",O=k[2]||"private";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ue,{value:w,onValueChange:B=>{i({...r,reflect_operator_id:`${B}:${U}:${O}`})},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(ie,{value:U,onChange:B=>{i({...r,reflect_operator_id:`${w}:${B.target.value}:${O}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ue,{value:O,onValueChange:B=>{i({...r,reflect_operator_id:`${w}:${U}:${B}`})},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"private",children:"私聊(private)"}),e.jsx(le,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",r.reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会向此操作员询问表达方式是否合适"})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"允许反思的聊天流"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思"})]}),e.jsxs(S,{onClick:()=>{i({...r,allow_reflect:[...r.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(r.allow_reflect||[]).map((N,k)=>{const w=N.split(":"),U=w[0]||"qq",O=w[1]||"",B=w[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Ue,{value:U,onValueChange:Y=>{const L=[...r.allow_reflect];L[k]=`${Y}:${O}:${B}`,i({...r,allow_reflect:L})},children:[e.jsx(Oe,{className:"w-24",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]}),e.jsx(ie,{value:O,onChange:Y=>{const L=[...r.allow_reflect];L[k]=`${U}:${Y.target.value}:${B}`,i({...r,allow_reflect:L})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Ue,{value:B,onValueChange:Y=>{const L=[...r.allow_reflect];L[k]=`${U}:${O}:${Y}`,i({...r,allow_reflect:L})},children:[e.jsx(Oe,{className:"w-32",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"group",children:"群组"}),e.jsx(le,{value:"private",children:"私聊"})]})]}),e.jsx(S,{onClick:()=>{i({...r,allow_reflect:r.allow_reflect.filter((Y,L)=>L!==k)})},size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})]},k)}),(!r.allow_reflect||r.allow_reflect.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:"列表为空,所有聊天流都可以进行表达反思"})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),e.jsxs(S,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[r.expression_groups.map((N,k)=>{const w=r.learning_list.map(U=>U[0]).filter(U=>U!=="");return e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",k+1,N.length===1&&N[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{onClick:()=>b(k),size:"sm",variant:"outline",children:e.jsx(dt,{className:"h-4 w-4"})}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:["确定要删除共享组 ",k+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>g(k),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:N.map((U,O)=>e.jsx(yw,{member:U,groupIndex:k,memberIndex:O,availableChatIds:w,onUpdate:y,onRemove:j},`${k}-${O}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},k)}),r.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"黑话设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"all_global_jargon",checked:r.all_global_jargon??!1,onCheckedChange:N=>i({...r,all_global_jargon:N})}),e.jsx(C,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"全局黑话模式"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"开启后,新增的黑话将默认设为全局(所有聊天流共享)。关闭后,已记录的全局黑话不会改变,需要手动删除。"})]})})]})});function _w({regex:n,reaction:r,onRegexChange:i,onReactionChange:d}){const[m,x]=u.useState(!1),[f,p]=u.useState(""),[g,b]=u.useState(null),[j,y]=u.useState(""),[N,k]=u.useState({}),[w,U]=u.useState(""),O=u.useRef(null),[B,Y]=u.useState("build"),L=T=>T.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),z=(T,A=0)=>{const te=O.current;if(!te)return;const fe=te.selectionStart||0,je=te.selectionEnd||0,pe=n.substring(0,fe)+T+n.substring(je);i(pe),setTimeout(()=>{const he=fe+T.length+A;te.setSelectionRange(he,he),te.focus()},0)};u.useEffect(()=>{if(!n||!f){b(null),k({}),U(r),y("");return}try{const T=L(n),A=new RegExp(T,"g"),te=f.match(A);b(te),y("");const je=new RegExp(T).exec(f);if(je&&je.groups){k(je.groups);let pe=r;Object.entries(je.groups).forEach(([he,ve])=>{pe=pe.replace(new RegExp(`\\[${he}\\]`,"g"),ve||"")}),U(pe)}else k({}),U(r)}catch(T){y(T.message),b(null),k({}),U(r)}},[n,f,r]);const K=()=>{if(!f||!g||g.length===0)return e.jsx("span",{className:"text-muted-foreground",children:f||"请输入测试文本"});try{const T=L(n),A=new RegExp(T,"g");let te=0;const fe=[];let je;for(;(je=A.exec(f))!==null;)je.index>te&&fe.push(e.jsx("span",{children:f.substring(te,je.index)},`text-${te}`)),fe.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:je[0]},`match-${je.index}`)),te=je.index+je[0].length;return te)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return e.jsxs(qs,{open:m,onOpenChange:x,children:[e.jsx(Xu,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",children:[e.jsx(Qu,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Ls,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"正则表达式编辑器"}),e.jsx(Ps,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(Ze,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(ga,{value:B,onValueChange:T=>Y(T),className:"w-full",children:[e.jsxs(la,{className:"grid w-full grid-cols-2",children:[e.jsx(ss,{value:"build",children:"🔧 构建器"}),e.jsx(ss,{value:"test",children:"🧪 测试器"})]}),e.jsxs(Ts,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(ie,{ref:O,value:n,onChange:T=>i(T.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(Qs,{value:r,onChange:T=>d(T.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[I.map(T=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:T.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:T.items.map(A=>e.jsx(S,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>z(A.pattern,A.moveCursor||0),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("span",{className:"text-xs font-medium",children:A.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:A.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:A.desc})]})},A.label))})]},T.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>i("^(?P\\S{1,20})是这样的$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),e.jsx(S,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>i("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),e.jsx(S,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>i("(?P.+?)(?:是|为什么|怎么)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),e.jsxs("li",{children:["命名捕获组格式:",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),e.jsxs("li",{children:["在 reaction 中使用 ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),e.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),e.jsxs(Ts,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:n||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(Qs,{id:"test-text",value:f,onChange:T=>p(T.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),j&&e.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),e.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:j})]}),!j&&f&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:g&&g.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",g.length," 处)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(Ze,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:K()})})]}),Object.keys(N).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(Ze,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(N).map(([T,A])=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",T,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:A})]},T))})})]}),Object.keys(N).length>0&&r&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(Ze,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:w})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),e.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),e.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),e.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})}const Sw=bt.memo(function({keywordReactionConfig:r,responsePostProcessConfig:i,chineseTypoConfig:d,responseSplitterConfig:m,onKeywordReactionChange:x,onResponsePostProcessChange:f,onChineseTypoChange:p,onResponseSplitterChange:g}){const b=()=>{x({...r,regex_rules:[...r.regex_rules,{regex:[""],reaction:""}]})},j=z=>{x({...r,regex_rules:r.regex_rules.filter((K,I)=>I!==z)})},y=(z,K,I)=>{const T=[...r.regex_rules];K==="regex"&&typeof I=="string"?T[z]={...T[z],regex:[I]}:K==="reaction"&&typeof I=="string"&&(T[z]={...T[z],reaction:I}),x({...r,regex_rules:T})},N=()=>{x({...r,keyword_rules:[...r.keyword_rules,{keywords:[],reaction:""}]})},k=z=>{x({...r,keyword_rules:r.keyword_rules.filter((K,I)=>I!==z)})},w=(z,K,I)=>{const T=[...r.keyword_rules];typeof I=="string"&&(T[z]={...T[z],reaction:I}),x({...r,keyword_rules:T})},U=z=>{const K=[...r.keyword_rules];K[z]={...K[z],keywords:[...K[z].keywords||[],""]},x({...r,keyword_rules:K})},O=(z,K)=>{const I=[...r.keyword_rules];I[z]={...I[z],keywords:(I[z].keywords||[]).filter((T,A)=>A!==K)},x({...r,keyword_rules:I})},B=(z,K,I)=>{const T=[...r.keyword_rules],A=[...T[z].keywords||[]];A[K]=I,T[z]={...T[z],keywords:A},x({...r,keyword_rules:T})},Y=({rule:z})=>{const K=`{ regex = [${(z.regex||[]).map(I=>`"${I}"`).join(", ")}], reaction = "${z.reaction}" }`;return e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",children:[e.jsx(Rt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(ka,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Ze,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:K})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},L=({rule:z})=>{const K=`[[keyword_reaction.keyword_rules]] +keywords = [${(z.keywords||[]).map(I=>`"${I}"`).join(", ")}] +reaction = "${z.reaction}"`;return e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",children:[e.jsx(Rt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(ka,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Ze,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:K})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),e.jsxs(S,{onClick:b,size:"sm",variant:"outline",children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[r.regex_rules.map((z,K)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",K+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_w,{regex:z.regex&&z.regex[0]||"",reaction:z.reaction,onRegexChange:I=>y(K,"regex",I),onReactionChange:I=>y(K,"reaction",I)}),e.jsx(Y,{rule:z}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:["确定要删除正则规则 ",K+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>j(K),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(ie,{value:z.regex&&z.regex[0]||"",onChange:I=>y(K,"regex",I.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Qs,{value:z.reaction,onChange:I=>y(K,"reaction",I.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},K)),r.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),e.jsxs(S,{onClick:N,size:"sm",variant:"outline",children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[r.keyword_rules.map((z,K)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",K+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{rule:z}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:["确定要删除关键词规则 ",K+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>k(K),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(S,{onClick:()=>U(K),size:"sm",variant:"ghost",children:[e.jsx(dt,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(z.keywords||[]).map((I,T)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{value:I,onChange:A=>B(K,T,A.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(S,{onClick:()=>O(K,T),size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})]},T)),(!z.keywords||z.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Qs,{value:z.reaction,onChange:I=>w(K,"reaction",I.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},K)),r.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"enable_response_post_process",checked:i.enable_response_post_process,onCheckedChange:z=>f({...i,enable_response_post_process:z})}),e.jsx(C,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),i.enable_response_post_process&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx($e,{id:"enable_chinese_typo",checked:d.enable,onCheckedChange:z=>p({...d,enable:z})}),e.jsx(C,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),d.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),e.jsx(ie,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:d.error_rate,onChange:z=>p({...d,error_rate:parseFloat(z.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(ie,{id:"min_freq",type:"number",min:"0",value:d.min_freq,onChange:z=>p({...d,min_freq:parseInt(z.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),e.jsx(ie,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:d.tone_error_rate,onChange:z=>p({...d,tone_error_rate:parseFloat(z.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),e.jsx(ie,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:d.word_replace_rate,onChange:z=>p({...d,word_replace_rate:parseFloat(z.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx($e,{id:"enable_response_splitter",checked:m.enable,onCheckedChange:z=>g({...m,enable:z})}),e.jsx(C,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),m.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(ie,{id:"max_length",type:"number",min:"1",value:m.max_length,onChange:z=>g({...m,max_length:parseInt(z.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(ie,{id:"max_sentence_num",type:"number",min:"1",value:m.max_sentence_num,onChange:z=>g({...m,max_sentence_num:parseInt(z.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"enable_kaomoji_protection",checked:m.enable_kaomoji_protection,onCheckedChange:z=>g({...m,enable_kaomoji_protection:z})}),e.jsx(C,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"enable_overflow_return_all",checked:m.enable_overflow_return_all,onCheckedChange:z=>g({...m,enable_overflow_return_all:z})}),e.jsx(C,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),Ul="/api/webui/config";async function up(){const r=await(await Se(`${Ul}/bot`)).json();if(!r.success)throw new Error("获取配置数据失败");return r.config}async function Wn(){const r=await(await Se(`${Ul}/model`)).json();if(!r.success)throw new Error("获取模型配置数据失败");return r.config}async function mp(n){const i=await(await Se(`${Ul}/bot`,{method:"POST",body:JSON.stringify(n)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function Cw(){const r=await(await Se(`${Ul}/bot/raw`)).json();if(!r.success)throw new Error("获取配置源代码失败");return r.content}async function kw(n){const i=await(await Se(`${Ul}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:n})})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function Kc(n){const i=await(await Se(`${Ul}/model`,{method:"POST",body:JSON.stringify(n)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function Tw(n,r){const d=await(await Se(`${Ul}/bot/section/${n}`,{method:"POST",body:JSON.stringify(r)})).json();if(!d.success)throw new Error(d.message||`保存配置节 ${n} 失败`)}async function Hu(n,r){const d=await(await Se(`${Ul}/model/section/${n}`,{method:"POST",body:JSON.stringify(r)})).json();if(!d.success)throw new Error(d.message||`保存配置节 ${n} 失败`)}async function Ew(n,r="openai",i="/models"){const d=new URLSearchParams({provider_name:n,parser:r,endpoint:i}),m=await Se(`/api/webui/models/list?${d}`);if(!m.ok){const f=await m.json().catch(()=>({}));throw new Error(f.detail||`获取模型列表失败 (${m.status})`)}const x=await m.json();if(!x.success)throw new Error("获取模型列表失败");return x.models}async function zw(n){const r=new URLSearchParams({provider_name:n}),i=await Se(`/api/webui/models/test-connection-by-name?${r}`,{method:"POST"});if(!i.ok){const d=await i.json().catch(()=>({}));throw new Error(d.detail||`测试连接失败 (${i.status})`)}return await i.json()}const Aw=tr("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),It=u.forwardRef(({className:n,variant:r,...i},d)=>e.jsx("div",{ref:d,role:"alert",className:$(Aw({variant:r}),n),...i}));It.displayName="Alert";const Mw=u.forwardRef(({className:n,...r},i)=>e.jsx("h5",{ref:i,className:$("mb-1 font-medium leading-none tracking-tight",n),...r}));Mw.displayName="AlertTitle";const Yt=u.forwardRef(({className:n,...r},i)=>e.jsx("div",{ref:i,className:$("text-sm [&_p]:leading-relaxed",n),...r}));Yt.displayName="AlertDescription";function Zu({onRestartComplete:n,onRestartFailed:r}){const[i,d]=u.useState(0),[m,x]=u.useState("restarting"),[f,p]=u.useState(0),[g,b]=u.useState(0);u.useEffect(()=>{const N=setInterval(()=>{d(U=>U>=90?U:U+1)},200),k=setInterval(()=>{p(U=>U+1)},1e3),w=setTimeout(()=>{x("checking"),j()},3e3);return()=>{clearInterval(N),clearInterval(k),clearTimeout(w)}},[]);const j=()=>{const k=async()=>{try{if(b(U=>U+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)d(100),x("success"),setTimeout(()=>{n?.()},1500);else throw new Error("Status check failed")}catch{g<60?setTimeout(k,2e3):(x("failed"),r?.())}};k()},y=N=>{const k=Math.floor(N/60),w=N%60;return`${k}:${w.toString().padStart(2,"0")}`};return e.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:e.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[m==="restarting"&&e.jsxs(e.Fragment,{children:[e.jsx(it,{className:"h-16 w-16 text-primary animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),m==="checking"&&e.jsxs(e.Fragment,{children:[e.jsx(it,{className:"h-16 w-16 text-primary animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),e.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",g,"/60)"]})]}),m==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(aa,{className:"h-16 w-16 text-green-500"}),e.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),m==="failed"&&e.jsxs(e.Fragment,{children:[e.jsx(At,{className:"h-16 w-16 text-destructive"}),e.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),m!=="failed"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(rr,{value:i,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[i,"%"]}),e.jsxs("span",{children:["已用时: ",y(f)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[m==="restarting"&&"🔄 配置已保存,正在重启主程序...",m==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",m==="success"&&"✅ 配置已生效,服务运行正常",m==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),m==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),e.jsx("button",{onClick:()=>{x("checking"),b(0),j()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}const Dw={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(n,r){let i;if(!r.inString&&(i=n.match(/^('''|"""|'|")/))&&(r.stringType=i[0],r.inString=!0),n.sol()&&!r.inString&&r.inArray===0&&(r.lhs=!0),r.inString){for(;r.inString;)if(n.match(r.stringType))r.inString=!1;else if(n.peek()==="\\")n.next(),n.next();else{if(n.eol())break;n.match(/^.[^\\\"\']*/)}return r.lhs?"property":"string"}else{if(r.inArray&&n.peek()==="]")return n.next(),r.inArray--,"bracket";if(r.lhs&&n.peek()==="["&&n.skipTo("]"))return n.next(),n.peek()==="]"&&n.next(),"atom";if(n.peek()==="#")return n.skipToEnd(),"comment";if(n.eatSpace())return null;if(r.lhs&&n.eatWhile(function(d){return d!="="&&d!=" "}))return"property";if(r.lhs&&n.peek()==="=")return n.next(),r.lhs=!1,null;if(!r.lhs&&n.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!r.lhs&&(n.match("true")||n.match("false")))return"atom";if(!r.lhs&&n.peek()==="[")return r.inArray++,n.next(),"bracket";if(!r.lhs&&n.match(/^\-?\d+(?:\.\d+)?/))return"number";n.eatSpace()||n.next()}return null},languageData:{commentTokens:{line:"#"}}},Ow={python:[ky()],json:[Ty(),Ey()],toml:[Cy.define(Dw)],text:[]};function Rw({value:n,onChange:r,language:i="text",readOnly:d=!1,height:m="400px",minHeight:x,maxHeight:f,placeholder:p,theme:g="dark",className:b=""}){const[j,y]=u.useState(!1);if(u.useEffect(()=>{y(!0)},[]),!j)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${b}`,style:{height:m,minHeight:x,maxHeight:f}});const N=[...Ow[i]||[],ep.lineWrapping];return d&&N.push(ep.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${b}`,children:e.jsx(zy,{value:n,height:m,minHeight:x,maxHeight:f,theme:g==="dark"?Ay:void 0,extensions:N,onChange:r,placeholder:p,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function Lw(n,r,i,d={}){const{debounceMs:m=2e3,onSaveSuccess:x,onSaveError:f}=d,p=u.useRef(null),g=u.useCallback(async(N,k)=>{try{r(!0),await Tw(N,k),i(!1),x?.()}catch(w){console.error(`自动保存 ${N} 失败:`,w),i(!0),f?.(w instanceof Error?w:new Error(String(w)))}finally{r(!1)}},[r,i,x,f]),b=u.useCallback((N,k)=>{n||(i(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{g(N,k)},m))},[n,i,g,m]),j=u.useCallback(async(N,k)=>{p.current&&(clearTimeout(p.current),p.current=null),await g(N,k)},[g]),y=u.useCallback(()=>{p.current&&(clearTimeout(p.current),p.current=null)},[]);return u.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),{triggerAutoSave:b,saveNow:j,cancelPendingAutoSave:y}}function Et(n,r,i,d){u.useEffect(()=>{n&&!i&&d(r,n)},[n])}const Uw=500;function Bw(){const[n,r]=u.useState(!0),[i,d]=u.useState(!1),[m,x]=u.useState(!1),[f,p]=u.useState(!1),[g,b]=u.useState(!1),[j,y]=u.useState(!1),[N,k]=u.useState("visual"),[w,U]=u.useState(""),[O,B]=u.useState(!1),{toast:Y}=$s(),[L,z]=u.useState(null),[K,I]=u.useState(null),[T,A]=u.useState(null),[te,fe]=u.useState(null),[je,pe]=u.useState(null),[he,ve]=u.useState(null),[be,D]=u.useState(null),[J,q]=u.useState(null),[se,R]=u.useState(null),[ue,me]=u.useState(null),[_e,Ce]=u.useState(null),[ze,ge]=u.useState(null),[ae,re]=u.useState(null),[F,P]=u.useState(null),[Te,Le]=u.useState(null),[E,xe]=u.useState(null),[Ye,ke]=u.useState(null),Q=u.useRef(!0),Ne=u.useRef({}),qe=u.useCallback(ye=>{Ne.current=ye,z(ye.bot),I(ye.personality);const _s=ye.chat;_s.talk_value_rules||(_s.talk_value_rules=[]),A(_s),fe(ye.expression),pe(ye.emoji),ve(ye.memory),D(ye.tool),q(ye.voice),R(ye.lpmm_knowledge),me(ye.keyword_reaction),Ce(ye.response_post_process),ge(ye.chinese_typo),re(ye.response_splitter),P(ye.log),Le(ye.debug),xe(ye.maim_message),ke(ye.telemetry)},[]),Fs=u.useCallback(()=>({...Ne.current,bot:L,personality:K,chat:T,expression:te,emoji:je,memory:he,tool:be,voice:J,lpmm_knowledge:se,keyword_reaction:ue,response_post_process:_e,chinese_typo:ze,response_splitter:ae,log:F,debug:Te,maim_message:E,telemetry:Ye}),[L,K,T,te,je,he,be,J,se,ue,_e,ze,ae,F,Te,E,Ye]),ks=u.useCallback(async()=>{try{const ye=await Cw();U(ye),B(!1)}catch(ye){Y({variant:"destructive",title:"加载失败",description:ye instanceof Error?ye.message:"加载源代码失败"})}},[Y]),xt=u.useCallback(async()=>{try{r(!0);const ye=await up();qe(ye),p(!1),Q.current=!1,await ks()}catch(ye){console.error("加载配置失败:",ye),Y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{r(!1)}},[Y,ks,qe]);u.useEffect(()=>{xt()},[xt]);const{triggerAutoSave:js,cancelPendingAutoSave:Vs}=Lw(Q.current,x,p);Et(L,"bot",Q.current,js),Et(K,"personality",Q.current,js),Et(T,"chat",Q.current,js),Et(te,"expression",Q.current,js),Et(je,"emoji",Q.current,js),Et(he,"memory",Q.current,js),Et(be,"tool",Q.current,js),Et(J,"voice",Q.current,js),Et(se,"lpmm_knowledge",Q.current,js),Et(ue,"keyword_reaction",Q.current,js),Et(_e,"response_post_process",Q.current,js),Et(ze,"chinese_typo",Q.current,js),Et(ae,"response_splitter",Q.current,js),Et(F,"log",Q.current,js),Et(Te,"debug",Q.current,js),Et(E,"maim_message",Q.current,js),Et(Ye,"telemetry",Q.current,js);const X=async()=>{try{d(!0),await kw(w),p(!1),B(!1),Y({title:"保存成功",description:"配置已保存"}),await xt()}catch(ye){B(!0),Y({variant:"destructive",title:"保存失败",description:ye instanceof Error?ye.message:"保存配置失败"})}finally{d(!1)}},He=async ye=>{if(f){Y({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(k(ye),ye==="source")await ks();else try{const _s=await up();qe(_s),p(!1)}catch(_s){console.error("加载配置失败:",_s),Y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},De=async()=>{try{d(!0),Vs(),await mp(Fs()),p(!1),Y({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ye){console.error("保存配置失败:",ye),Y({title:"保存失败",description:ye.message,variant:"destructive"})}finally{d(!1)}},Ke=async()=>{try{b(!0),Wc().catch(()=>{}),y(!0)}catch(ye){console.error("重启失败:",ye),y(!1),Y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),b(!1)}},Ns=async()=>{try{d(!0),Vs(),await mp(Fs()),p(!1),Y({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(ye=>setTimeout(ye,Uw)),await Ke()}catch(ye){console.error("保存失败:",ye),Y({title:"保存失败",description:ye.message,variant:"destructive"})}finally{d(!1)}},Je=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ks=()=>{y(!1),b(!1),Y({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return n?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"麦麦主程序配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"管理麦麦的核心功能和行为设置"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(S,{onClick:N==="visual"?De:X,disabled:i||m||!f||g,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(fi,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:i?"保存中":m?"自动":f?"保存":"已保存"})]}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs(S,{disabled:i||m||g,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(hi,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:g?"重启中":f?"保存重启":"重启"})]})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认重启麦麦?"}),e.jsx(cs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:f?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:f?Ns:Ke,children:f?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(ga,{value:N,onValueChange:ye=>He(ye),className:"w-full",children:e.jsxs(la,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(ss,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(ly,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(ss,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(ny,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(It,{children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsxs(Yt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),N==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(It,{children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsxs(Yt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(Rw,{value:w,onChange:ye=>{U(ye),p(!0),O&&B(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),N==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(ga,{defaultValue:"bot",className:"w-full",children:[e.jsxs(la,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-9",children:[e.jsx(ss,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(ss,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(ss,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(ss,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(ss,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(ss,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(ss,{value:"voice",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"语音"}),e.jsx(ss,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(ss,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(Ts,{value:"bot",className:"space-y-4",children:L&&e.jsx(cw,{config:L,onChange:z})}),e.jsx(Ts,{value:"personality",className:"space-y-4",children:K&&e.jsx(ow,{config:K,onChange:I})}),e.jsx(Ts,{value:"chat",className:"space-y-4",children:T&&e.jsx(hw,{config:T,onChange:A})}),e.jsx(Ts,{value:"expression",className:"space-y-4",children:te&&e.jsx(ww,{config:te,onChange:fe})}),e.jsx(Ts,{value:"features",className:"space-y-4",children:je&&he&&be&&e.jsx(Nw,{emojiConfig:je,memoryConfig:he,toolConfig:be,onEmojiChange:pe,onMemoryChange:ve,onToolChange:D})}),e.jsx(Ts,{value:"processing",className:"space-y-4",children:ue&&_e&&ze&&ae&&e.jsx(Sw,{keywordReactionConfig:ue,responsePostProcessConfig:_e,chineseTypoConfig:ze,responseSplitterConfig:ae,onKeywordReactionChange:me,onResponsePostProcessChange:Ce,onChineseTypoChange:ge,onResponseSplitterChange:re})}),e.jsx(Ts,{value:"voice",className:"space-y-4",children:J&&e.jsx(fw,{config:J,onChange:q})}),e.jsx(Ts,{value:"lpmm",className:"space-y-4",children:se&&e.jsx(pw,{config:se,onChange:R})}),e.jsxs(Ts,{value:"other",className:"space-y-4",children:[F&&e.jsx(gw,{config:F,onChange:P}),Te&&e.jsx(jw,{config:Te,onChange:Le}),E&&e.jsx(vw,{config:E,onChange:xe}),Ye&&e.jsx(bw,{config:Ye,onChange:ke})]})]})}),j&&e.jsx(Zu,{onRestartComplete:Je,onRestartFailed:Ks})]})})}const rn=u.forwardRef(({className:n,...r},i)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:i,className:$("w-full caption-bottom text-sm",n),...r})}));rn.displayName="Table";const cn=u.forwardRef(({className:n,...r},i)=>e.jsx("thead",{ref:i,className:$("[&_tr]:border-b",n),...r}));cn.displayName="TableHeader";const on=u.forwardRef(({className:n,...r},i)=>e.jsx("tbody",{ref:i,className:$("[&_tr:last-child]:border-0",n),...r}));on.displayName="TableBody";const Hw=u.forwardRef(({className:n,...r},i)=>e.jsx("tfoot",{ref:i,className:$("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n),...r}));Hw.displayName="TableFooter";const ut=u.forwardRef(({className:n,...r},i)=>e.jsx("tr",{ref:i,className:$("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n),...r}));ut.displayName="TableRow";const Xe=u.forwardRef(({className:n,...r},i)=>e.jsx("th",{ref:i,className:$("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...r}));Xe.displayName="TableHead";const Ve=u.forwardRef(({className:n,...r},i)=>e.jsx("td",{ref:i,className:$("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...r}));Ve.displayName="TableCell";const qw=u.forwardRef(({className:n,...r},i)=>e.jsx("caption",{ref:i,className:$("mt-4 text-sm text-muted-foreground",n),...r}));qw.displayName="TableCaption";const eo=u.forwardRef(({className:n,...r},i)=>e.jsx(Kt,{ref:i,className:$("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",n),...r}));eo.displayName=Kt.displayName;const so=u.forwardRef(({className:n,...r},i)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Mt,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Kt.Input,{ref:i,className:$("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",n),...r})]}));so.displayName=Kt.Input.displayName;const to=u.forwardRef(({className:n,...r},i)=>e.jsx(Kt.List,{ref:i,className:$("max-h-[300px] overflow-y-auto overflow-x-hidden",n),...r}));to.displayName=Kt.List.displayName;const ao=u.forwardRef((n,r)=>e.jsx(Kt.Empty,{ref:r,className:"py-6 text-center text-sm",...n}));ao.displayName=Kt.Empty.displayName;const mi=u.forwardRef(({className:n,...r},i)=>e.jsx(Kt.Group,{ref:i,className:$("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",n),...r}));mi.displayName=Kt.Group.displayName;const Gw=u.forwardRef(({className:n,...r},i)=>e.jsx(Kt.Separator,{ref:i,className:$("-mx-1 h-px bg-border",n),...r}));Gw.displayName=Kt.Separator.displayName;const xi=u.forwardRef(({className:n,...r},i)=>e.jsx(Kt.Item,{ref:i,className:$("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n),...r}));xi.displayName=Kt.Item.displayName;const mt=u.forwardRef(({className:n,...r},i)=>e.jsx(ag,{ref:i,className:$("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...r,children:e.jsx(RN,{className:$("grid place-content-center text-current"),children:e.jsx(Qt,{className:"h-4 w-4"})})}));mt.displayName=ag.displayName;const qg=u.createContext(null),Gg="maibot-completed-tours";function $w(){try{const n=localStorage.getItem(Gg);return n?new Set(JSON.parse(n)):new Set}catch{return new Set}}function xp(n){localStorage.setItem(Gg,JSON.stringify([...n]))}function Fw({children:n}){const[r,i]=u.useState({activeTourId:null,stepIndex:0,isRunning:!1}),d=u.useRef(new Map),[,m]=u.useState(0),[x,f]=u.useState($w),p=u.useCallback((L,z)=>{d.current.set(L,z),m(K=>K+1)},[]),g=u.useCallback(L=>{d.current.delete(L),i(z=>z.activeTourId===L?{...z,activeTourId:null,isRunning:!1,stepIndex:0}:z)},[]),b=u.useCallback((L,z=0)=>{d.current.has(L)&&i({activeTourId:L,stepIndex:z,isRunning:!0})},[]),j=u.useCallback(()=>{i(L=>({...L,isRunning:!1}))},[]),y=u.useCallback(L=>{i(z=>({...z,stepIndex:L}))},[]),N=u.useCallback(()=>{i(L=>({...L,stepIndex:L.stepIndex+1}))},[]),k=u.useCallback(()=>{i(L=>({...L,stepIndex:Math.max(0,L.stepIndex-1)}))},[]),w=u.useCallback(()=>r.activeTourId?d.current.get(r.activeTourId)||[]:[],[r.activeTourId]),U=u.useCallback(L=>{f(z=>{const K=new Set(z);return K.add(L),xp(K),K})},[]),O=u.useCallback(L=>{const{action:z,index:K,status:I,type:T}=L,A=["finished","skipped"];if(z==="close"){i(te=>({...te,isRunning:!1,stepIndex:0}));return}A.includes(I)?i(te=>(I==="finished"&&te.activeTourId&&setTimeout(()=>U(te.activeTourId),0),{...te,isRunning:!1,stepIndex:0})):T==="step:after"&&(z==="next"?i(te=>({...te,stepIndex:K+1})):z==="prev"&&i(te=>({...te,stepIndex:K-1})))},[U]),B=u.useCallback(L=>x.has(L),[x]),Y=u.useCallback(L=>{f(z=>{const K=new Set(z);return K.delete(L),xp(K),K})},[]);return e.jsx(qg.Provider,{value:{state:r,tours:d.current,registerTour:p,unregisterTour:g,startTour:b,stopTour:j,goToStep:y,nextStep:N,prevStep:k,getCurrentSteps:w,handleJoyrideCallback:O,isTourCompleted:B,markTourCompleted:U,resetTourCompleted:Y},children:n})}function Pu(){const n=u.useContext(qg);if(!n)throw new Error("useTour must be used within a TourProvider");return n}const Vw={options:{zIndex:1e4,primaryColor:"hsl(var(--primary))",textColor:"hsl(var(--foreground))",backgroundColor:"hsl(var(--background))",arrowColor:"hsl(var(--background))",overlayColor:"rgba(0, 0, 0, 0.5)"},tooltip:{borderRadius:"var(--radius)",padding:"1rem"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"1rem",fontWeight:600,marginBottom:"0.5rem"},tooltipContent:{fontSize:"0.875rem",padding:"0.5rem 0"},buttonNext:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",borderRadius:"calc(var(--radius) - 2px)",fontSize:"0.875rem",padding:"0.5rem 1rem"},buttonBack:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem",marginRight:"0.5rem"},buttonSkip:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem"},buttonClose:{color:"hsl(var(--muted-foreground))"},spotlight:{borderRadius:"var(--radius)"}},Qw={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function Iw(){const{state:n,getCurrentSteps:r,handleJoyrideCallback:i}=Pu(),d=r(),[m,x]=u.useState(!1),f=u.useRef(n.stepIndex),p=u.useRef(null);u.useEffect(()=>{f.current!==n.stepIndex&&(x(!1),f.current=n.stepIndex)},[n.stepIndex]),u.useEffect(()=>{if(!n.isRunning||d.length===0){x(!1);return}const j=d[n.stepIndex];if(!j){x(!1);return}const y=j.target;if(y==="body"){x(!0);return}x(!1);const N=setTimeout(()=>{const k=()=>{const B=document.querySelector(y);if(B){const Y=B.getBoundingClientRect();if(Y.width>0&&Y.height>0)return!0}return!1};if(k()){setTimeout(()=>x(!0),100);return}const w=setInterval(()=>{k()&&(clearInterval(w),setTimeout(()=>x(!0),100))},100),U=setTimeout(()=>{clearInterval(w),x(!0)},5e3),O=()=>{clearInterval(w),clearTimeout(U)};p.current=O},150);return()=>{clearTimeout(N),p.current&&(p.current(),p.current=null)}},[n.isRunning,n.stepIndex,d]);const g=u.useRef(null);if(u.useEffect(()=>{let j=document.getElementById("tour-portal-container");return j||(j=document.createElement("div"),j.id="tour-portal-container",j.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(j)),g.current=j,()=>{}},[]),!n.isRunning||d.length===0||!m)return null;const b=e.jsx(My,{steps:d,stepIndex:n.stepIndex,run:n.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:i,styles:Vw,locale:Qw,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${n.stepIndex}`);return g.current?Ub.createPortal(b,g.current):b}const Ma="model-assignment-tour",$g=[{target:"body",content:"本引导旨在帮助你配置模型提供商和对应的模型,并为麦麦的各个组件分配合适的模型。",placement:"center",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="sidebar-model-provider"]',content:'第一步,你需要配置模型提供商。模型提供商决定了你要使用谁家的模型,无论是单一厂商(如 DeepSeek),还是模型平台(如 Siliconflow),都可以在这里进行配置。点击"下一步"进入配置页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-provider-button"]',content:'点击"添加提供商"按钮,开始配置你的模型提供商。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="provider-dialog"]',content:"在这里,你可以选择你想要配置的模型提供商,填写相关信息后保存即可。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-name-input"]',content:"这里的名称是你为这个模型提供商起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-apikey-input"]',content:"这里需要填写你从模型提供商那里获取的 API 密钥,用于验证和调用模型服务。对于不同的提供商,获取 API 密钥的方式可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-url-input"]',content:"这里需要填写模型提供商的 API 访问地址,确保填写正确以便系统能够连接到模型服务。对于不同的提供商,API 地址可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-template-select"]',content:"当然,如果你不知道如何填写这些信息,很多模型提供商在这里都提供了预设的模板供你选择,选择对应的模板后,相关信息会自动填充。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-save-button"]',content:"填写完所有信息后,点击保存按钮,模型提供商就配置完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-cancel-button"]',content:"因为这次咱们什么都没有填写,所以点击取消按钮退出吧。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="sidebar-model-management"]',content:'配置好模型提供商后,接下来我们需要为麦麦添加模型并分配功能。点击"下一步"进入模型管理页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-model-button"]',content:'在为麦麦的组件分配模型之前,首先需要添加你想要分配的模型,点击"添加模型"按钮开始添加。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="model-dialog"]',content:"在这里,你可以选择你之前配置好的模型提供商,然后选择对应的模型来添加。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-name-input"]',content:"这里的模型名称是你为这个模型起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-provider-select"]',content:"在这里选择你之前配置好的模型提供商,这样系统才能知道你要添加哪个提供商的模型。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-identifier-input"]',content:"这里需要填写你想要添加的模型的标识符,不同的模型提供商可能有不同的标识符格式,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-save-button"]',content:"填写完所有信息后,点击保存按钮,模型就添加完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-cancel-button"]',content:"当然,因为这次咱们什么都没有填写,所以直接点击取消按钮退出吧,等你准备好了再来添加模型。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="tasks-tab-trigger"]',content:'最后一步,添加好模型后,切换到"为模型分配功能"标签页,为麦麦的各个组件分配合适的模型。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="task-model-select"]',content:"在这里,你可以为每个组件选择一个或多个合适的模型,选择完成后配置会自动保存。恭喜你完成了模型配置的学习!",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1}],Fg={0:"/config/model",1:"/config/model",2:"/config/modelProvider",3:"/config/modelProvider",4:"/config/modelProvider",5:"/config/modelProvider",6:"/config/modelProvider",7:"/config/modelProvider",8:"/config/modelProvider",9:"/config/modelProvider",10:"/config/modelProvider",11:"/config/model",12:"/config/model",13:"/config/model",14:"/config/model",15:"/config/model",16:"/config/model",17:"/config/model",18:"/config/model",19:"/config/model"},ai=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini",modelFetcher:{endpoint:"/models",parser:"gemini"}},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function hp(n){return n?n.replace(/\/+$/,"").toLowerCase():""}function Yw(n){if(!n)return null;const r=hp(n);return ai.find(i=>i.id!=="custom"&&hp(i.base_url)===r)||null}function Kw(){const[n,r]=u.useState([]),[i,d]=u.useState(!0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),[g,b]=u.useState(!1),[j,y]=u.useState(!1),[N,k]=u.useState(!1),[w,U]=u.useState(!1),[O,B]=u.useState(null),[Y,L]=u.useState(null),[z,K]=u.useState("custom"),[I,T]=u.useState(!1),[A,te]=u.useState(!1),[fe,je]=u.useState(null),[pe,he]=u.useState(!1),[ve,be]=u.useState(""),[D,J]=u.useState(new Set),[q,se]=u.useState(!1),[R,ue]=u.useState(1),[me,_e]=u.useState(20),[Ce,ze]=u.useState(""),[ge,ae]=u.useState({}),[re,F]=u.useState(new Set),[P,Te]=u.useState(new Map),{toast:Le}=$s(),E=va(),{state:xe,goToStep:Ye,registerTour:ke}=Pu(),Q=u.useRef(null),Ne=u.useRef(!0);u.useEffect(()=>{ke(Ma,$g)},[ke]),u.useEffect(()=>{if(xe.activeTourId===Ma&&xe.isRunning){const _=Fg[xe.stepIndex];_&&!window.location.pathname.endsWith(_.replace("/config/",""))&&E({to:_})}},[xe.stepIndex,xe.activeTourId,xe.isRunning,E]);const qe=u.useRef(xe.stepIndex);u.useEffect(()=>{if(xe.activeTourId===Ma&&xe.isRunning){const _=qe.current,G=xe.stepIndex;_>=3&&_<=9&&G<3&&U(!1),_>=10&&G>=3&&G<=9&&(ae({}),K("custom"),B({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),L(null),he(!1),U(!0)),qe.current=G}},[xe.stepIndex,xe.activeTourId,xe.isRunning]),u.useEffect(()=>{if(xe.activeTourId!==Ma||!xe.isRunning)return;const _=G=>{const we=G.target,Ms=xe.stepIndex;Ms===2&&we.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Ye(3),300):Ms===9&&we.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>Ye(10),300)};return document.addEventListener("click",_,!0),()=>document.removeEventListener("click",_,!0)},[xe,Ye]),u.useEffect(()=>{Fs()},[]);const Fs=async()=>{try{d(!0);const _=await Wn();r(_.api_providers||[]),b(!1),Ne.current=!1}catch(_){console.error("加载配置失败:",_)}finally{d(!1)}},ks=async()=>{try{y(!0),Wc().catch(()=>{}),k(!0)}catch(_){console.error("重启失败:",_),k(!1),Le({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),y(!1)}},xt=async()=>{try{x(!0),Q.current&&clearTimeout(Q.current);const _=await Wn();_.api_providers=n,await Kc(_),b(!1),Le({title:"保存成功",description:"正在重启麦麦..."}),await ks()}catch(_){console.error("保存配置失败:",_),Le({title:"保存失败",description:_.message,variant:"destructive"}),x(!1)}},js=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Vs=()=>{k(!1),y(!1),Le({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},X=u.useCallback(async _=>{if(!Ne.current)try{p(!0),await Hu("api_providers",_),b(!1)}catch(G){console.error("自动保存失败:",G),b(!0)}finally{p(!1)}},[]);u.useEffect(()=>{if(!Ne.current)return b(!0),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{X(n)},2e3),()=>{Q.current&&clearTimeout(Q.current)}},[n,X]);const He=async()=>{try{x(!0),Q.current&&clearTimeout(Q.current);const _=await Wn();_.api_providers=n,await Kc(_),b(!1),Le({title:"保存成功",description:"模型提供商配置已保存"})}catch(_){console.error("保存配置失败:",_),Le({title:"保存失败",description:_.message,variant:"destructive"})}finally{x(!1)}},De=(_,G)=>{if(ae({}),_){const we=ai.find(Ms=>Ms.base_url===_.base_url&&Ms.client_type===_.client_type);K(we?.id||"custom"),B(_)}else K("custom"),B({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});L(G),he(!1),U(!0)},Ke=_=>{K(_),T(!1);const G=ai.find(we=>we.id===_);G&&G.id!=="custom"?B(we=>({...we,name:G.name,base_url:G.base_url,client_type:G.client_type})):G?.id==="custom"&&B(we=>({...we,name:"",base_url:"",client_type:"openai"}))},Ns=u.useMemo(()=>z!=="custom",[z]),Je=async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),Le({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Le({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},Ks=()=>{if(!O)return;const _={};if(O.name?.trim()||(_.name="请输入提供商名称"),O.base_url?.trim()||(_.base_url="请输入基础 URL"),O.api_key?.trim()||(_.api_key="请输入 API Key"),Object.keys(_).length>0){ae(_);return}ae({});const G={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};if(Y!==null){const we=[...n];we[Y]=G,r(we)}else r([...n,G]);U(!1),B(null),L(null)},ye=_=>{if(!_&&O){const G={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};B(G)}U(_)},_s=_=>{je(_),te(!0)},Ae=()=>{if(fe!==null){const _=n.filter((G,we)=>we!==fe);r(_),Le({title:"删除成功",description:"提供商已从列表中移除"})}te(!1),je(null)},vs=_=>{const G=new Set(D);G.has(_)?G.delete(_):G.add(_),J(G)},bs=()=>{if(D.size===Ss.length)J(new Set);else{const _=Ss.map((G,we)=>n.findIndex(Ms=>Ms===Ss[we]));J(new Set(_))}},Nt=()=>{if(D.size===0){Le({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}se(!0)},Xs=()=>{const _=n.filter((G,we)=>!D.has(we));r(_),J(new Set),se(!1),Le({title:"批量删除成功",description:`已删除 ${D.size} 个提供商`})},Ss=n.filter(_=>{if(!ve)return!0;const G=ve.toLowerCase();return _.name.toLowerCase().includes(G)||_.base_url.toLowerCase().includes(G)||_.client_type.toLowerCase().includes(G)}),Es=Math.ceil(Ss.length/me),Js=Ss.slice((R-1)*me,R*me),Ha=()=>{const _=parseInt(Ce);_>=1&&_<=Es&&(ue(_),ze(""))},Lt=async _=>{F(G=>new Set(G).add(_));try{const G=await zw(_);Te(we=>new Map(we).set(_,G)),G.network_ok?G.api_key_valid===!0?Le({title:"连接正常",description:`${_} 网络连接正常,API Key 有效 (${G.latency_ms}ms)`}):G.api_key_valid===!1?Le({title:"连接正常但 Key 无效",description:`${_} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):Le({title:"网络连接正常",description:`${_} 可以访问 (${G.latency_ms}ms)`}):Le({title:"连接失败",description:G.error||"无法连接到提供商",variant:"destructive"})}catch(G){Le({title:"测试失败",description:G.message,variant:"destructive"})}finally{F(G=>{const we=new Set(G);return we.delete(_),we})}},ol=async()=>{for(const _ of n)await Lt(_.name)},ba=_=>{const G=re.has(_),we=P.get(_);return G?e.jsxs(Qe,{variant:"secondary",className:"gap-1",children:[e.jsx(it,{className:"h-3 w-3 animate-spin"}),"测试中"]}):we?we.network_ok?we.api_key_valid===!0?e.jsxs(Qe,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(aa,{className:"h-3 w-3"}),"正常"]}):we.api_key_valid===!1?e.jsxs(Qe,{variant:"destructive",className:"gap-1",children:[e.jsx(At,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(Qe,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(aa,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(Qe,{variant:"destructive",className:"gap-1",children:[e.jsx(mg,{className:"h-3 w-3"}),"离线"]}):null};return i?e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[D.size>0&&e.jsxs(S,{onClick:Nt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(We,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",D.size,")"]}),e.jsxs(S,{onClick:ol,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:n.length===0||re.size>0,children:[e.jsx(an,{className:"mr-2 h-4 w-4"}),re.size>0?`测试中 (${re.size})`:"测试全部"]}),e.jsxs(S,{onClick:()=>De(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(dt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(S,{onClick:He,disabled:m||f||!g||j,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(fi,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":f?"自动保存中...":g?"保存配置":"已保存"]}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs(S,{disabled:m||f||j,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(hi,{className:"mr-2 h-4 w-4"}),j?"重启中...":g?"保存并重启":"重启麦麦"]})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认重启麦麦?"}),e.jsx(cs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:g?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:g?xt:ks,children:g?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(It,{children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsxs(Yt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(Ze,{className:"h-[calc(100vh-260px)]",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索提供商名称、URL 或类型...",value:ve,onChange:_=>be(_.target.value),className:"pl-9"})]}),ve&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Ss.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:Ss.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:ve?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):Js.map((_,G)=>{const we=n.findIndex(Ms=>Ms===_);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:_.name}),ba(_.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:_.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>Lt(_.name),disabled:re.has(_.name),title:"测试连接",children:re.has(_.name)?e.jsx(it,{className:"h-4 w-4 animate-spin"}):e.jsx(an,{className:"h-4 w-4"})}),e.jsx(S,{variant:"default",size:"sm",onClick:()=>De(_,we),children:e.jsx(ln,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(S,{size:"sm",onClick:()=>_s(we),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(We,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),e.jsx("p",{className:"font-medium",children:_.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:_.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:_.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:_.retry_interval})]})]})]},G)})}),e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ut,{children:[e.jsx(Xe,{className:"w-12",children:e.jsx(mt,{checked:D.size===Ss.length&&Ss.length>0,onCheckedChange:bs})}),e.jsx(Xe,{children:"状态"}),e.jsx(Xe,{children:"名称"}),e.jsx(Xe,{children:"基础URL"}),e.jsx(Xe,{children:"客户端类型"}),e.jsx(Xe,{className:"text-right",children:"最大重试"}),e.jsx(Xe,{className:"text-right",children:"超时(秒)"}),e.jsx(Xe,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(Xe,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:Js.length===0?e.jsx(ut,{children:e.jsx(Ve,{colSpan:9,className:"text-center text-muted-foreground py-8",children:ve?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):Js.map((_,G)=>{const we=n.findIndex(Ms=>Ms===_);return e.jsxs(ut,{children:[e.jsx(Ve,{children:e.jsx(mt,{checked:D.has(we),onCheckedChange:()=>vs(we)})}),e.jsx(Ve,{children:ba(_.name)||e.jsx(Qe,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Ve,{className:"font-medium",children:_.name}),e.jsx(Ve,{className:"max-w-xs truncate",title:_.base_url,children:_.base_url}),e.jsx(Ve,{children:_.client_type}),e.jsx(Ve,{className:"text-right",children:_.max_retry}),e.jsx(Ve,{className:"text-right",children:_.timeout}),e.jsx(Ve,{className:"text-right",children:_.retry_interval}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>Lt(_.name),disabled:re.has(_.name),title:"测试连接",children:re.has(_.name)?e.jsx(it,{className:"h-4 w-4 animate-spin"}):e.jsx(an,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"default",size:"sm",onClick:()=>De(_,we),children:[e.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(S,{size:"sm",onClick:()=>_s(we),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},G)})})]})})}),Ss.length>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:me.toString(),onValueChange:_=>{_e(parseInt(_)),ue(1),J(new Set)},children:[e.jsx(Oe,{id:"page-size-provider",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*me+1," 到"," ",Math.min(R*me,Ss.length)," 条,共 ",Ss.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>ue(1),disabled:R===1,className:"hidden sm:flex",children:e.jsx(lr,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>ue(_=>Math.max(1,_-1)),disabled:R===1,children:[e.jsx(il,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:Ce,onChange:_=>ze(_.target.value),onKeyDown:_=>_.key==="Enter"&&Ha(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:Es}),e.jsx(S,{variant:"outline",size:"sm",onClick:Ha,disabled:!Ce,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>ue(_=>_+1),disabled:R>=Es,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>ue(Es),disabled:R>=Es,className:"hidden sm:flex",children:e.jsx(nr,{className:"h-4 w-4"})})]})]})]}),e.jsx(qs,{open:w,onOpenChange:ye,children:e.jsxs(Ls,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:xe.isRunning,children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:Y!==null?"编辑提供商":"添加提供商"}),e.jsx(Ps,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:_=>{_.preventDefault(),Ks()},autoComplete:"off",children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[e.jsx(C,{htmlFor:"template",children:"提供商模板"}),e.jsxs(La,{open:I,onOpenChange:T,children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(S,{variant:"outline",role:"combobox","aria-expanded":I,className:"w-full justify-between",children:[z?ai.find(_=>_.id===z)?.display_name:"选择提供商模板...",e.jsx(Iu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(ka,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(eo,{children:[e.jsx(so,{placeholder:"搜索提供商模板..."}),e.jsx(Ze,{className:"h-[300px]",children:e.jsxs(to,{className:"max-h-none overflow-visible",children:[e.jsx(ao,{children:"未找到匹配的模板"}),e.jsx(mi,{children:ai.map(_=>e.jsxs(xi,{value:_.display_name,onSelect:()=>Ke(_.id),children:[e.jsx(Qt,{className:`mr-2 h-4 w-4 ${z===_.id?"opacity-100":"opacity-0"}`}),_.display_name]},_.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsx(C,{htmlFor:"name",className:ge.name?"text-destructive":"",children:"名称 *"}),e.jsx(ie,{id:"name",value:O?.name||"",onChange:_=>{B(G=>G?{...G,name:_.target.value}:null),ge.name&&ae(G=>({...G,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:ge.name?"border-destructive focus-visible:ring-destructive":""}),ge.name&&e.jsx("p",{className:"text-xs text-destructive",children:ge.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(C,{htmlFor:"base_url",className:ge.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(ie,{id:"base_url",value:O?.base_url||"",onChange:_=>{B(G=>G?{...G,base_url:_.target.value}:null),ge.base_url&&ae(G=>({...G,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:Ns,className:`${Ns?"bg-muted cursor-not-allowed":""} ${ge.base_url?"border-destructive focus-visible:ring-destructive":""}`}),ge.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:ge.base_url}),Ns&&!ge.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsx(C,{htmlFor:"api_key",className:ge.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{id:"api_key",type:pe?"text":"password",value:O?.api_key||"",onChange:_=>{B(G=>G?{...G,api_key:_.target.value}:null),ge.api_key&&ae(G=>({...G,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${ge.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(S,{type:"button",variant:"outline",size:"icon",onClick:()=>he(!pe),title:pe?"隐藏密钥":"显示密钥",children:pe?e.jsx(ci,{className:"h-4 w-4"}):e.jsx(Rt,{className:"h-4 w-4"})}),e.jsx(S,{type:"button",variant:"outline",size:"icon",onClick:Je,title:"复制密钥",children:e.jsx(Vc,{className:"h-4 w-4"})})]}),ge.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:ge.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Ue,{value:O?.client_type||"openai",onValueChange:_=>B(G=>G?{...G,client_type:_}:null),disabled:Ns,children:[e.jsx(Oe,{id:"client_type",className:Ns?"bg-muted cursor-not-allowed":"",children:e.jsx(Be,{placeholder:"选择客户端类型"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"openai",children:"OpenAI"}),e.jsx(le,{value:"gemini",children:"Gemini"})]})]}),Ns&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(ie,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:_=>{const G=_.target.value===""?null:parseInt(_.target.value);B(we=>we?{...we,max_retry:G}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(ie,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:_=>{const G=_.target.value===""?null:parseInt(_.target.value);B(we=>we?{...we,timeout:G}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(ie,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:_=>{const G=_.target.value===""?null:parseInt(_.target.value);B(we=>we?{...we,retry_interval:G}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(st,{children:[e.jsx(S,{type:"button",variant:"outline",onClick:()=>U(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(S,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(hs,{open:A,onOpenChange:te,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:['确定要删除提供商 "',fe!==null?n[fe]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:Ae,children:"删除"})]})]})}),e.jsx(hs,{open:q,onOpenChange:se,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认批量删除"}),e.jsxs(cs,{children:["确定要删除选中的 ",D.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:Xs,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),N&&e.jsx(Zu,{onRestartComplete:js,onRestartFailed:Vs})]})}function Vg(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function Qg(n){return typeof n=="boolean"?"boolean":typeof n=="number"?"number":"string"}function Xw(n,r){switch(r){case"boolean":return n==="true";case"number":{const i=parseFloat(n);return isNaN(i)?0:i}default:return n}}function Tu(n){return Object.entries(n).map(([r,i])=>({id:Vg(),key:r,value:i,type:Qg(i)}))}function Eu(n){const r={};for(const i of n)i.key.trim()&&(r[i.key.trim()]=i.value);return r}function zu(n){if(!n.trim())return{valid:!0,parsed:{}};try{const r=JSON.parse(n);if(typeof r!="object"||r===null||Array.isArray(r))return{valid:!1,error:"必须是一个 JSON 对象 {}"};for(const[i,d]of Object.entries(r))if(d!==null&&!["string","number","boolean"].includes(typeof d))return{valid:!1,error:`键 "${i}" 的值类型不支持(仅支持 string/number/boolean)`};return{valid:!0,parsed:r}}catch{return{valid:!1,error:"JSON 格式错误"}}}function Jw(n){switch(n){case"boolean":return"布尔";case"number":return"数字";default:return"字符串"}}function Zw(n){switch(n){case"boolean":return"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400";case"number":return"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"}}function Pw({value:n,onChange:r,className:i,placeholder:d="添加额外参数..."}){const[m,x]=u.useState("list"),[f,p]=u.useState(()=>Tu(n||{})),[g,b]=u.useState(()=>Object.keys(n||{}).length>0?JSON.stringify(n,null,2):""),[j,y]=u.useState(null);u.useEffect(()=>{const Y=Tu(n||{});p(Y),b(Object.keys(n||{}).length>0?JSON.stringify(n,null,2):"")},[n]);const N=u.useMemo(()=>{const Y=zu(g);return Y.valid&&Y.parsed?{success:!0,data:Y.parsed}:{success:!1,data:{}}},[g]),k=u.useCallback(Y=>{const L=Y;if(L==="json"&&m==="list"){const z=Eu(f);b(Object.keys(z).length>0?JSON.stringify(z,null,2):""),y(null)}else if(L==="list"&&m==="json"){const z=zu(g);z.valid&&z.parsed&&(p(Tu(z.parsed)),y(null))}x(L)},[m,f,g]),w=u.useCallback(()=>{const Y={id:Vg(),key:"",value:"",type:"string"},L=[...f,Y];p(L)},[f]),U=u.useCallback(Y=>{const L=f.filter(z=>z.id!==Y);p(L),r(Eu(L))},[f,r]),O=u.useCallback((Y,L,z)=>{const K=f.map(I=>{if(I.id!==Y)return I;if(L==="type"){const T=z;let A;return T==="boolean"?A=I.value==="true"||I.value===!0:T==="number"?A=typeof I.value=="number"?I.value:parseFloat(String(I.value))||0:A=String(I.value),{...I,type:T,value:A}}else return L==="value"?{...I,value:Xw(z,I.type)}:{...I,[L]:z}});p(K),r(Eu(K))},[f,r]),B=u.useCallback(Y=>{b(Y);const L=zu(Y);L.valid&&L.parsed?(y(null),r(L.parsed)):y(L.error||"JSON 格式错误")},[r]);return e.jsxs("div",{className:$("space-y-3",i),children:[e.jsx(C,{className:"text-sm font-medium",children:"额外参数"}),e.jsxs(ga,{value:m,onValueChange:k,className:"w-full",children:[e.jsxs(la,{className:"h-8 p-0.5 bg-muted/60",children:[e.jsx(ss,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"键值对"}),e.jsx(ss,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON"})]}),e.jsxs(Ts,{value:"list",className:"mt-3 space-y-2",children:[f.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:d}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 text-xs text-muted-foreground px-1",children:[e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),f.map(Y=>e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 items-center",children:[e.jsx(ie,{value:Y.key,onChange:L=>O(Y.id,"key",L.target.value),placeholder:"key",className:"h-8 text-sm"}),Y.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx($e,{checked:Y.value===!0,onCheckedChange:L=>O(Y.id,"value",String(L))}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:Y.value?"true":"false"})]}):e.jsx(ie,{type:Y.type==="number"?"number":"text",value:Y.value,onChange:L=>O(Y.id,"value",L.target.value),placeholder:"value",className:"h-8 text-sm",step:Y.type==="number"?"any":void 0}),e.jsxs(Ue,{value:Y.type,onValueChange:L=>O(Y.id,"type",L),children:[e.jsx(Oe,{className:"h-8 text-xs",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"string",children:"字符串"}),e.jsx(le,{value:"number",children:"数字"}),e.jsx(le,{value:"boolean",children:"布尔"})]})]}),e.jsx(S,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>U(Y.id),children:e.jsx(We,{className:"h-4 w-4"})})]},Y.id))]}),e.jsxs(S,{type:"button",variant:"outline",size:"sm",className:"w-full h-8",onClick:w,children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"添加参数"]})]}),e.jsx(Ts,{value:"json",className:"mt-3",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),j?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(At,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:j})]}):g.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx(Qt,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(Qs,{value:g,onChange:Y=>B(Y.target.value),placeholder:`{ + "key": "value" +}`,className:$("font-mono text-sm min-h-[140px] h-[140px] resize-y flex-1",j&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持 string、number、boolean 类型"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"预览"}),e.jsx("div",{className:"min-h-[140px] h-[140px] flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:N.success&&Object.keys(N.data).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(N.data).map(([Y,L])=>{const z=Qg(L);return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("code",{className:"px-1.5 py-0.5 bg-background rounded text-xs font-medium",children:Y}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:$("font-mono",z==="boolean"&&(L?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),z==="number"&&"text-blue-600 dark:text-blue-400",z==="string"&&"text-amber-600 dark:text-amber-400"),children:z==="string"?`"${L}"`:String(L)}),e.jsx(Qe,{variant:"secondary",className:$("h-5 text-[10px] px-1.5",Zw(z)),children:Jw(z)})]},Y)})}):N.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"暂无参数"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON 格式错误"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"实时预览解析结果"})]})]})})]})]})}function Ww({value:n,label:r,onRemove:i}){const{attributes:d,listeners:m,setNodeRef:x,transform:f,transition:p,isDragging:g}=Fy({id:n}),b={transform:Vy.Transform.toString(f),transition:p,opacity:g?.5:1},j=N=>{N.preventDefault(),N.stopPropagation(),i(n)},y=N=>{N.stopPropagation()};return e.jsx("div",{ref:x,style:b,className:$("inline-flex items-center gap-1",g&&"shadow-lg"),children:e.jsxs(Qe,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...d,...m,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(ry,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:r}),e.jsx("button",{type:"button",className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive",onClick:j,onPointerDown:y,onMouseDown:N=>N.stopPropagation(),children:e.jsx(rl,{className:"h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function e1({options:n,selected:r,onChange:i,placeholder:d="选择选项...",emptyText:m="未找到选项",className:x}){const[f,p]=u.useState(!1),g=Oy(sp($y,{activationConstraint:{distance:8}}),sp(Gy,{coordinateGetter:qy})),b=N=>{r.includes(N)?i(r.filter(k=>k!==N)):i([...r,N])},j=N=>{i(r.filter(k=>k!==N))},y=N=>{const{active:k,over:w}=N;if(w&&k.id!==w.id){const U=r.indexOf(k.id),O=r.indexOf(w.id);i(Hy(r,U,O))}};return e.jsxs(La,{open:f,onOpenChange:p,children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(S,{variant:"outline",role:"combobox","aria-expanded":f,className:$("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(Ry,{sensors:g,collisionDetection:Ly,onDragEnd:y,children:e.jsx(Uy,{items:r,strategy:By,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:r.length===0?e.jsx("span",{className:"text-muted-foreground",children:d}):r.map(N=>{const k=n.find(w=>w.value===N);return e.jsx(Ww,{value:N,label:k?.label||N,onRemove:j},N)})})})}),e.jsx(Iu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(ka,{className:"w-full p-0",align:"start",children:e.jsxs(eo,{children:[e.jsx(so,{placeholder:"搜索...",className:"h-9"}),e.jsxs(to,{children:[e.jsx(ao,{children:m}),e.jsx(mi,{children:n.map(N=>{const k=r.includes(N.value);return e.jsxs(xi,{value:N.value,onSelect:()=>b(N.value),children:[e.jsx("div",{className:$("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",k?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Qt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:N.label})]},N.value)})})]})]})})]})}const _a=bt.memo(function({title:r,description:i,taskConfig:d,modelNames:m,onChange:x,hideTemperature:f=!1,hideMaxTokens:p=!1,dataTour:g}){const b=j=>{x("model_list",j)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:r}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:i})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":g,children:[e.jsx(C,{children:"模型列表"}),e.jsx(e1,{options:m.map(j=>({label:j,value:j})),selected:d.model_list||[],onChange:b,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!f&&e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"温度"}),e.jsx(ie,{type:"number",step:"0.1",min:"0",max:"1",value:d.temperature??.3,onChange:j=>{const y=parseFloat(j.target.value);!isNaN(y)&&y>=0&&y<=1&&x("temperature",y)},className:"w-20 h-8 text-sm"})]}),e.jsx(pa,{value:[d.temperature??.3],onValueChange:j=>x("temperature",j[0]),min:0,max:1,step:.1,className:"w-full"})]}),!p&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"最大 Token"}),e.jsx(ie,{type:"number",step:"1",min:"1",value:d.max_tokens??1024,onChange:j=>x("max_tokens",parseInt(j.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(ie,{type:"number",step:"1",min:"1",value:d.slow_threshold??15,onChange:j=>{const y=parseInt(j.target.value);!isNaN(y)&&y>=1&&x("slow_threshold",y)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"模型响应时间超过此阈值将输出警告日志"})]})]})]})}),s1=bt.memo(function({paginatedModels:r,allModels:i,onEdit:d,onDelete:m,isModelUsed:x,searchQuery:f}){return r.length===0?e.jsx("div",{className:"md:hidden text-center text-muted-foreground py-8 rounded-lg border bg-card",children:f?"未找到匹配的模型":"暂无模型配置"}):e.jsx("div",{className:"md:hidden space-y-3",children:r.map((p,g)=>{const b=i.findIndex(y=>y===p),j=x(p.name);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-base",children:p.name}),e.jsx(Qe,{variant:j?"default":"secondary",className:j?"bg-green-600 hover:bg-green-700":"",children:j?"已使用":"未使用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground break-all",title:p.model_identifier,children:p.model_identifier})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(S,{variant:"default",size:"sm",onClick:()=>d(p,b),children:[e.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(S,{size:"sm",onClick:()=>m(b),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),e.jsx("p",{className:"font-medium",children:p.api_provider})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"模型温度"}),e.jsx("p",{className:"font-medium",children:p.temperature!=null?p.temperature:e.jsx("span",{className:"text-muted-foreground",children:"默认"})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),e.jsxs("p",{className:"font-medium",children:["¥",p.price_in,"/M"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),e.jsxs("p",{className:"font-medium",children:["¥",p.price_out,"/M"]})]})]})]},g)})})}),t1=bt.memo(function({paginatedModels:r,allModels:i,filteredModels:d,selectedModels:m,onEdit:x,onDelete:f,onToggleSelection:p,onToggleSelectAll:g,isModelUsed:b,searchQuery:j}){return e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ut,{children:[e.jsx(Xe,{className:"w-12",children:e.jsx(mt,{checked:m.size===d.length&&d.length>0,onCheckedChange:g})}),e.jsx(Xe,{className:"w-24",children:"使用状态"}),e.jsx(Xe,{children:"模型名称"}),e.jsx(Xe,{children:"模型标识符"}),e.jsx(Xe,{children:"提供商"}),e.jsx(Xe,{className:"text-center",children:"温度"}),e.jsx(Xe,{className:"text-right",children:"输入价格"}),e.jsx(Xe,{className:"text-right",children:"输出价格"}),e.jsx(Xe,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:r.length===0?e.jsx(ut,{children:e.jsx(Ve,{colSpan:9,className:"text-center text-muted-foreground py-8",children:j?"未找到匹配的模型":"暂无模型配置"})}):r.map((y,N)=>{const k=i.findIndex(U=>U===y),w=b(y.name);return e.jsxs(ut,{children:[e.jsx(Ve,{children:e.jsx(mt,{checked:m.has(k),onCheckedChange:()=>p(k)})}),e.jsx(Ve,{children:e.jsx(Qe,{variant:w?"default":"secondary",className:w?"bg-green-600 hover:bg-green-700":"",children:w?"已使用":"未使用"})}),e.jsx(Ve,{className:"font-medium",children:y.name}),e.jsx(Ve,{className:"max-w-xs truncate",title:y.model_identifier,children:y.model_identifier}),e.jsx(Ve,{children:y.api_provider}),e.jsx(Ve,{className:"text-center",children:y.temperature!=null?y.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ve,{className:"text-right",children:["¥",y.price_in,"/M"]}),e.jsxs(Ve,{className:"text-right",children:["¥",y.price_out,"/M"]}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(S,{variant:"default",size:"sm",onClick:()=>x(y,k),children:[e.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(S,{size:"sm",onClick:()=>f(k),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},N)})})]})})})}),a1=300*1e3,fp=new Map,l1=[10,20,50,100],n1=bt.memo(function({page:r,pageSize:i,totalItems:d,jumpToPage:m,onPageChange:x,onPageSizeChange:f,onJumpToPageChange:p,onJumpToPage:g,onSelectionClear:b}){const j=Math.ceil(d/i),y=k=>{f(parseInt(k)),x(1),b?.()},N=k=>{k.key==="Enter"&&g()};return d===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:i.toString(),onValueChange:y,children:[e.jsx(Oe,{id:"page-size-model",className:"w-20",children:e.jsx(Be,{})}),e.jsx(Re,{children:l1.map(k=>e.jsx(le,{value:k.toString(),children:k},k))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(r-1)*i+1," 到"," ",Math.min(r*i,d)," 条,共 ",d," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:r===1,className:"hidden sm:flex",children:e.jsx(lr,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,r-1)),disabled:r===1,children:[e.jsx(il,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:m,onChange:k=>p(k.target.value),onKeyDown:N,placeholder:r.toString(),className:"w-16 h-8 text-center",min:1,max:j}),e.jsx(S,{variant:"outline",size:"sm",onClick:g,disabled:!m,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>x(r+1),disabled:r>=j,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>x(j),disabled:r>=j,className:"hidden sm:flex",children:e.jsx(nr,{className:"h-4 w-4"})})]})]})});function r1(n){const{models:r,taskConfig:i,debounceMs:d=2e3,onSavingChange:m,onUnsavedChange:x}=n,f=u.useRef(null),p=u.useRef(null),g=u.useRef(!0),b=u.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null),p.current&&(clearTimeout(p.current),p.current=null)},[]),j=u.useCallback(k=>{const w={model_identifier:k.model_identifier,name:k.name,api_provider:k.api_provider,price_in:k.price_in??0,price_out:k.price_out??0,force_stream_mode:k.force_stream_mode??!1,extra_params:k.extra_params??{}};return k.temperature!=null&&(w.temperature=k.temperature),k.max_tokens!=null&&(w.max_tokens=k.max_tokens),w},[]),y=u.useCallback(async k=>{try{m?.(!0);const w=k.map(j);await Hu("models",w),x?.(!1)}catch(w){console.error("自动保存模型列表失败:",w),x?.(!0)}finally{m?.(!1)}},[m,x,j]),N=u.useCallback(async k=>{try{m?.(!0),await Hu("model_task_config",k),x?.(!1)}catch(w){console.error("自动保存任务配置失败:",w),x?.(!0)}finally{m?.(!1)}},[m,x]);return u.useEffect(()=>{if(!g.current)return x?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{y(r)},d),()=>{f.current&&clearTimeout(f.current)}},[r,y,d,x]),u.useEffect(()=>{if(!(g.current||!i))return x?.(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{N(i)},d),()=>{p.current&&clearTimeout(p.current)}},[i,N,d,x]),u.useEffect(()=>()=>{b()},[b]),{clearTimers:b,initialLoadRef:g}}function i1(n={}){const{onCloseEditDialog:r}=n,i=va(),{registerTour:d,startTour:m,state:x,goToStep:f}=Pu(),p=u.useRef(x.stepIndex);return u.useEffect(()=>{d(Ma,$g)},[d]),u.useEffect(()=>{if(x.activeTourId===Ma&&x.isRunning){const b=Fg[x.stepIndex];b&&!window.location.pathname.endsWith(b.replace("/config/",""))&&i({to:b})}},[x.stepIndex,x.activeTourId,x.isRunning,i]),u.useEffect(()=>{if(x.activeTourId===Ma&&x.isRunning){const b=p.current,j=x.stepIndex;b>=12&&b<=17&&j<12&&r?.(),p.current=j}},[x.stepIndex,x.activeTourId,x.isRunning,r]),u.useEffect(()=>{if(x.activeTourId!==Ma||!x.isRunning)return;const b=j=>{const y=j.target,N=x.stepIndex;N===2&&y.closest('[data-tour="add-provider-button"]')?setTimeout(()=>f(3),300):N===9&&y.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>f(10),300):N===11&&y.closest('[data-tour="add-model-button"]')?setTimeout(()=>f(12),300):N===17&&y.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>f(18),300):N===18&&y.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>f(19),300)};return document.addEventListener("click",b,!0),()=>document.removeEventListener("click",b,!0)},[x,f]),{startTour:u.useCallback(()=>{m(Ma)},[m]),isRunning:x.isRunning&&x.activeTourId===Ma,stepIndex:x.stepIndex}}function c1(n){const{getProviderConfig:r}=n,[i,d]=u.useState([]),[m,x]=u.useState(!1),[f,p]=u.useState(null),[g,b]=u.useState(null),j=u.useCallback(()=>{d([]),p(null),b(null)},[]),y=u.useCallback(async(N,k=!1)=>{const w=r(N);if(!w?.base_url){d([]),b(null),p('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!w.api_key){d([]),b(null),p('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const U=Yw(w.base_url);if(b(U),!U?.modelFetcher){d([]),p(null);return}const O=`${N}:${w.base_url}`,B=fp.get(O);if(!k&&B&&Date.now()-B.timestampT(!1)}),{clearTimers:Ye,initialLoadRef:ke}=r1({models:n,taskConfig:g,onSavingChange:U,onUnsavedChange:B}),Q=u.useCallback(async()=>{try{y(!0);const _=await Wn(),G=_.models||[];r(G),p(G.map(Ms=>Ms.name));const we=_.api_providers||[];d(we.map(Ms=>Ms.name)),x(we),b(_.model_task_config||null),B(!1),ke.current=!1}catch(_){console.error("加载配置失败:",_)}finally{y(!1)}},[ke]);u.useEffect(()=>{Q()},[Q]);const Ne=u.useCallback(_=>m.find(G=>G.name===_),[m]),{availableModels:qe,fetchingModels:Fs,modelFetchError:ks,matchedTemplate:xt,fetchModelsForProvider:js,clearModels:Vs}=c1({getProviderConfig:Ne});u.useEffect(()=>{I&&A?.api_provider&&js(A.api_provider)},[I,A?.api_provider,js]);const X=async()=>{try{L(!0),Wc().catch(()=>{}),K(!0)}catch(_){console.error("重启失败:",_),K(!1),Le({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),L(!1)}},He=_=>{const G={model_identifier:_.model_identifier,name:_.name,api_provider:_.api_provider,price_in:_.price_in??0,price_out:_.price_out??0,force_stream_mode:_.force_stream_mode??!1,extra_params:_.extra_params??{}};return _.temperature!=null&&(G.temperature=_.temperature),_.max_tokens!=null&&(G.max_tokens=_.max_tokens),G},De=async()=>{try{k(!0),Ye();const _=await Wn();_.models=n.map(He),_.model_task_config=g,await Kc(_),B(!1),Le({title:"保存成功",description:"正在重启麦麦..."}),await X()}catch(_){console.error("保存配置失败:",_),Le({title:"保存失败",description:_.message,variant:"destructive"}),k(!1)}},Ke=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ns=()=>{K(!1),L(!1),Le({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Je=async()=>{try{k(!0),Ye();const _=await Wn();_.models=n.map(He),_.model_task_config=g,await Kc(_),B(!1),Le({title:"保存成功",description:"模型配置已保存"}),await Q()}catch(_){console.error("保存配置失败:",_),Le({title:"保存失败",description:_.message,variant:"destructive"})}finally{k(!1)}},Ks=(_,G)=>{Te({}),te(_||{model_identifier:"",name:"",api_provider:i[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),je(G),T(!0)},ye=()=>{if(!A)return;const _={};if(A.name?.trim()||(_.name="请输入模型名称"),A.api_provider?.trim()||(_.api_provider="请选择 API 提供商"),A.model_identifier?.trim()||(_.model_identifier="请输入模型标识符"),Object.keys(_).length>0){Te(_);return}Te({});const G={model_identifier:A.model_identifier,name:A.name,api_provider:A.api_provider,price_in:A.price_in??0,price_out:A.price_out??0,force_stream_mode:A.force_stream_mode??!1,extra_params:A.extra_params??{}};A.temperature!=null&&(G.temperature=A.temperature),A.max_tokens!=null&&(G.max_tokens=A.max_tokens);let we,Ms=null;if(fe!==null?(Ms=n[fe].name,we=[...n],we[fe]=G):we=[...n,G],r(we),p(we.map(Dt=>Dt.name)),Ms&&Ms!==G.name&&g){const Dt=ji=>ji.map(cr=>cr===Ms?G.name:cr);b({...g,utils:{...g.utils,model_list:Dt(g.utils?.model_list||[])},utils_small:{...g.utils_small,model_list:Dt(g.utils_small?.model_list||[])},tool_use:{...g.tool_use,model_list:Dt(g.tool_use?.model_list||[])},replyer:{...g.replyer,model_list:Dt(g.replyer?.model_list||[])},planner:{...g.planner,model_list:Dt(g.planner?.model_list||[])},vlm:{...g.vlm,model_list:Dt(g.vlm?.model_list||[])},voice:{...g.voice,model_list:Dt(g.voice?.model_list||[])},embedding:{...g.embedding,model_list:Dt(g.embedding?.model_list||[])},lpmm_entity_extract:{...g.lpmm_entity_extract,model_list:Dt(g.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...g.lpmm_rdf_build,model_list:Dt(g.lpmm_rdf_build?.model_list||[])},lpmm_qa:{...g.lpmm_qa,model_list:Dt(g.lpmm_qa?.model_list||[])}})}T(!1),te(null),je(null)},_s=_=>{if(!_&&A){const G={...A,price_in:A.price_in??0,price_out:A.price_out??0};te(G)}T(_)},Ae=_=>{be(_),he(!0)},vs=()=>{if(ve!==null){const _=n.filter((G,we)=>we!==ve);r(_),p(_.map(G=>G.name)),Le({title:"删除成功",description:"模型已从列表中移除"})}he(!1),be(null)},bs=_=>{const G=new Set(q);G.has(_)?G.delete(_):G.add(_),se(G)},Nt=()=>{if(q.size===Js.length)se(new Set);else{const _=Js.map((G,we)=>n.findIndex(Ms=>Ms===Js[we]));se(new Set(_))}},Xs=()=>{if(q.size===0){Le({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},Ss=()=>{const _=n.filter((G,we)=>!q.has(we));r(_),p(_.map(G=>G.name)),se(new Set),ue(!1),Le({title:"批量删除成功",description:`已删除 ${q.size} 个模型`})},Es=(_,G,we)=>{g&&b({...g,[_]:{...g[_],[G]:we}})},Js=n.filter(_=>{if(!D)return!0;const G=D.toLowerCase();return _.name.toLowerCase().includes(G)||_.model_identifier.toLowerCase().includes(G)||_.api_provider.toLowerCase().includes(G)}),Ha=Math.ceil(Js.length/Ce),Lt=Js.slice((me-1)*Ce,me*Ce),ol=()=>{const _=parseInt(ge);_>=1&&_<=Ha&&(_e(_),ae(""))},ba=_=>g?[g.utils?.model_list||[],g.utils_small?.model_list||[],g.tool_use?.model_list||[],g.replyer?.model_list||[],g.planner?.model_list||[],g.vlm?.model_list||[],g.voice?.model_list||[],g.embedding?.model_list||[],g.lpmm_entity_extract?.model_list||[],g.lpmm_rdf_build?.model_list||[],g.lpmm_qa?.model_list||[]].some(we=>we.includes(_)):!1;return j?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsxs(S,{onClick:Je,disabled:N||w||!O||Y,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(fi,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),N?"保存中...":w?"自动保存中...":O?"保存配置":"已保存"]}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs(S,{disabled:N||w||Y,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(hi,{className:"mr-2 h-4 w-4"}),Y?"重启中...":O?"保存并重启":"重启麦麦"]})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认重启麦麦?"}),e.jsx(cs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:O?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:O?De:X,children:O?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(It,{children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsxs(Yt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(It,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:E,children:[e.jsx(iy,{className:"h-4 w-4 text-primary"}),e.jsxs(Yt,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),e.jsx(S,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),e.jsxs(ga,{defaultValue:"models",className:"w-full",children:[e.jsxs(la,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(ss,{value:"models",children:"添加模型"}),e.jsx(ss,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(Ts,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[q.size>0&&e.jsxs(S,{onClick:Xs,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(We,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",q.size,")"]}),e.jsxs(S,{onClick:()=>Ks(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(dt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索模型名称、标识符或提供商...",value:D,onChange:_=>J(_.target.value),className:"pl-9"})]}),D&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Js.length," 个结果"]})]}),e.jsx(s1,{paginatedModels:Lt,allModels:n,onEdit:Ks,onDelete:Ae,isModelUsed:ba,searchQuery:D}),e.jsx(t1,{paginatedModels:Lt,allModels:n,filteredModels:Js,selectedModels:q,onEdit:Ks,onDelete:Ae,onToggleSelection:bs,onToggleSelectAll:Nt,isModelUsed:ba,searchQuery:D}),e.jsx(n1,{page:me,pageSize:Ce,totalItems:Js.length,jumpToPage:ge,onPageChange:_e,onPageSizeChange:ze,onJumpToPageChange:ae,onJumpToPage:ol,onSelectionClear:()=>se(new Set)})]}),e.jsxs(Ts,{value:"tasks",className:"space-y-6 mt-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),g&&e.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[e.jsx(_a,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:g.utils,modelNames:f,onChange:(_,G)=>Es("utils",_,G),dataTour:"task-model-select"}),e.jsx(_a,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:g.utils_small,modelNames:f,onChange:(_,G)=>Es("utils_small",_,G)}),e.jsx(_a,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:g.tool_use,modelNames:f,onChange:(_,G)=>Es("tool_use",_,G)}),e.jsx(_a,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:g.replyer,modelNames:f,onChange:(_,G)=>Es("replyer",_,G)}),e.jsx(_a,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:g.planner,modelNames:f,onChange:(_,G)=>Es("planner",_,G)}),e.jsx(_a,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:g.vlm,modelNames:f,onChange:(_,G)=>Es("vlm",_,G),hideTemperature:!0}),e.jsx(_a,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:g.voice,modelNames:f,onChange:(_,G)=>Es("voice",_,G),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(_a,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:g.embedding,modelNames:f,onChange:(_,G)=>Es("embedding",_,G),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(_a,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:g.lpmm_entity_extract,modelNames:f,onChange:(_,G)=>Es("lpmm_entity_extract",_,G)}),e.jsx(_a,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:g.lpmm_rdf_build,modelNames:f,onChange:(_,G)=>Es("lpmm_rdf_build",_,G)}),e.jsx(_a,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:g.lpmm_qa,modelNames:f,onChange:(_,G)=>Es("lpmm_qa",_,G)})]})]})]})]}),e.jsx(qs,{open:I,onOpenChange:_s,children:e.jsxs(Ls,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:xe,children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:fe!==null?"编辑模型":"添加模型"}),e.jsx(Ps,{children:"配置模型的基本信息和参数"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[e.jsx(C,{htmlFor:"model_name",className:P.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(ie,{id:"model_name",value:A?.name||"",onChange:_=>{te(G=>G?{...G,name:_.target.value}:null),P.name&&Te(G=>({...G,name:void 0}))},placeholder:"例如: qwen3-30b",className:P.name?"border-destructive focus-visible:ring-destructive":""}),P.name?e.jsx("p",{className:"text-xs text-destructive",children:P.name}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[e.jsx(C,{htmlFor:"api_provider",className:P.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Ue,{value:A?.api_provider||"",onValueChange:_=>{te(G=>G?{...G,api_provider:_}:null),Vs(),P.api_provider&&Te(G=>({...G,api_provider:void 0}))},children:[e.jsx(Oe,{id:"api_provider",className:P.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Be,{placeholder:"选择提供商"})}),e.jsx(Re,{children:i.map(_=>e.jsx(le,{value:_,children:_},_))})]}),P.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:P.api_provider})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{htmlFor:"model_identifier",className:P.model_identifier?"text-destructive":"",children:"模型标识符 *"}),xt?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qe,{variant:"secondary",className:"text-xs",children:xt.display_name}),e.jsx(S,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>A?.api_provider&&js(A.api_provider,!0),disabled:Fs,children:Fs?e.jsx(it,{className:"h-3 w-3 animate-spin"}):e.jsx(zt,{className:"h-3 w-3"})})]})]}),xt?.modelFetcher?e.jsxs(La,{open:re,onOpenChange:F,children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(S,{variant:"outline",role:"combobox","aria-expanded":re,className:"w-full justify-between font-normal",disabled:Fs||!!ks,children:[Fs?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(it,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):ks?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):A?.model_identifier?e.jsx("span",{className:"truncate",children:A.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(Iu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(ka,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(eo,{children:[e.jsx(so,{placeholder:"搜索模型..."}),e.jsx(Ze,{className:"h-[300px]",children:e.jsxs(to,{className:"max-h-none overflow-visible",children:[e.jsx(ao,{children:ks?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:ks}),!ks.includes("API Key")&&e.jsx(S,{variant:"link",size:"sm",onClick:()=>A?.api_provider&&js(A.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(mi,{heading:"可用模型",children:qe.map(_=>e.jsxs(xi,{value:_.id,onSelect:()=>{te(G=>G?{...G,model_identifier:_.id}:null),F(!1)},children:[e.jsx(Qt,{className:`mr-2 h-4 w-4 ${A?.model_identifier===_.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:_.id}),_.name!==_.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:_.name})]})]},_.id))}),e.jsx(mi,{heading:"手动输入",children:e.jsxs(xi,{value:"__manual_input__",onSelect:()=>{F(!1)},children:[e.jsx(ln,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(ie,{id:"model_identifier",value:A?.model_identifier||"",onChange:_=>{te(G=>G?{...G,model_identifier:_.target.value}:null),P.model_identifier&&Te(G=>({...G,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:P.model_identifier?"border-destructive focus-visible:ring-destructive":""}),P.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:P.model_identifier}),ks&&xt?.modelFetcher&&!P.model_identifier&&e.jsxs(It,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsx(Yt,{className:"text-xs",children:ks})]}),xt?.modelFetcher&&e.jsx(ie,{value:A?.model_identifier||"",onChange:_=>{te(G=>G?{...G,model_identifier:_.target.value}:null),P.model_identifier&&Te(G=>({...G,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${P.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!P.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:ks?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':xt?.modelFetcher?`已识别为 ${xt.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(ie,{id:"price_in",type:"number",step:"0.1",min:"0",value:A?.price_in??"",onChange:_=>{const G=_.target.value===""?null:parseFloat(_.target.value);te(we=>we?{...we,price_in:G}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(ie,{id:"price_out",type:"number",step:"0.1",min:"0",value:A?.price_out??"",onChange:_=>{const G=_.target.value===""?null:parseFloat(_.target.value);te(we=>we?{...we,price_out:G}:null)},placeholder:"默认: 0"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx($e,{id:"enable_model_temperature",checked:A?.temperature!=null,onCheckedChange:_=>{te(_?G=>G?{...G,temperature:.5}:null:G=>G?{...G,temperature:null}:null)}})]}),A?.temperature!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:A.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(pa,{value:[A.temperature],onValueChange:_=>te(G=>G?{...G,temperature:_[0]}:null),min:0,max:1,step:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"较低的温度(0.1-0.3)产生更确定的输出,较高的温度(0.7-1.0)产生更多样化的输出"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx($e,{id:"enable_model_max_tokens",checked:A?.max_tokens!=null,onCheckedChange:_=>{te(_?G=>G?{...G,max_tokens:2048}:null:G=>G?{...G,max_tokens:null}:null)}})]}),A?.max_tokens!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm",children:"最大 Token 数"}),e.jsx(ie,{type:"number",min:"1",max:"128000",value:A.max_tokens,onChange:_=>{const G=parseInt(_.target.value);!isNaN(G)&&G>=1&&te(we=>we?{...we,max_tokens:G}:null)},className:"w-28 h-8 text-sm"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"限制模型单次输出的最大 token 数量,不同模型支持的上限不同"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"force_stream_mode",checked:A?.force_stream_mode||!1,onCheckedChange:_=>te(G=>G?{...G,force_stream_mode:_}:null)}),e.jsx(C,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsx(Pw,{value:A?.extra_params||{},onChange:_=>te(G=>G?{...G,extra_params:_}:null),placeholder:"添加额外参数(如 enable_thinking、top_p 等)..."})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>T(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(S,{onClick:ye,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(hs,{open:pe,onOpenChange:he,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:['确定要删除模型 "',ve!==null?n[ve]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:vs,children:"删除"})]})]})}),e.jsx(hs,{open:R,onOpenChange:ue,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认批量删除"}),e.jsxs(cs,{children:["确定要删除选中的 ",q.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:Ss,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),z&&e.jsx(Zu,{onRestartComplete:Ke,onRestartFailed:Ns})]})})}const lo="/api/webui/config";async function d1(){const r=await(await Se(`${lo}/adapter-config/path`)).json();return!r.success||!r.path?null:{path:r.path,lastModified:r.lastModified}}async function pp(n){const i=await(await Se(`${lo}/adapter-config/path`,{method:"POST",headers:Gs(),body:JSON.stringify({path:n})})).json();if(!i.success)throw new Error(i.message||"保存路径失败")}async function gp(n){const i=await(await Se(`${lo}/adapter-config?path=${encodeURIComponent(n)}`)).json();if(!i.success)throw new Error("读取配置文件失败");return i.content}async function jp(n,r){const d=await(await Se(`${lo}/adapter-config`,{method:"POST",headers:Gs(),body:JSON.stringify({path:n,content:r})})).json();if(!d.success)throw new Error(d.message||"保存配置失败")}const ta={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},Au={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:Ol},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:cy}};function u1(){const[n,r]=u.useState("upload"),[i,d]=u.useState(null),[m,x]=u.useState(""),[f,p]=u.useState(""),[g,b]=u.useState("oneclick"),[j,y]=u.useState(""),[N,k]=u.useState(!1),[w,U]=u.useState(!1),[O,B]=u.useState(!1),[Y,L]=u.useState(!1),[z,K]=u.useState(null),I=u.useRef(null),{toast:T}=$s(),A=u.useRef(null),te=ae=>{if(!ae.trim())return{valid:!1,error:"路径不能为空"};if(!ae.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const re=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,F=/^(\/|~\/).+\.toml$/i,P=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,Te=re.test(ae),Le=F.test(ae),E=P.test(ae);return!Te&&!Le&&!E?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(ae)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},fe=ae=>{if(p(ae),ae.trim()){const re=te(ae);y(re.error)}else y("")},je=u.useCallback(async ae=>{const re=Au[ae];U(!0);try{const F=await gp(re.path),P=me(F);d(P),b(ae),p(re.path),await pp(re.path),T({title:"加载成功",description:`已从${re.name}预设加载配置`})}catch(F){console.error("加载预设配置失败:",F),T({title:"加载失败",description:F instanceof Error?F.message:"无法读取预设配置文件",variant:"destructive"})}finally{U(!1)}},[T]),pe=u.useCallback(async ae=>{const re=te(ae);if(!re.valid){y(re.error),T({title:"路径无效",description:re.error,variant:"destructive"});return}y(""),U(!0);try{const F=await gp(ae),P=me(F);d(P),p(ae),await pp(ae),T({title:"加载成功",description:"已从配置文件加载"})}catch(F){console.error("加载配置失败:",F),T({title:"加载失败",description:F instanceof Error?F.message:"无法读取配置文件",variant:"destructive"})}finally{U(!1)}},[T]);u.useEffect(()=>{(async()=>{try{const re=await d1();if(re&&re.path){p(re.path);const F=Object.entries(Au).find(([,P])=>P.path===re.path);F?(r("preset"),b(F[0]),await je(F[0])):(r("path"),await pe(re.path))}}catch(re){console.error("加载保存的路径失败:",re)}})()},[pe,je]);const he=u.useCallback(ae=>{n!=="path"&&n!=="preset"||!f||(A.current&&clearTimeout(A.current),A.current=setTimeout(async()=>{k(!0);try{const re=_e(ae);await jp(f,re),T({title:"自动保存成功",description:"配置已保存到文件"})}catch(re){console.error("自动保存失败:",re),T({title:"自动保存失败",description:re instanceof Error?re.message:"保存配置失败",variant:"destructive"})}finally{k(!1)}},1e3))},[n,f,T]),ve=async()=>{if(!i||!f)return;const ae=te(f);if(!ae.valid){T({title:"保存失败",description:ae.error,variant:"destructive"});return}k(!0);try{const re=_e(i);await jp(f,re),T({title:"保存成功",description:"配置已保存到文件"})}catch(re){console.error("保存失败:",re),T({title:"保存失败",description:re instanceof Error?re.message:"保存配置失败",variant:"destructive"})}finally{k(!1)}},be=async()=>{f&&await pe(f)},D=ae=>{if(ae!==n){if(i){K(ae),B(!0);return}J(ae)}},J=ae=>{d(null),x(""),y(""),r(ae),ae==="preset"&&je("oneclick"),T({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[ae]})},q=()=>{z&&(J(z),K(null)),B(!1)},se=()=>{if(i){L(!0);return}R()},R=()=>{p(""),d(null),y(""),T({title:"已清空",description:"路径和配置已清空"})},ue=()=>{R(),L(!1)},me=ae=>{const re=JSON.parse(JSON.stringify(ta)),F=ae.split(` +`);let P="";for(const Te of F){const Le=Te.trim();if(!Le||Le.startsWith("#"))continue;const E=Le.match(/^\[(\w+)\]/);if(E){P=E[1];continue}const xe=Le.match(/^(\w+)\s*=\s*(.+)$/);if(xe&&P){const[,Ye,ke]=xe;let Q=ke.trim();const Ne=Q.match(/^("[^"]*")/);if(Ne)Q=Ne[1];else{const Fs=Q.indexOf("#");Fs!==-1&&(Q=Q.substring(0,Fs).trim())}let qe;if(Q==="true")qe=!0;else if(Q==="false")qe=!1;else if(Q.startsWith("[")&&Q.endsWith("]")){const Fs=Q.slice(1,-1).trim();if(Fs){const ks=Fs.split(",").map(js=>{const Vs=js.trim();return isNaN(Number(Vs))?Vs.replace(/"/g,""):Number(Vs)}),xt=typeof ks[0];qe=ks.every(js=>typeof js===xt)?ks:ks.filter(js=>typeof js=="number")}else qe=[]}else Q.startsWith('"')&&Q.endsWith('"')?qe=Q.slice(1,-1):isNaN(Number(Q))?qe=Q.replace(/"/g,""):qe=Number(Q);if(P in re){const Fs=re[P];Fs[Ye]=qe}}}return re},_e=ae=>{const re=[],F=(P,Te)=>P===""||P===null||P===void 0?Te:P;return re.push("[inner]"),re.push(`version = "${F(ae.inner.version,ta.inner.version)}" # 版本号`),re.push("# 请勿修改版本号,除非你知道自己在做什么"),re.push(""),re.push("[nickname] # 现在没用"),re.push(`nickname = "${F(ae.nickname.nickname,ta.nickname.nickname)}"`),re.push(""),re.push("[napcat_server] # Napcat连接的ws服务设置"),re.push(`host = "${F(ae.napcat_server.host,ta.napcat_server.host)}" # Napcat设定的主机地址`),re.push(`port = ${F(ae.napcat_server.port||0,ta.napcat_server.port)} # Napcat设定的端口`),re.push(`token = "${F(ae.napcat_server.token,ta.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),re.push(`heartbeat_interval = ${F(ae.napcat_server.heartbeat_interval||0,ta.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),re.push(""),re.push("[maibot_server] # 连接麦麦的ws服务设置"),re.push(`host = "${F(ae.maibot_server.host,ta.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),re.push(`port = ${F(ae.maibot_server.port||0,ta.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),re.push(""),re.push("[chat] # 黑白名单功能"),re.push(`group_list_type = "${F(ae.chat.group_list_type,ta.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),re.push(`group_list = [${ae.chat.group_list.join(", ")}] # 群组名单`),re.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),re.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),re.push(`private_list_type = "${F(ae.chat.private_list_type,ta.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),re.push(`private_list = [${ae.chat.private_list.join(", ")}] # 私聊名单`),re.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),re.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),re.push(`ban_user_id = [${ae.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),re.push(`ban_qq_bot = ${ae.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),re.push(`enable_poke = ${ae.chat.enable_poke} # 是否启用戳一戳功能`),re.push(""),re.push("[voice] # 发送语音设置"),re.push(`use_tts = ${ae.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),re.push(""),re.push("[debug]"),re.push(`level = "${F(ae.debug.level,ta.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),re.join(` +`)},Ce=ae=>{const re=ae.target.files?.[0];if(!re)return;const F=new FileReader;F.onload=P=>{try{const Te=P.target?.result,Le=me(Te);d(Le),x(re.name),T({title:"上传成功",description:`已加载配置文件:${re.name}`})}catch(Te){console.error("解析配置文件失败:",Te),T({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},F.readAsText(re)},ze=()=>{if(!i)return;const ae=_e(i),re=new Blob([ae],{type:"text/plain;charset=utf-8"}),F=URL.createObjectURL(re),P=document.createElement("a");P.href=F,P.download=m||"config.toml",document.body.appendChild(P),P.click(),document.body.removeChild(P),URL.revokeObjectURL(F),T({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ge=()=>{d(JSON.parse(JSON.stringify(ta))),x("config.toml"),T({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[e.jsx(At,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"工作模式"}),e.jsx(et,{children:"选择配置文件的管理方式"})]}),e.jsxs(xs,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${n==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>D("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(Ol,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${n==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>D("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(oi,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${n==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>D("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(oy,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),n==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(C,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Au).map(([ae,re])=>{const F=re.icon,P=g===ae;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${P?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{b(ae),je(ae)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(F,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:re.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:re.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:re.path})]})]})},ae)})})]}),n==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(ie,{id:"config-path",value:f,onChange:ae=>fe(ae.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${j?"border-destructive":""}`}),j&&e.jsx("p",{className:"text-xs text-destructive",children:j})]}),e.jsx(S,{onClick:()=>pe(f),disabled:w||!f||!!j,className:"w-full sm:w-auto",children:w?e.jsxs(e.Fragment,{children:[e.jsx(zt,{className:"h-4 w-4 animate-spin mr-2"}),e.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:"加载配置"}),e.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),e.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[e.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[e.jsx("span",{children:"路径格式说明"}),e.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),e.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"C:\\Adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"/opt/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),e.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),e.jsxs(It,{children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsx(Yt,{children:n==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",N&&" (正在保存...)"]}):n==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",N&&" (正在保存...)"]})})]}),n==="upload"&&!i&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:I,type:"file",accept:".toml",className:"hidden",onChange:Ce}),e.jsxs(S,{onClick:()=>I.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(oi,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(S,{onClick:ge,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Sa,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),n==="upload"&&i&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(S,{onClick:ze,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Oa,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(n==="preset"||n==="path")&&i&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(S,{onClick:ve,size:"sm",disabled:N||!!j,className:"w-full sm:w-auto",children:[e.jsx(fi,{className:"mr-2 h-4 w-4"}),N?"保存中...":"立即保存"]}),e.jsxs(S,{onClick:be,size:"sm",variant:"outline",disabled:w,className:"w-full sm:w-auto",children:[e.jsx(zt,{className:`mr-2 h-4 w-4 ${w?"animate-spin":""}`}),"刷新"]}),n==="path"&&e.jsxs(S,{onClick:se,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(We,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),i?e.jsxs(ga,{defaultValue:"napcat",className:"w-full",children:[e.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:e.jsxs(la,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(ss,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),e.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),e.jsxs(ss,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),e.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),e.jsxs(ss,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),e.jsx("span",{className:"sm:hidden",children:"聊天"})]}),e.jsxs(ss,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),e.jsx("span",{className:"sm:hidden",children:"语音"})]}),e.jsx(ss,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(Ts,{value:"napcat",className:"space-y-4",children:e.jsx(m1,{config:i,onChange:ae=>{d(ae),he(ae)}})}),e.jsx(Ts,{value:"maibot",className:"space-y-4",children:e.jsx(x1,{config:i,onChange:ae=>{d(ae),he(ae)}})}),e.jsx(Ts,{value:"chat",className:"space-y-4",children:e.jsx(h1,{config:i,onChange:ae=>{d(ae),he(ae)}})}),e.jsx(Ts,{value:"voice",className:"space-y-4",children:e.jsx(f1,{config:i,onChange:ae=>{d(ae),he(ae)}})}),e.jsx(Ts,{value:"debug",className:"space-y-4",children:e.jsx(p1,{config:i,onChange:ae=>{d(ae),he(ae)}})})]}):e.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:e.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[e.jsx(Sa,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:n==="preset"?"请选择预设的部署方式":n==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),e.jsx(hs,{open:O,onOpenChange:B,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认切换模式"}),e.jsxs(cs,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(rs,{children:[e.jsx(ds,{onClick:()=>{B(!1),K(null)},children:"取消"}),e.jsx(os,{onClick:q,children:"确认切换"})]})]})}),e.jsx(hs,{open:Y,onOpenChange:L,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认清空路径"}),e.jsxs(cs,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(rs,{children:[e.jsx(ds,{onClick:()=>L(!1),children:"取消"}),e.jsx(os,{onClick:ue,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function m1({config:n,onChange:r}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ie,{id:"napcat-host",value:n.napcat_server.host,onChange:i=>r({...n,napcat_server:{...n.napcat_server,host:i.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ie,{id:"napcat-port",type:"number",value:n.napcat_server.port||"",onChange:i=>r({...n,napcat_server:{...n.napcat_server,port:i.target.value?parseInt(i.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(ie,{id:"napcat-token",type:"password",value:n.napcat_server.token,onChange:i=>r({...n,napcat_server:{...n.napcat_server,token:i.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(ie,{id:"napcat-heartbeat",type:"number",value:n.napcat_server.heartbeat_interval||"",onChange:i=>r({...n,napcat_server:{...n.napcat_server,heartbeat_interval:i.target.value?parseInt(i.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function x1({config:n,onChange:r}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ie,{id:"maibot-host",value:n.maibot_server.host,onChange:i=>r({...n,maibot_server:{...n.maibot_server,host:i.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ie,{id:"maibot-port",type:"number",value:n.maibot_server.port||"",onChange:i=>r({...n,maibot_server:{...n.maibot_server,port:i.target.value?parseInt(i.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function h1({config:n,onChange:r}){const i=x=>{const f={...n};x==="group"?f.chat.group_list=[...f.chat.group_list,0]:x==="private"?f.chat.private_list=[...f.chat.private_list,0]:f.chat.ban_user_id=[...f.chat.ban_user_id,0],r(f)},d=(x,f)=>{const p={...n};x==="group"?p.chat.group_list=p.chat.group_list.filter((g,b)=>b!==f):x==="private"?p.chat.private_list=p.chat.private_list.filter((g,b)=>b!==f):p.chat.ban_user_id=p.chat.ban_user_id.filter((g,b)=>b!==f),r(p)},m=(x,f,p)=>{const g={...n};x==="group"?g.chat.group_list[f]=p:x==="private"?g.chat.private_list[f]=p:g.chat.ban_user_id[f]=p,r(g)};return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),e.jsxs("div",{className:"grid gap-4 md:gap-6",children:[e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Ue,{value:n.chat.group_list_type,onValueChange:x=>r({...n,chat:{...n.chat,group_list_type:x}}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(le,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(C,{className:"text-sm md:text-base",children:"群组列表"}),e.jsxs(S,{onClick:()=>i("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Sa,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),n.chat.group_list.map((x,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{type:"number",value:x,onChange:p=>m("group",f,parseInt(p.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:["确定要删除群号 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>d("group",f),children:"删除"})]})]})]})]},f)),n.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Ue,{value:n.chat.private_list_type,onValueChange:x=>r({...n,chat:{...n.chat,private_list_type:x}}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(le,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(C,{className:"text-sm md:text-base",children:"私聊列表"}),e.jsxs(S,{onClick:()=>i("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Sa,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),n.chat.private_list.map((x,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{type:"number",value:x,onChange:p=>m("private",f,parseInt(p.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:["确定要删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>d("private",f),children:"删除"})]})]})]})]},f)),n.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"全局禁止名单"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),e.jsxs(S,{onClick:()=>i("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Sa,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),n.chat.ban_user_id.map((x,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{type:"number",value:x,onChange:p=>m("ban",f,parseInt(p.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(hs,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:["确定要从全局禁止名单中删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>d("ban",f),children:"删除"})]})]})]})]},f)),n.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx($e,{checked:n.chat.ban_qq_bot,onCheckedChange:x=>r({...n,chat:{...n.chat,ban_qq_bot:x}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx($e,{checked:n.chat.enable_poke,onCheckedChange:x=>r({...n,chat:{...n.chat,enable_poke:x}})})]})]})]})})}function f1({config:n,onChange:r}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx($e,{checked:n.voice.use_tts,onCheckedChange:i=>r({...n,voice:{use_tts:i}})})]})]})})}function p1({config:n,onChange:r}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),e.jsx("div",{className:"grid gap-3 md:gap-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Ue,{value:n.debug.level,onValueChange:i=>r({...n,debug:{level:i}}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(le,{value:"INFO",children:"INFO(信息)"}),e.jsx(le,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(le,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(le,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const g1=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spellCheck","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],j1=/^(aria-|data-)/,Ig=n=>Object.fromEntries(Object.entries(n).filter(([r])=>j1.test(r)||g1.includes(r)));function v1(n,r){const i=Ig(n);return Object.keys(n).some(d=>!Object.hasOwn(i,d)&&n[d]!==r[d])}class b1 extends u.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(r){if(r.uppy!==this.props.uppy)this.uninstallPlugin(r),this.installPlugin();else if(v1(this.props,r)){const{uppy:i,...d}={...this.props,target:this.container};this.plugin.setOptions(d)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:r,...i}={id:"Dashboard",...this.props,inline:!0,target:this.container};r.use(Qy,i),this.plugin=r.getPlugin(i.id)}uninstallPlugin(r=this.props){const{uppy:i}=r;i.removePlugin(this.plugin)}render(){return u.createElement("div",{className:"uppy-Container",ref:r=>{this.container=r},...Ig(this.props)})}}function N1({src:n,alt:r="表情包",className:i,maxRetries:d=5,retryInterval:m=1500}){const[x,f]=u.useState("loading"),[p,g]=u.useState(0),[b,j]=u.useState(null),y=u.useCallback(async()=>{try{const N=await fetch(n,{credentials:"include"});if(N.status===202){f("generating"),p{g(U=>U+1)},m):f("error");return}if(!N.ok){f("error");return}const k=await N.blob(),w=URL.createObjectURL(k);j(w),f("loaded")}catch(N){console.error("加载缩略图失败:",N),f("error")}},[n,p,d,m]);return u.useEffect(()=>{f("loading"),g(0),j(null)},[n]),u.useEffect(()=>{y()},[y]),u.useEffect(()=>()=>{b&&URL.revokeObjectURL(b)},[b]),x==="loading"||x==="generating"?e.jsx(Cg,{className:$("w-full h-full",i)}):x==="error"||!b?e.jsx("div",{className:$("w-full h-full flex items-center justify-center bg-muted",i),children:e.jsx(gg,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:b,alt:r,className:$("w-full h-full object-contain",i)})}function Yg({content:n,className:r=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${r}`,children:e.jsx(Yy,{remarkPlugins:[Xy,Jy],rehypePlugins:[Ky],components:{code({inline:i,className:d,children:m,...x}){return i?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...x,children:m}):e.jsx("code",{className:`${d} block bg-muted p-4 rounded-lg overflow-x-auto`,...x,children:m})},table({children:i,...d}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...d,children:i})})},th({children:i,...d}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...d,children:i})},td({children:i,...d}){return e.jsx("td",{className:"border border-border px-4 py-2",...d,children:i})},a({children:i,...d}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...d,children:i})},blockquote({children:i,...d}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...d,children:i})},h1({children:i,...d}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...d,children:i})},h2({children:i,...d}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...d,children:i})},h3({children:i,...d}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...d,children:i})},h4({children:i,...d}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...d,children:i})},ul({children:i,...d}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...d,children:i})},ol({children:i,...d}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...d,children:i})},p({children:i,...d}){return e.jsx("p",{className:"my-2 leading-relaxed",...d,children:i})},hr({...i}){return e.jsx("hr",{className:"my-4 border-border",...i})}},children:n})})}function y1({children:n,className:r}){return e.jsx(Yg,{content:n,className:r})}const ja="/api/webui/emoji";async function w1(n){const r=new URLSearchParams;n.page&&r.append("page",n.page.toString()),n.page_size&&r.append("page_size",n.page_size.toString()),n.search&&r.append("search",n.search),n.is_registered!==void 0&&r.append("is_registered",n.is_registered.toString()),n.is_banned!==void 0&&r.append("is_banned",n.is_banned.toString()),n.format&&r.append("format",n.format),n.sort_by&&r.append("sort_by",n.sort_by),n.sort_order&&r.append("sort_order",n.sort_order);const i=await Se(`${ja}/list?${r}`,{});if(!i.ok)throw new Error(`获取表情包列表失败: ${i.statusText}`);return i.json()}async function _1(n){const r=await Se(`${ja}/${n}`,{});if(!r.ok)throw new Error(`获取表情包详情失败: ${r.statusText}`);return r.json()}async function S1(n,r){const i=await Se(`${ja}/${n}`,{method:"PATCH",body:JSON.stringify(r)});if(!i.ok)throw new Error(`更新表情包失败: ${i.statusText}`);return i.json()}async function C1(n){const r=await Se(`${ja}/${n}`,{method:"DELETE"});if(!r.ok)throw new Error(`删除表情包失败: ${r.statusText}`);return r.json()}async function k1(){const n=await Se(`${ja}/stats/summary`,{});if(!n.ok)throw new Error(`获取统计数据失败: ${n.statusText}`);return n.json()}async function T1(n){const r=await Se(`${ja}/${n}/register`,{method:"POST"});if(!r.ok)throw new Error(`注册表情包失败: ${r.statusText}`);return r.json()}async function E1(n){const r=await Se(`${ja}/${n}/ban`,{method:"POST"});if(!r.ok)throw new Error(`封禁表情包失败: ${r.statusText}`);return r.json()}function z1(n,r=!1){return r?`${ja}/${n}/thumbnail?original=true`:`${ja}/${n}/thumbnail`}function A1(n){return`${ja}/${n}/thumbnail?original=true`}async function M1(n){const r=await Se(`${ja}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:n})});if(!r.ok){const i=await r.json();throw new Error(i.detail||"批量删除失败")}return r.json()}function D1(){return`${ja}/upload`}function O1(){const[n,r]=u.useState([]),[i,d]=u.useState(null),[m,x]=u.useState(!1),[f,p]=u.useState(1),[g,b]=u.useState(0),[j,y]=u.useState(20),[N,k]=u.useState("all"),[w,U]=u.useState("all"),[O,B]=u.useState("all"),[Y,L]=u.useState("usage_count"),[z,K]=u.useState("desc"),[I,T]=u.useState(null),[A,te]=u.useState(!1),[fe,je]=u.useState(!1),[pe,he]=u.useState(!1),[ve,be]=u.useState(new Set),[D,J]=u.useState(!1),[q,se]=u.useState(""),[R,ue]=u.useState("medium"),[me,_e]=u.useState(!1),{toast:Ce}=$s(),ze=u.useCallback(async()=>{try{x(!0);const Q=await w1({page:f,page_size:j,is_registered:N==="all"?void 0:N==="registered",is_banned:w==="all"?void 0:w==="banned",format:O==="all"?void 0:O,sort_by:Y,sort_order:z});r(Q.data),b(Q.total)}catch(Q){const Ne=Q instanceof Error?Q.message:"加载表情包列表失败";Ce({title:"错误",description:Ne,variant:"destructive"})}finally{x(!1)}},[f,j,N,w,O,Y,z,Ce]),ge=async()=>{try{const Q=await k1();d(Q.data)}catch(Q){console.error("加载统计数据失败:",Q)}};u.useEffect(()=>{ze()},[ze]),u.useEffect(()=>{ge()},[]);const ae=async Q=>{try{const Ne=await _1(Q.id);T(Ne.data),te(!0)}catch(Ne){const qe=Ne instanceof Error?Ne.message:"加载详情失败";Ce({title:"错误",description:qe,variant:"destructive"})}},re=Q=>{T(Q),je(!0)},F=Q=>{T(Q),he(!0)},P=async()=>{if(I)try{await C1(I.id),Ce({title:"成功",description:"表情包已删除"}),he(!1),T(null),ze(),ge()}catch(Q){const Ne=Q instanceof Error?Q.message:"删除失败";Ce({title:"错误",description:Ne,variant:"destructive"})}},Te=async Q=>{try{await T1(Q.id),Ce({title:"成功",description:"表情包已注册"}),ze(),ge()}catch(Ne){const qe=Ne instanceof Error?Ne.message:"注册失败";Ce({title:"错误",description:qe,variant:"destructive"})}},Le=async Q=>{try{await E1(Q.id),Ce({title:"成功",description:"表情包已封禁"}),ze(),ge()}catch(Ne){const qe=Ne instanceof Error?Ne.message:"封禁失败";Ce({title:"错误",description:qe,variant:"destructive"})}},E=Q=>{const Ne=new Set(ve);Ne.has(Q)?Ne.delete(Q):Ne.add(Q),be(Ne)},xe=async()=>{try{const Q=await M1(Array.from(ve));Ce({title:"批量删除完成",description:Q.message}),be(new Set),J(!1),ze(),ge()}catch(Q){Ce({title:"批量删除失败",description:Q instanceof Error?Q.message:"批量删除失败",variant:"destructive"})}},Ye=()=>{const Q=parseInt(q),Ne=Math.ceil(g/j);Q>=1&&Q<=Ne?(p(Q),se("")):Ce({title:"无效的页码",description:`请输入1-${Ne}之间的页码`,variant:"destructive"})},ke=i?.formats?Object.keys(i.formats):[];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),e.jsxs(S,{onClick:()=>_e(!0),className:"gap-2",children:[e.jsx(oi,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[i&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(Fe,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(et,{children:"总数"}),e.jsx(as,{className:"text-2xl",children:i.total})]})}),e.jsx(Fe,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(et,{children:"已注册"}),e.jsx(as,{className:"text-2xl text-green-600",children:i.registered})]})}),e.jsx(Fe,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(et,{children:"已封禁"}),e.jsx(as,{className:"text-2xl text-red-600",children:i.banned})]})}),e.jsx(Fe,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(et,{children:"未注册"}),e.jsx(as,{className:"text-2xl text-gray-600",children:i.unregistered})]})})]}),e.jsxs(Fe,{children:[e.jsx(ts,{children:e.jsxs(as,{className:"flex items-center gap-2",children:[e.jsx(Ou,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(xs,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"排序方式"}),e.jsxs(Ue,{value:`${Y}-${z}`,onValueChange:Q=>{const[Ne,qe]=Q.split("-");L(Ne),K(qe),p(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(le,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(le,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(le,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(le,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(le,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(le,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(le,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"注册状态"}),e.jsxs(Ue,{value:N,onValueChange:Q=>{k(Q),p(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),e.jsx(le,{value:"registered",children:"已注册"}),e.jsx(le,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"封禁状态"}),e.jsxs(Ue,{value:w,onValueChange:Q=>{U(Q),p(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),e.jsx(le,{value:"banned",children:"已封禁"}),e.jsx(le,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"格式"}),e.jsxs(Ue,{value:O,onValueChange:Q=>{B(Q),p(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),ke.map(Q=>e.jsxs(le,{value:Q,children:[Q.toUpperCase()," (",i?.formats[Q],")"]},Q))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[ve.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",ve.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Ue,{value:R,onValueChange:Q=>ue(Q),children:[e.jsx(Oe,{className:"w-24",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"small",children:"小"}),e.jsx(le,{value:"medium",children:"中"}),e.jsx(le,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:j.toString(),onValueChange:Q=>{y(parseInt(Q)),p(1),be(new Set)},children:[e.jsx(Oe,{id:"emoji-page-size",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"40",children:"40"}),e.jsx(le,{value:"60",children:"60"}),e.jsx(le,{value:"100",children:"100"})]})]}),ve.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>be(new Set),children:"取消选择"}),e.jsxs(S,{variant:"destructive",size:"sm",onClick:()=>J(!0),children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(S,{variant:"outline",size:"sm",onClick:ze,disabled:m,children:[e.jsx(zt,{className:`h-4 w-4 mr-2 ${m?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"表情包列表"}),e.jsxs(et,{children:["共 ",g," 个表情包,当前第 ",f," 页"]})]}),e.jsxs(xs,{children:[n.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${R==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":R==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:n.map(Q=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${ve.has(Q.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>E(Q.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${ve.has(Q.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${ve.has(Q.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:ve.has(Q.id)&&e.jsx(aa,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[Q.is_registered&&e.jsx(Qe,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),Q.is_banned&&e.jsx(Qe,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${R==="small"?"p-1":R==="medium"?"p-2":"p-3"}`,children:e.jsx(N1,{src:z1(Q.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${R==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Qe,{variant:"outline",className:"text-[10px] px-1 py-0",children:Q.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[Q.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${R==="small"?"flex-wrap":""}`,children:[e.jsx(S,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ne=>{Ne.stopPropagation(),re(Q)},title:"编辑",children:e.jsx(nn,{className:"h-3 w-3"})}),e.jsx(S,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ne=>{Ne.stopPropagation(),ae(Q)},title:"详情",children:e.jsx(Ra,{className:"h-3 w-3"})}),!Q.is_registered&&e.jsx(S,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Ne=>{Ne.stopPropagation(),Te(Q)},title:"注册",children:e.jsx(aa,{className:"h-3 w-3"})}),!Q.is_banned&&e.jsx(S,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Ne=>{Ne.stopPropagation(),Le(Q)},title:"封禁",children:e.jsx(dy,{className:"h-3 w-3"})}),e.jsx(S,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Ne=>{Ne.stopPropagation(),F(Q)},title:"删除",children:e.jsx(We,{className:"h-3 w-3"})})]})]})]},Q.id))}),g>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(f-1)*j+1," 到"," ",Math.min(f*j,g)," 条,共 ",g," 条"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(lr,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(Q=>Math.max(1,Q-1)),disabled:f===1,children:[e.jsx(il,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:q,onChange:Q=>se(Q.target.value),onKeyDown:Q=>Q.key==="Enter"&&Ye(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(g/j)}),e.jsx(S,{variant:"outline",size:"sm",onClick:Ye,disabled:!q,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(Q=>Q+1),disabled:f>=Math.ceil(g/j),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(g/j)),disabled:f>=Math.ceil(g/j),className:"hidden sm:flex",children:e.jsx(nr,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(R1,{emoji:I,open:A,onOpenChange:te}),e.jsx(L1,{emoji:I,open:fe,onOpenChange:je,onSuccess:()=>{ze(),ge()}}),e.jsx(U1,{open:me,onOpenChange:_e,onSuccess:()=>{ze(),ge()}})]})}),e.jsx(hs,{open:D,onOpenChange:J,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认批量删除"}),e.jsxs(cs,{children:["你确定要删除选中的 ",ve.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:xe,children:"确认删除"})]})]})}),e.jsx(qs,{open:pe,onOpenChange:he,children:e.jsxs(Ls,{children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"确认删除"}),e.jsx(Ps,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>he(!1),children:"取消"}),e.jsx(S,{variant:"destructive",onClick:P,children:"删除"})]})]})})]})}function R1({emoji:n,open:r,onOpenChange:i}){if(!n)return null;const d=m=>m?new Date(m*1e3).toLocaleString("zh-CN"):"-";return e.jsx(qs,{open:r,onOpenChange:i,children:e.jsxs(Ls,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Us,{children:e.jsx(Bs,{children:"表情包详情"})}),e.jsx(Ze,{className:"max-h-[calc(90vh-8rem)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:A1(n.id),alt:n.description||"表情包",className:"w-full h-full object-cover",onError:m=>{const x=m.target;x.style.display="none";const f=x.parentElement;f&&(f.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:n.id})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx(Qe,{variant:"outline",children:n.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:n.full_path})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:n.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"描述"}),n.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(y1,{className:"prose-sm",children:n.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:n.emotion?e.jsx("span",{className:"text-sm",children:n.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[n.is_registered&&e.jsx(Qe,{variant:"default",className:"bg-green-600",children:"已注册"}),n.is_banned&&e.jsx(Qe,{variant:"destructive",children:"已封禁"}),!n.is_registered&&!n.is_banned&&e.jsx(Qe,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:n.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:d(n.record_time)})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:d(n.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:d(n.last_used_time)})]})]})})]})})}function L1({emoji:n,open:r,onOpenChange:i,onSuccess:d}){const[m,x]=u.useState(""),[f,p]=u.useState(!1),[g,b]=u.useState(!1),[j,y]=u.useState(!1),{toast:N}=$s();u.useEffect(()=>{n&&(x(n.emotion||""),p(n.is_registered),b(n.is_banned))},[n]);const k=async()=>{if(n)try{y(!0);const w=m.split(/[,,]/).map(U=>U.trim()).filter(Boolean).join(",");await S1(n.id,{emotion:w||void 0,is_registered:f,is_banned:g}),N({title:"成功",description:"表情包信息已更新"}),i(!1),d()}catch(w){const U=w instanceof Error?w.message:"保存失败";N({title:"错误",description:U,variant:"destructive"})}finally{y(!1)}};return n?e.jsx(qs,{open:r,onOpenChange:i,children:e.jsxs(Ls,{className:"max-w-2xl",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"编辑表情包"}),e.jsx(Ps,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(C,{children:"情绪"}),e.jsx(Qs,{value:m,onChange:w=>x(w.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(mt,{id:"is_registered",checked:f,onCheckedChange:w=>{w===!0?(p(!0),b(!1)):p(!1)}}),e.jsx(C,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(mt,{id:"is_banned",checked:g,onCheckedChange:w=>{w===!0?(b(!0),p(!1)):b(!1)}}),e.jsx(C,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(S,{onClick:k,disabled:j,children:j?"保存中...":"保存"})]})]})}):null}function U1({open:n,onOpenChange:r,onSuccess:i}){const[d,m]=u.useState("select"),[x,f]=u.useState([]),[p,g]=u.useState(null),[b,j]=u.useState(!1),{toast:y}=$s(),N=u.useMemo(()=>new Iy({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);u.useEffect(()=>{const I=()=>{const T=N.getFiles();if(T.length===0)return;const A=T.map(te=>({id:te.id,name:te.name,previewUrl:te.preview||URL.createObjectURL(te.data),emotion:"",description:"",isRegistered:!0,file:te.data}));f(A),T.length===1?(g(A[0].id),m("edit-single")):m("edit-multiple")};return N.on("upload",I),()=>{N.off("upload",I)}},[N]),u.useEffect(()=>{n||(N.cancelAll(),m("select"),f([]),g(null),j(!1))},[n,N]);const k=u.useCallback((I,T)=>{f(A=>A.map(te=>te.id===I?{...te,...T}:te))},[]),w=u.useCallback(I=>I.emotion.trim().length>0,[]),U=u.useMemo(()=>x.length>0&&x.every(w),[x,w]),O=u.useMemo(()=>x.find(I=>I.id===p)||null,[x,p]),B=u.useCallback(()=>{(d==="edit-single"||d==="edit-multiple")&&(m("select"),f([]),g(null))},[d]),Y=u.useCallback(async()=>{if(!U){y({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}j(!0);const I=localStorage.getItem("access-token")||"";let T=0,A=0;try{for(const te of x){const fe=new FormData;fe.append("file",te.file),fe.append("emotion",te.emotion),fe.append("description",te.description),fe.append("is_registered",te.isRegistered.toString());try{(await fetch(D1(),{method:"POST",headers:{Authorization:`Bearer ${I}`},body:fe})).ok?T++:A++}catch{A++}}A===0?(y({title:"上传成功",description:`成功上传 ${T} 个表情包`}),r(!1),i()):(y({title:"部分上传失败",description:`成功 ${T} 个,失败 ${A} 个`,variant:"destructive"}),i())}finally{j(!1)}},[U,x,y,r,i]),L=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(b1,{uppy:N,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),z=()=>{const I=x[0];return I?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(S,{variant:"ghost",size:"sm",onClick:B,children:[e.jsx(er,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"编辑表情包信息"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("div",{className:"w-32 h-32 rounded-lg border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:I.previewUrl,alt:I.name,className:"max-w-full max-h-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate max-w-32",children:I.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{id:"single-emotion",value:I.emotion,onChange:T=>k(I.id,{emotion:T.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:I.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"single-description",children:"描述"}),e.jsx(ie,{id:"single-description",value:I.description,onChange:T=>k(I.id,{description:T.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(mt,{id:"single-is-registered",checked:I.isRegistered,onCheckedChange:T=>k(I.id,{isRegistered:T===!0})}),e.jsx(C,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(st,{children:e.jsx(S,{onClick:Y,disabled:!U||b,children:b?"上传中...":"上传"})})]}):null},K=()=>{const I=x.filter(w).length,T=x.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(S,{variant:"ghost",size:"sm",onClick:B,children:[e.jsx(er,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",I,"/",T," 已完成)"]})]}),e.jsx(Qe,{variant:U?"default":"secondary",children:U?e.jsxs(e.Fragment,{children:[e.jsx(Qt,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(rl,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ze,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:x.map(A=>{const te=w(A),fe=p===A.id;return e.jsxs("div",{onClick:()=>g(A.id),className:` + flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all + ${fe?"ring-2 ring-primary":""} + ${te?"border-green-500 bg-green-50 dark:bg-green-950/20":"border-border hover:border-muted-foreground/50"} + `,children:[e.jsx("div",{className:"w-12 h-12 rounded border overflow-hidden bg-muted flex-shrink-0 flex items-center justify-center",children:e.jsx("img",{src:A.previewUrl,alt:A.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:A.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:A.emotion||"未填写情感标签"})]}),te?e.jsx(aa,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):e.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-muted-foreground/30 flex-shrink-0"})]},A.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:O?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-16 h-16 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:O.previewUrl,alt:O.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:O.name}),w(O)&&e.jsxs(Qe,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(Qt,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{id:"multi-emotion",value:O.emotion,onChange:A=>k(O.id,{emotion:A.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:O.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"multi-description",children:"描述"}),e.jsx(ie,{id:"multi-description",value:O.description,onChange:A=>k(O.id,{description:A.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(mt,{id:"multi-is-registered",checked:O.isRegistered,onCheckedChange:A=>k(O.id,{isRegistered:A===!0})}),e.jsx(C,{htmlFor:"multi-is-registered",className:"cursor-pointer text-sm",children:"上传后立即注册"})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(gg,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(st,{children:e.jsx(S,{onClick:Y,disabled:!U||b,children:b?"上传中...":`上传全部 (${T})`})})]})};return e.jsx(qs,{open:n,onOpenChange:r,children:e.jsxs(Ls,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Us,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(oi,{className:"h-5 w-5"}),d==="select"&&"上传表情包 - 选择文件",d==="edit-single"&&"上传表情包 - 填写信息",d==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(Ps,{children:[d==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",d==="edit-single"&&"请填写表情包的情感标签(必填)和描述",d==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[d==="select"&&L(),d==="edit-single"&&z(),d==="edit-multiple"&&K()]})]})})}const Bl="/api/webui/expression";async function B1(){const n=await Se(`${Bl}/chats`,{});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取聊天列表失败")}return n.json()}async function H1(n){const r=new URLSearchParams;n.page&&r.append("page",n.page.toString()),n.page_size&&r.append("page_size",n.page_size.toString()),n.search&&r.append("search",n.search),n.chat_id&&r.append("chat_id",n.chat_id);const i=await Se(`${Bl}/list?${r}`,{});if(!i.ok){const d=await i.json();throw new Error(d.detail||"获取表达方式列表失败")}return i.json()}async function q1(n){const r=await Se(`${Bl}/${n}`,{});if(!r.ok){const i=await r.json();throw new Error(i.detail||"获取表达方式详情失败")}return r.json()}async function G1(n){const r=await Se(`${Bl}/`,{method:"POST",body:JSON.stringify(n)});if(!r.ok){const i=await r.json();throw new Error(i.detail||"创建表达方式失败")}return r.json()}async function $1(n,r){const i=await Se(`${Bl}/${n}`,{method:"PATCH",body:JSON.stringify(r)});if(!i.ok){const d=await i.json();throw new Error(d.detail||"更新表达方式失败")}return i.json()}async function F1(n){const r=await Se(`${Bl}/${n}`,{method:"DELETE"});if(!r.ok){const i=await r.json();throw new Error(i.detail||"删除表达方式失败")}return r.json()}async function V1(n){const r=await Se(`${Bl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:n})});if(!r.ok){const i=await r.json();throw new Error(i.detail||"批量删除表达方式失败")}return r.json()}async function Q1(){const n=await Se(`${Bl}/stats/summary`,{});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取统计数据失败")}return n.json()}function I1(){const[n,r]=u.useState([]),[i,d]=u.useState(!0),[m,x]=u.useState(0),[f,p]=u.useState(1),[g,b]=u.useState(20),[j,y]=u.useState(""),[N,k]=u.useState(null),[w,U]=u.useState(!1),[O,B]=u.useState(!1),[Y,L]=u.useState(!1),[z,K]=u.useState(null),[I,T]=u.useState(new Set),[A,te]=u.useState(!1),[fe,je]=u.useState(""),[pe,he]=u.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[ve,be]=u.useState([]),[D,J]=u.useState(new Map),{toast:q}=$s(),se=async()=>{try{d(!0);const P=await H1({page:f,page_size:g,search:j||void 0});r(P.data),x(P.total)}catch(P){q({title:"加载失败",description:P instanceof Error?P.message:"无法加载表达方式",variant:"destructive"})}finally{d(!1)}},R=async()=>{try{const P=await Q1();P?.data&&he(P.data)}catch(P){console.error("加载统计数据失败:",P)}},ue=async()=>{try{const P=await B1();if(P?.data){be(P.data);const Te=new Map;P.data.forEach(Le=>{Te.set(Le.chat_id,Le.chat_name)}),J(Te)}}catch(P){console.error("加载聊天列表失败:",P)}},me=P=>D.get(P)||P;u.useEffect(()=>{se(),R(),ue()},[f,g,j]);const _e=async P=>{try{const Te=await q1(P.id);k(Te.data),U(!0)}catch(Te){q({title:"加载详情失败",description:Te instanceof Error?Te.message:"无法加载表达方式详情",variant:"destructive"})}},Ce=P=>{k(P),B(!0)},ze=async P=>{try{await F1(P.id),q({title:"删除成功",description:`已删除表达方式: ${P.situation}`}),K(null),se(),R()}catch(Te){q({title:"删除失败",description:Te instanceof Error?Te.message:"无法删除表达方式",variant:"destructive"})}},ge=P=>{const Te=new Set(I);Te.has(P)?Te.delete(P):Te.add(P),T(Te)},ae=()=>{I.size===n.length&&n.length>0?T(new Set):T(new Set(n.map(P=>P.id)))},re=async()=>{try{await V1(Array.from(I)),q({title:"批量删除成功",description:`已删除 ${I.size} 个表达方式`}),T(new Set),te(!1),se(),R()}catch(P){q({title:"批量删除失败",description:P instanceof Error?P.message:"无法批量删除表达方式",variant:"destructive"})}},F=()=>{const P=parseInt(fe),Te=Math.ceil(m/g);P>=1&&P<=Te?(p(P),je("")):q({title:"无效的页码",description:`请输入1-${Te}之间的页码`,variant:"destructive"})};return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Rl,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs(S,{onClick:()=>L(!0),className:"gap-2",children:[e.jsx(dt,{className:"h-4 w-4"}),"新增表达方式"]})]})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:pe.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:pe.recent_7days})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:pe.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(C,{htmlFor:"search",children:"搜索"}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Mt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{id:"search",placeholder:"搜索情境、风格或上下文...",value:j,onChange:P=>y(P.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:I.size>0&&e.jsxs("span",{children:["已选择 ",I.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:g.toString(),onValueChange:P=>{b(parseInt(P)),p(1),T(new Set)},children:[e.jsx(Oe,{id:"page-size",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]}),I.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>T(new Set),children:"取消选择"}),e.jsxs(S,{variant:"destructive",size:"sm",onClick:()=>te(!0),children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ut,{children:[e.jsx(Xe,{className:"w-12",children:e.jsx(mt,{checked:I.size===n.length&&n.length>0,onCheckedChange:ae})}),e.jsx(Xe,{children:"情境"}),e.jsx(Xe,{children:"风格"}),e.jsx(Xe,{children:"聊天"}),e.jsx(Xe,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:i?e.jsx(ut,{children:e.jsx(Ve,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):n.length===0?e.jsx(ut,{children:e.jsx(Ve,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):n.map(P=>e.jsxs(ut,{children:[e.jsx(Ve,{children:e.jsx(mt,{checked:I.has(P.id),onCheckedChange:()=>ge(P.id)})}),e.jsx(Ve,{className:"font-medium max-w-xs truncate",children:P.situation}),e.jsx(Ve,{className:"max-w-xs truncate",children:P.style}),e.jsx(Ve,{className:"max-w-[200px] truncate",title:me(P.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:me(P.chat_id)})}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(S,{variant:"default",size:"sm",onClick:()=>Ce(P),children:[e.jsx(nn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(S,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>_e(P),title:"查看详情",children:e.jsx(Rt,{className:"h-4 w-4"})}),e.jsxs(S,{size:"sm",onClick:()=>K(P),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},P.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):n.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):n.map(P=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(mt,{checked:I.has(P.id),onCheckedChange:()=>ge(P.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:P.situation,children:P.situation})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),e.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:P.style,children:P.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("p",{className:"text-sm truncate",title:me(P.chat_id),style:{wordBreak:"keep-all"},children:me(P.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>Ce(P),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(nn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>_e(P),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(Rt,{className:"h-3 w-3"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>K(P),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(We,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},P.id))}),m>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",m," 条记录,第 ",f," / ",Math.ceil(m/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(lr,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f-1),disabled:f===1,children:[e.jsx(il,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:fe,onChange:P=>je(P.target.value),onKeyDown:P=>P.key==="Enter"&&F(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/g)}),e.jsx(S,{variant:"outline",size:"sm",onClick:F,disabled:!fe,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f+1),disabled:f>=Math.ceil(m/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(m/g)),disabled:f>=Math.ceil(m/g),className:"hidden sm:flex",children:e.jsx(nr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(Y1,{expression:N,open:w,onOpenChange:U,chatNameMap:D}),e.jsx(K1,{open:Y,onOpenChange:L,chatList:ve,onSuccess:()=>{se(),R(),L(!1)}}),e.jsx(X1,{expression:N,open:O,onOpenChange:B,chatList:ve,onSuccess:()=>{se(),R(),B(!1)}}),e.jsx(hs,{open:!!z,onOpenChange:()=>K(null),children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:['确定要删除表达方式 "',z?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>z&&ze(z),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(J1,{open:A,onOpenChange:te,onConfirm:re,count:I.size})]})}function Y1({expression:n,open:r,onOpenChange:i,chatNameMap:d}){if(!n)return null;const m=f=>f?new Date(f*1e3).toLocaleString("zh-CN"):"-",x=f=>d.get(f)||f;return e.jsx(qs,{open:r,onOpenChange:i,children:e.jsxs(Ls,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"表达方式详情"}),e.jsx(Ps,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(si,{label:"情境",value:n.situation}),e.jsx(si,{label:"风格",value:n.style}),e.jsx(si,{label:"聊天",value:x(n.chat_id)}),e.jsx(si,{icon:sr,label:"记录ID",value:n.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(si,{icon:Pn,label:"创建时间",value:m(n.create_date)})})]}),e.jsx(st,{children:e.jsx(S,{onClick:()=>i(!1),children:"关闭"})})]})})}function si({icon:n,label:r,value:i,mono:d=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n&&e.jsx(n,{className:"h-3 w-3"}),r]}),e.jsx("div",{className:$("text-sm",d&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function K1({open:n,onOpenChange:r,chatList:i,onSuccess:d}){const[m,x]=u.useState({situation:"",style:"",chat_id:""}),[f,p]=u.useState(!1),{toast:g}=$s(),b=async()=>{if(!m.situation||!m.style||!m.chat_id){g({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{p(!0),await G1(m),g({title:"创建成功",description:"表达方式已创建"}),x({situation:"",style:"",chat_id:""}),d()}catch(j){g({title:"创建失败",description:j instanceof Error?j.message:"无法创建表达方式",variant:"destructive"})}finally{p(!1)}};return e.jsx(qs,{open:n,onOpenChange:r,children:e.jsxs(Ls,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"新增表达方式"}),e.jsx(Ps,{children:"创建新的表达方式记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{id:"situation",value:m.situation,onChange:j=>x({...m,situation:j.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{id:"style",value:m.style,onChange:j=>x({...m,style:j.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Ue,{value:m.chat_id,onValueChange:j=>x({...m,chat_id:j}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:i.map(j=>e.jsx(le,{value:j.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[j.chat_name,j.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},j.chat_id))})]})]})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(S,{onClick:b,disabled:f,children:f?"创建中...":"创建"})]})]})})}function X1({expression:n,open:r,onOpenChange:i,chatList:d,onSuccess:m}){const[x,f]=u.useState({}),[p,g]=u.useState(!1),{toast:b}=$s();u.useEffect(()=>{n&&f({situation:n.situation,style:n.style,chat_id:n.chat_id})},[n]);const j=async()=>{if(n)try{g(!0),await $1(n.id,x),b({title:"保存成功",description:"表达方式已更新"}),m()}catch(y){b({title:"保存失败",description:y instanceof Error?y.message:"无法更新表达方式",variant:"destructive"})}finally{g(!1)}};return n?e.jsx(qs,{open:r,onOpenChange:i,children:e.jsxs(Ls,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"编辑表达方式"}),e.jsx(Ps,{children:"修改表达方式的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_situation",children:"情境"}),e.jsx(ie,{id:"edit_situation",value:x.situation||"",onChange:y=>f({...x,situation:y.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_style",children:"风格"}),e.jsx(ie,{id:"edit_style",value:x.style||"",onChange:y=>f({...x,style:y.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Ue,{value:x.chat_id||"",onValueChange:y=>f({...x,chat_id:y}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:d.map(y=>e.jsx(le,{value:y.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[y.chat_name,y.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},y.chat_id))})]})]})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(S,{onClick:j,disabled:p,children:p?"保存中...":"保存"})]})]})}):null}function J1({open:n,onOpenChange:r,onConfirm:i,count:d}){return e.jsx(hs,{open:n,onOpenChange:r,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认批量删除"}),e.jsxs(cs,{children:["您即将删除 ",d," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const cl="/api/webui/jargon";async function Z1(){const n=await Se(`${cl}/chats`,{});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取聊天列表失败")}return n.json()}async function P1(n){const r=new URLSearchParams;n.page&&r.append("page",n.page.toString()),n.page_size&&r.append("page_size",n.page_size.toString()),n.search&&r.append("search",n.search),n.chat_id&&r.append("chat_id",n.chat_id),n.is_jargon!==void 0&&n.is_jargon!==null&&r.append("is_jargon",n.is_jargon.toString()),n.is_global!==void 0&&r.append("is_global",n.is_global.toString());const i=await Se(`${cl}/list?${r}`,{});if(!i.ok){const d=await i.json();throw new Error(d.detail||"获取黑话列表失败")}return i.json()}async function W1(n){const r=await Se(`${cl}/${n}`,{});if(!r.ok){const i=await r.json();throw new Error(i.detail||"获取黑话详情失败")}return r.json()}async function e2(n){const r=await Se(`${cl}/`,{method:"POST",body:JSON.stringify(n)});if(!r.ok){const i=await r.json();throw new Error(i.detail||"创建黑话失败")}return r.json()}async function s2(n,r){const i=await Se(`${cl}/${n}`,{method:"PATCH",body:JSON.stringify(r)});if(!i.ok){const d=await i.json();throw new Error(d.detail||"更新黑话失败")}return i.json()}async function t2(n){const r=await Se(`${cl}/${n}`,{method:"DELETE"});if(!r.ok){const i=await r.json();throw new Error(i.detail||"删除黑话失败")}return r.json()}async function a2(n){const r=await Se(`${cl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:n})});if(!r.ok){const i=await r.json();throw new Error(i.detail||"批量删除黑话失败")}return r.json()}async function l2(){const n=await Se(`${cl}/stats/summary`,{});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取黑话统计失败")}return n.json()}async function n2(n,r){const i=new URLSearchParams;n.forEach(m=>i.append("ids",m.toString())),i.append("is_jargon",r.toString());const d=await Se(`${cl}/batch/set-jargon?${i}`,{method:"POST"});if(!d.ok){const m=await d.json();throw new Error(m.detail||"批量设置黑话状态失败")}return d.json()}function r2(){const[n,r]=u.useState([]),[i,d]=u.useState(!0),[m,x]=u.useState(0),[f,p]=u.useState(1),[g,b]=u.useState(20),[j,y]=u.useState(""),[N,k]=u.useState("all"),[w,U]=u.useState("all"),[O,B]=u.useState(null),[Y,L]=u.useState(!1),[z,K]=u.useState(!1),[I,T]=u.useState(!1),[A,te]=u.useState(null),[fe,je]=u.useState(new Set),[pe,he]=u.useState(!1),[ve,be]=u.useState(""),[D,J]=u.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[q,se]=u.useState([]),{toast:R}=$s(),ue=async()=>{try{d(!0);const E=await P1({page:f,page_size:g,search:j||void 0,chat_id:N==="all"?void 0:N,is_jargon:w==="all"?void 0:w==="true"?!0:w==="false"?!1:void 0});r(E.data),x(E.total)}catch(E){R({title:"加载失败",description:E instanceof Error?E.message:"无法加载黑话列表",variant:"destructive"})}finally{d(!1)}},me=async()=>{try{const E=await l2();E?.data&&J(E.data)}catch(E){console.error("加载统计数据失败:",E)}},_e=async()=>{try{const E=await Z1();E?.data&&se(E.data)}catch(E){console.error("加载聊天列表失败:",E)}};u.useEffect(()=>{ue(),me(),_e()},[f,g,j,N,w]);const Ce=async E=>{try{const xe=await W1(E.id);B(xe.data),L(!0)}catch(xe){R({title:"加载详情失败",description:xe instanceof Error?xe.message:"无法加载黑话详情",variant:"destructive"})}},ze=E=>{B(E),K(!0)},ge=async E=>{try{await t2(E.id),R({title:"删除成功",description:`已删除黑话: ${E.content}`}),te(null),ue(),me()}catch(xe){R({title:"删除失败",description:xe instanceof Error?xe.message:"无法删除黑话",variant:"destructive"})}},ae=E=>{const xe=new Set(fe);xe.has(E)?xe.delete(E):xe.add(E),je(xe)},re=()=>{fe.size===n.length&&n.length>0?je(new Set):je(new Set(n.map(E=>E.id)))},F=async()=>{try{await a2(Array.from(fe)),R({title:"批量删除成功",description:`已删除 ${fe.size} 个黑话`}),je(new Set),he(!1),ue(),me()}catch(E){R({title:"批量删除失败",description:E instanceof Error?E.message:"无法批量删除黑话",variant:"destructive"})}},P=async E=>{try{await n2(Array.from(fe),E),R({title:"操作成功",description:`已将 ${fe.size} 个词条设为${E?"黑话":"非黑话"}`}),je(new Set),ue(),me()}catch(xe){R({title:"操作失败",description:xe instanceof Error?xe.message:"批量设置失败",variant:"destructive"})}},Te=()=>{const E=parseInt(ve),xe=Math.ceil(m/g);E>=1&&E<=xe?(p(E),be("")):R({title:"无效的页码",description:`请输入1-${xe}之间的页码`,variant:"destructive"})},Le=E=>E===!0?e.jsxs(Qe,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Qt,{className:"h-3 w-3 mr-1"}),"是黑话"]}):E===!1?e.jsxs(Qe,{variant:"secondary",children:[e.jsx(rl,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(Qe,{variant:"outline",children:[e.jsx(pg,{className:"h-3 w-3 mr-1"}),"未判定"]});return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(uy,{className:"h-8 w-8",strokeWidth:2}),"黑话管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦学习到的黑话和俚语"})]}),e.jsxs(S,{onClick:()=>T(!0),className:"gap-2",children:[e.jsx(dt,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:D.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"已确认黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-green-600",children:D.confirmed_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"确认非黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-gray-500",children:D.confirmed_not_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"待判定"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-yellow-600",children:D.pending})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"全局黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-blue-600",children:D.global_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"推断完成"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-purple-600",children:D.complete_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:D.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{id:"search",placeholder:"搜索内容、含义...",value:j,onChange:E=>y(E.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"聊天筛选"}),e.jsxs(Ue,{value:N,onValueChange:k,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"全部聊天"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部聊天"}),q.map(E=>e.jsx(le,{value:E.chat_id,children:E.chat_name},E.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"状态筛选"}),e.jsxs(Ue,{value:w,onValueChange:U,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"全部状态"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部状态"}),e.jsx(le,{value:"true",children:"是黑话"}),e.jsx(le,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Ue,{value:g.toString(),onValueChange:E=>{b(parseInt(E)),p(1),je(new Set)},children:[e.jsx(Oe,{id:"page-size",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]})]})]}),fe.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4 pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",fe.size," 个"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>P(!0),children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>P(!1),children:[e.jsx(rl,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>je(new Set),children:"取消选择"}),e.jsxs(S,{variant:"destructive",size:"sm",onClick:()=>he(!0),children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ut,{children:[e.jsx(Xe,{className:"w-12",children:e.jsx(mt,{checked:fe.size===n.length&&n.length>0,onCheckedChange:re})}),e.jsx(Xe,{children:"内容"}),e.jsx(Xe,{children:"含义"}),e.jsx(Xe,{children:"聊天"}),e.jsx(Xe,{children:"状态"}),e.jsx(Xe,{className:"text-center",children:"次数"}),e.jsx(Xe,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:i?e.jsx(ut,{children:e.jsx(Ve,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):n.length===0?e.jsx(ut,{children:e.jsx(Ve,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):n.map(E=>e.jsxs(ut,{children:[e.jsx(Ve,{children:e.jsx(mt,{checked:fe.has(E.id),onCheckedChange:()=>ae(E.id)})}),e.jsx(Ve,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[E.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(Ru,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:E.content,children:E.content})]})}),e.jsx(Ve,{className:"max-w-[200px] truncate",title:E.meaning||"",children:E.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ve,{className:"max-w-[150px] truncate",title:E.chat_name||E.chat_id,children:E.chat_name||E.chat_id}),e.jsx(Ve,{children:Le(E.is_jargon)}),e.jsx(Ve,{className:"text-center",children:E.count}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(S,{variant:"default",size:"sm",onClick:()=>ze(E),children:[e.jsx(nn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(S,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Ce(E),title:"查看详情",children:e.jsx(Rt,{className:"h-4 w-4"})}),e.jsxs(S,{size:"sm",onClick:()=>te(E),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},E.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):n.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):n.map(E=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(mt,{checked:fe.has(E.id),onCheckedChange:()=>ae(E.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[E.is_global&&e.jsx(Ru,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:E.content})]}),E.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:E.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[Le(E.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",E.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",E.chat_name||E.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>ze(E),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(nn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>Ce(E),className:"text-xs px-2 py-1 h-auto",children:e.jsx(Rt,{className:"h-3 w-3"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>te(E),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(We,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},E.id))}),m>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",m," 条记录,第 ",f," / ",Math.ceil(m/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(lr,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f-1),disabled:f===1,children:[e.jsx(il,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:ve,onChange:E=>be(E.target.value),onKeyDown:E=>E.key==="Enter"&&Te(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/g)}),e.jsx(S,{variant:"outline",size:"sm",onClick:Te,disabled:!ve,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f+1),disabled:f>=Math.ceil(m/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(m/g)),disabled:f>=Math.ceil(m/g),className:"hidden sm:flex",children:e.jsx(nr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(i2,{jargon:O,open:Y,onOpenChange:L}),e.jsx(c2,{open:I,onOpenChange:T,chatList:q,onSuccess:()=>{ue(),me(),T(!1)}}),e.jsx(o2,{jargon:O,open:z,onOpenChange:K,chatList:q,onSuccess:()=>{ue(),me(),K(!1)}}),e.jsx(hs,{open:!!A,onOpenChange:()=>te(null),children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:['确定要删除黑话 "',A?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>A&&ge(A),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(hs,{open:pe,onOpenChange:he,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认批量删除"}),e.jsxs(cs,{children:["您即将删除 ",fe.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:F,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function i2({jargon:n,open:r,onOpenChange:i}){return n?e.jsx(qs,{open:r,onOpenChange:i,children:e.jsxs(Ls,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"黑话详情"}),e.jsx(Ps,{children:"查看黑话的完整信息"})]}),e.jsx(Ze,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Mu,{icon:sr,label:"记录ID",value:n.id.toString(),mono:!0}),e.jsx(Mu,{label:"使用次数",value:n.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:n.content})]}),n.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"原始内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const d=JSON.parse(n.raw_content);return Array.isArray(d)?d.map((m,x)=>e.jsxs("div",{children:[x>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:m})]},x)):e.jsx("div",{className:"whitespace-pre-wrap",children:n.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:n.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:n.meaning?e.jsx(Yg,{content:n.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Mu,{label:"聊天",value:n.chat_name||n.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[n.is_jargon===!0&&e.jsx(Qe,{variant:"default",className:"bg-green-600",children:"是黑话"}),n.is_jargon===!1&&e.jsx(Qe,{variant:"secondary",children:"非黑话"}),n.is_jargon===null&&e.jsx(Qe,{variant:"outline",children:"未判定"}),n.is_global&&e.jsx(Qe,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),n.is_complete&&e.jsx(Qe,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),n.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"上下文推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:n.inference_with_context})]}),n.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"纯词条推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:n.inference_content_only})]})]})}),e.jsx(st,{className:"flex-shrink-0",children:e.jsx(S,{onClick:()=>i(!1),children:"关闭"})})]})}):null}function Mu({icon:n,label:r,value:i,mono:d=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n&&e.jsx(n,{className:"h-3 w-3"}),r]}),e.jsx("div",{className:$("text-sm",d&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function c2({open:n,onOpenChange:r,chatList:i,onSuccess:d}){const[m,x]=u.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[f,p]=u.useState(!1),{toast:g}=$s(),b=async()=>{if(!m.content||!m.chat_id){g({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{p(!0),await e2(m),g({title:"创建成功",description:"黑话已创建"}),x({content:"",meaning:"",chat_id:"",is_global:!1}),d()}catch(j){g({title:"创建失败",description:j instanceof Error?j.message:"无法创建黑话",variant:"destructive"})}finally{p(!1)}};return e.jsx(qs,{open:n,onOpenChange:r,children:e.jsxs(Ls,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"新增黑话"}),e.jsx(Ps,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{id:"content",value:m.content,onChange:j=>x({...m,content:j.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"meaning",children:"含义"}),e.jsx(Qs,{id:"meaning",value:m.meaning||"",onChange:j=>x({...m,meaning:j.target.value}),placeholder:"输入黑话含义(可选)",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Ue,{value:m.chat_id,onValueChange:j=>x({...m,chat_id:j}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:i.map(j=>e.jsx(le,{value:j.chat_id,children:j.chat_name},j.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"is_global",checked:m.is_global,onCheckedChange:j=>x({...m,is_global:j})}),e.jsx(C,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(S,{onClick:b,disabled:f,children:f?"创建中...":"创建"})]})]})})}function o2({jargon:n,open:r,onOpenChange:i,chatList:d,onSuccess:m}){const[x,f]=u.useState({}),[p,g]=u.useState(!1),{toast:b}=$s();u.useEffect(()=>{n&&f({content:n.content,meaning:n.meaning||"",chat_id:n.stream_id||n.chat_id,is_global:n.is_global,is_jargon:n.is_jargon})},[n]);const j=async()=>{if(n)try{g(!0),await s2(n.id,x),b({title:"保存成功",description:"黑话已更新"}),m()}catch(y){b({title:"保存失败",description:y instanceof Error?y.message:"无法更新黑话",variant:"destructive"})}finally{g(!1)}};return n?e.jsx(qs,{open:r,onOpenChange:i,children:e.jsxs(Ls,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"编辑黑话"}),e.jsx(Ps,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_content",children:"内容"}),e.jsx(ie,{id:"edit_content",value:x.content||"",onChange:y=>f({...x,content:y.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(Qs,{id:"edit_meaning",value:x.meaning||"",onChange:y=>f({...x,meaning:y.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Ue,{value:x.chat_id||"",onValueChange:y=>f({...x,chat_id:y}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:d.map(y=>e.jsx(le,{value:y.chat_id,children:y.chat_name},y.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"黑话状态"}),e.jsxs(Ue,{value:x.is_jargon===null?"null":x.is_jargon?.toString()||"null",onValueChange:y=>f({...x,is_jargon:y==="null"?null:y==="true"}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"null",children:"未判定"}),e.jsx(le,{value:"true",children:"是黑话"}),e.jsx(le,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"edit_is_global",checked:x.is_global,onCheckedChange:y=>f({...x,is_global:y})}),e.jsx(C,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(S,{onClick:j,disabled:p,children:p?"保存中...":"保存"})]})]})}):null}const ir="/api/webui/person";async function d2(n){const r=new URLSearchParams;n.page&&r.append("page",n.page.toString()),n.page_size&&r.append("page_size",n.page_size.toString()),n.search&&r.append("search",n.search),n.is_known!==void 0&&r.append("is_known",n.is_known.toString()),n.platform&&r.append("platform",n.platform);const i=await Se(`${ir}/list?${r}`,{headers:Gs()});if(!i.ok){const d=await i.json();throw new Error(d.detail||"获取人物列表失败")}return i.json()}async function u2(n){const r=await Se(`${ir}/${n}`,{headers:Gs()});if(!r.ok){const i=await r.json();throw new Error(i.detail||"获取人物详情失败")}return r.json()}async function m2(n,r){const i=await Se(`${ir}/${n}`,{method:"PATCH",headers:Gs(),body:JSON.stringify(r)});if(!i.ok){const d=await i.json();throw new Error(d.detail||"更新人物信息失败")}return i.json()}async function x2(n){const r=await Se(`${ir}/${n}`,{method:"DELETE",headers:Gs()});if(!r.ok){const i=await r.json();throw new Error(i.detail||"删除人物信息失败")}return r.json()}async function h2(){const n=await Se(`${ir}/stats/summary`,{headers:Gs()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取统计数据失败")}return n.json()}async function f2(n){const r=await Se(`${ir}/batch/delete`,{method:"POST",headers:Gs(),body:JSON.stringify({person_ids:n})});if(!r.ok){const i=await r.json();throw new Error(i.detail||"批量删除失败")}return r.json()}function p2(){const[n,r]=u.useState([]),[i,d]=u.useState(!0),[m,x]=u.useState(0),[f,p]=u.useState(1),[g,b]=u.useState(20),[j,y]=u.useState(""),[N,k]=u.useState(void 0),[w,U]=u.useState(void 0),[O,B]=u.useState(null),[Y,L]=u.useState(!1),[z,K]=u.useState(!1),[I,T]=u.useState(null),[A,te]=u.useState({total:0,known:0,unknown:0,platforms:{}}),[fe,je]=u.useState(new Set),[pe,he]=u.useState(!1),[ve,be]=u.useState(""),{toast:D}=$s(),J=async()=>{try{d(!0);const F=await d2({page:f,page_size:g,search:j||void 0,is_known:N,platform:w});r(F.data),x(F.total)}catch(F){D({title:"加载失败",description:F instanceof Error?F.message:"无法加载人物信息",variant:"destructive"})}finally{d(!1)}},q=async()=>{try{const F=await h2();F?.data&&te(F.data)}catch(F){console.error("加载统计数据失败:",F)}};u.useEffect(()=>{J(),q()},[f,g,j,N,w]);const se=async F=>{try{const P=await u2(F.person_id);B(P.data),L(!0)}catch(P){D({title:"加载详情失败",description:P instanceof Error?P.message:"无法加载人物详情",variant:"destructive"})}},R=F=>{B(F),K(!0)},ue=async F=>{try{await x2(F.person_id),D({title:"删除成功",description:`已删除人物信息: ${F.person_name||F.nickname||F.user_id}`}),T(null),J(),q()}catch(P){D({title:"删除失败",description:P instanceof Error?P.message:"无法删除人物信息",variant:"destructive"})}},me=u.useMemo(()=>Object.keys(A.platforms),[A.platforms]),_e=F=>{const P=new Set(fe);P.has(F)?P.delete(F):P.add(F),je(P)},Ce=()=>{fe.size===n.length&&n.length>0?je(new Set):je(new Set(n.map(F=>F.person_id)))},ze=()=>{if(fe.size===0){D({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}he(!0)},ge=async()=>{try{const F=await f2(Array.from(fe));D({title:"批量删除完成",description:F.message}),je(new Set),he(!1),J(),q()}catch(F){D({title:"批量删除失败",description:F instanceof Error?F.message:"批量删除失败",variant:"destructive"})}},ae=()=>{const F=parseInt(ve),P=Math.ceil(m/g);F>=1&&F<=P?(p(F),be("")):D({title:"无效的页码",description:`请输入1-${P}之间的页码`,variant:"destructive"})},re=F=>F?new Date(F*1e3).toLocaleString("zh-CN"):"-";return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Lu,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:A.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:A.known})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:A.unknown})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(C,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(Mt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:j,onChange:F=>y(F.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(C,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Ue,{value:N===void 0?"all":N.toString(),onValueChange:F=>{k(F==="all"?void 0:F==="true"),p(1)},children:[e.jsx(Oe,{id:"filter-known",className:"mt-1.5",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),e.jsx(le,{value:"true",children:"已认识"}),e.jsx(le,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Ue,{value:w||"all",onValueChange:F=>{U(F==="all"?void 0:F),p(1)},children:[e.jsx(Oe,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部平台"}),me.map(F=>e.jsxs(le,{value:F,children:[F," (",A.platforms[F],")"]},F))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:fe.size>0&&e.jsxs("span",{children:["已选择 ",fe.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:g.toString(),onValueChange:F=>{b(parseInt(F)),p(1),je(new Set)},children:[e.jsx(Oe,{id:"page-size",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]}),fe.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>je(new Set),children:"取消选择"}),e.jsxs(S,{variant:"destructive",size:"sm",onClick:ze,children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ut,{children:[e.jsx(Xe,{className:"w-12",children:e.jsx(mt,{checked:n.length>0&&fe.size===n.length,onCheckedChange:Ce,"aria-label":"全选"})}),e.jsx(Xe,{children:"状态"}),e.jsx(Xe,{children:"名称"}),e.jsx(Xe,{children:"昵称"}),e.jsx(Xe,{children:"平台"}),e.jsx(Xe,{children:"用户ID"}),e.jsx(Xe,{children:"最后更新"}),e.jsx(Xe,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:i?e.jsx(ut,{children:e.jsx(Ve,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):n.length===0?e.jsx(ut,{children:e.jsx(Ve,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):n.map(F=>e.jsxs(ut,{children:[e.jsx(Ve,{children:e.jsx(mt,{checked:fe.has(F.person_id),onCheckedChange:()=>_e(F.person_id),"aria-label":`选择 ${F.person_name||F.nickname||F.user_id}`})}),e.jsx(Ve,{children:e.jsx("div",{className:$("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",F.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:F.is_known?"已认识":"未认识"})}),e.jsx(Ve,{className:"font-medium",children:F.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ve,{children:F.nickname||"-"}),e.jsx(Ve,{children:F.platform}),e.jsx(Ve,{className:"font-mono text-sm",children:F.user_id}),e.jsx(Ve,{className:"text-sm text-muted-foreground",children:re(F.last_know)}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(S,{variant:"default",size:"sm",onClick:()=>se(F),children:[e.jsx(Rt,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(S,{variant:"default",size:"sm",onClick:()=>R(F),children:[e.jsx(nn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(S,{size:"sm",onClick:()=>T(F),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},F.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):n.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):n.map(F=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(mt,{checked:fe.has(F.person_id),onCheckedChange:()=>_e(F.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:$("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",F.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:F.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:F.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),F.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",F.nickname]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),e.jsx("p",{className:"font-medium text-xs",children:F.platform})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),e.jsx("p",{className:"font-mono text-xs truncate",title:F.user_id,children:F.user_id})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),e.jsx("p",{className:"text-xs",children:re(F.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>se(F),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Rt,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>R(F),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(nn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>T(F),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(We,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},F.id))}),m>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",m," 条记录,第 ",f," / ",Math.ceil(m/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(lr,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f-1),disabled:f===1,children:[e.jsx(il,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:ve,onChange:F=>be(F.target.value),onKeyDown:F=>F.key==="Enter"&&ae(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/g)}),e.jsx(S,{variant:"outline",size:"sm",onClick:ae,disabled:!ve,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f+1),disabled:f>=Math.ceil(m/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(m/g)),disabled:f>=Math.ceil(m/g),className:"hidden sm:flex",children:e.jsx(nr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(g2,{person:O,open:Y,onOpenChange:L}),e.jsx(j2,{person:O,open:z,onOpenChange:K,onSuccess:()=>{J(),q(),K(!1)}}),e.jsx(hs,{open:!!I,onOpenChange:()=>T(null),children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认删除"}),e.jsxs(cs,{children:['确定要删除人物信息 "',I?.person_name||I?.nickname||I?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:()=>I&&ue(I),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(hs,{open:pe,onOpenChange:he,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"确认批量删除"}),e.jsxs(cs,{children:["确定要删除选中的 ",fe.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{children:"取消"}),e.jsx(os,{onClick:ge,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function g2({person:n,open:r,onOpenChange:i}){if(!n)return null;const d=m=>m?new Date(m*1e3).toLocaleString("zh-CN"):"-";return e.jsx(qs,{open:r,onOpenChange:i,children:e.jsxs(Ls,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"人物详情"}),e.jsxs(Ps,{children:["查看 ",n.person_name||n.nickname||n.user_id," 的完整信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ll,{icon:Qc,label:"人物名称",value:n.person_name}),e.jsx(ll,{icon:Rl,label:"昵称",value:n.nickname}),e.jsx(ll,{icon:sr,label:"用户ID",value:n.user_id,mono:!0}),e.jsx(ll,{icon:sr,label:"人物ID",value:n.person_id,mono:!0}),e.jsx(ll,{label:"平台",value:n.platform}),e.jsx(ll,{label:"状态",value:n.is_known?"已认识":"未认识"})]}),n.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:n.name_reason})]}),n.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:n.memory_points})]}),n.group_nick_name&&n.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:n.group_nick_name.map((m,x)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:m.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:m.group_nick_name})]},x))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(ll,{icon:Pn,label:"认识时间",value:d(n.know_times)}),e.jsx(ll,{icon:Pn,label:"首次记录",value:d(n.know_since)}),e.jsx(ll,{icon:Pn,label:"最后更新",value:d(n.last_know)})]})]}),e.jsx(st,{children:e.jsx(S,{onClick:()=>i(!1),children:"关闭"})})]})})}function ll({icon:n,label:r,value:i,mono:d=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n&&e.jsx(n,{className:"h-3 w-3"}),r]}),e.jsx("div",{className:$("text-sm",d&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function j2({person:n,open:r,onOpenChange:i,onSuccess:d}){const[m,x]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=$s();u.useEffect(()=>{n&&x({person_name:n.person_name||"",name_reason:n.name_reason||"",nickname:n.nickname||"",memory_points:n.memory_points||"",is_known:n.is_known})},[n]);const b=async()=>{if(n)try{p(!0),await m2(n.person_id,m),g({title:"保存成功",description:"人物信息已更新"}),d()}catch(j){g({title:"保存失败",description:j instanceof Error?j.message:"无法更新人物信息",variant:"destructive"})}finally{p(!1)}};return n?e.jsx(qs,{open:r,onOpenChange:i,children:e.jsxs(Ls,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"编辑人物信息"}),e.jsxs(Ps,{children:["修改 ",n.person_name||n.nickname||n.user_id," 的信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"person_name",children:"人物名称"}),e.jsx(ie,{id:"person_name",value:m.person_name||"",onChange:j=>x({...m,person_name:j.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称"}),e.jsx(ie,{id:"nickname",value:m.nickname||"",onChange:j=>x({...m,nickname:j.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(Qs,{id:"name_reason",value:m.name_reason||"",onChange:j=>x({...m,name_reason:j.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"memory_points",children:"个人印象"}),e.jsx(Qs,{id:"memory_points",value:m.memory_points||"",onChange:j=>x({...m,memory_points:j.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx($e,{id:"is_known",checked:m.is_known,onCheckedChange:j=>x({...m,is_known:j})})]})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(S,{onClick:b,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}var v2=Zy();const vp=Ib(v2),Wu="/api/webui";async function b2(n=100,r="all"){const i=`${Wu}/knowledge/graph?limit=${n}&node_type=${r}`,d=await fetch(i);if(!d.ok)throw new Error(`获取知识图谱失败: ${d.status}`);return d.json()}async function N2(){const n=await fetch(`${Wu}/knowledge/stats`);if(!n.ok)throw new Error("获取知识图谱统计信息失败");return n.json()}async function y2(n){const r=await fetch(`${Wu}/knowledge/search?query=${encodeURIComponent(n)}`);if(!r.ok)throw new Error("搜索知识节点失败");return r.json()}const Kg=u.memo(({data:n})=>e.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[e.jsx(Ic,{type:"target",position:Yc.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:n.content,children:n.label}),e.jsx(Ic,{type:"source",position:Yc.Bottom})]}));Kg.displayName="EntityNode";const Xg=u.memo(({data:n})=>e.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[e.jsx(Ic,{type:"target",position:Yc.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:n.content,children:n.label}),e.jsx(Ic,{type:"source",position:Yc.Bottom})]}));Xg.displayName="ParagraphNode";const w2={entity:Kg,paragraph:Xg};function _2(n,r){const i=new vp.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const d=[],m=[];return n.forEach(x=>{i.setNode(x.id,{width:150,height:50})}),r.forEach(x=>{i.setEdge(x.source,x.target)}),vp.layout(i),n.forEach(x=>{const f=i.node(x.id);d.push({id:x.id,type:x.type,position:{x:f.x-75,y:f.y-25},data:{label:x.content.slice(0,20)+(x.content.length>20?"...":""),content:x.content}})}),r.forEach((x,f)=>{const p={id:`edge-${f}`,source:x.source,target:x.target,animated:n.length<=200&&x.weight>5,style:{strokeWidth:Math.min(x.weight/2,5),opacity:.6}};x.weight>10&&n.length<100&&(p.label=`${x.weight.toFixed(0)}`),m.push(p)}),{nodes:d,edges:m}}function S2(){const n=va(),[r,i]=u.useState(!1),[d,m]=u.useState(null),[x,f]=u.useState(""),[p,g]=u.useState("all"),[b,j]=u.useState(50),[y,N]=u.useState("50"),[k,w]=u.useState(!1),[U,O]=u.useState(!0),[B,Y]=u.useState(!1),[L,z]=u.useState(!1),[K,I,T]=Py([]),[A,te,fe]=Wy([]),[je,pe]=u.useState(0),[he,ve]=u.useState(null),[be,D]=u.useState(null),{toast:J}=$s(),q=u.useCallback(ge=>ge.type==="entity"?"#6366f1":ge.type==="paragraph"?"#10b981":"#6b7280",[]),se=u.useCallback(async(ge=!1)=>{try{if(!ge&&b>200){z(!0);return}i(!0);const[ae,re]=await Promise.all([b2(b,p),N2()]);if(m(re),ae.nodes.length===0){J({title:"提示",description:"知识库为空,请先导入知识数据"}),I([]),te([]);return}const{nodes:F,edges:P}=_2(ae.nodes,ae.edges);I(F),te(P),pe(F.length),re&&re.total_nodes>b&&J({title:"提示",description:`知识图谱包含 ${re.total_nodes} 个节点,当前显示 ${F.length} 个`}),J({title:"加载成功",description:`已加载 ${F.length} 个节点,${P.length} 条边`})}catch(ae){console.error("加载知识图谱失败:",ae),J({title:"加载失败",description:ae instanceof Error?ae.message:"未知错误",variant:"destructive"})}finally{i(!1)}},[b,p,J]),R=u.useCallback(async()=>{if(!x.trim()){J({title:"提示",description:"请输入搜索关键词"});return}try{const ge=await y2(x);if(ge.length===0){J({title:"未找到",description:"没有找到匹配的节点"});return}const ae=new Set(ge.map(re=>re.id));I(re=>re.map(F=>({...F,style:{...F.style,opacity:ae.has(F.id)?1:.3,filter:ae.has(F.id)?"brightness(1.2)":"brightness(0.8)"}}))),J({title:"搜索完成",description:`找到 ${ge.length} 个匹配节点`})}catch(ge){console.error("搜索失败:",ge),J({title:"搜索失败",description:ge instanceof Error?ge.message:"未知错误",variant:"destructive"})}},[x,J]),ue=u.useCallback(()=>{I(ge=>ge.map(ae=>({...ae,style:{...ae.style,opacity:1,filter:"brightness(1)"}})))},[]),me=u.useCallback(()=>{O(!1),Y(!0),se()},[se]),_e=u.useCallback(()=>{z(!1),setTimeout(()=>{se(!0)},0)},[se]),Ce=u.useCallback((ge,ae)=>{K.find(F=>F.id===ae.id)&&ve({id:ae.id,type:ae.type,content:ae.data.content})},[K]);u.useEffect(()=>{U||B&&se()},[b,p,U,B]);const ze=u.useCallback((ge,ae)=>{const re=K.find(Te=>Te.id===ae.source),F=K.find(Te=>Te.id===ae.target),P=A.find(Te=>Te.id===ae.id);re&&F&&P&&D({source:{id:re.id,type:re.type,content:re.data.content},target:{id:F.id,type:F.type,content:F.data.content},edge:{source:ae.source,target:ae.target,weight:parseFloat(ae.label||"0")}})},[K,A]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),d&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(Fc,{className:"h-3 w-3"}),"节点: ",d.total_nodes]}),e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(jg,{className:"h-3 w-3"}),"边: ",d.total_edges]}),e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(Ra,{className:"h-3 w-3"}),"实体: ",d.entity_nodes]}),e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(Sa,{className:"h-3 w-3"}),"段落: ",d.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(ie,{placeholder:"搜索节点内容...",value:x,onChange:ge=>f(ge.target.value),onKeyDown:ge=>ge.key==="Enter"&&R(),className:"flex-1"}),e.jsx(S,{onClick:R,size:"sm",children:e.jsx(Mt,{className:"h-4 w-4"})}),e.jsx(S,{onClick:ue,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Ue,{value:p,onValueChange:ge=>g(ge),children:[e.jsx(Oe,{className:"w-[120px]",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部节点"}),e.jsx(le,{value:"entity",children:"仅实体"}),e.jsx(le,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Ue,{value:b===1e4?"all":k?"custom":b.toString(),onValueChange:ge=>{ge==="custom"?(w(!0),N(b.toString())):ge==="all"?(w(!1),j(1e4)):(w(!1),j(Number(ge)))},children:[e.jsx(Oe,{className:"w-[120px]",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"50",children:"50 节点"}),e.jsx(le,{value:"100",children:"100 节点"}),e.jsx(le,{value:"200",children:"200 节点"}),e.jsx(le,{value:"500",children:"500 节点"}),e.jsx(le,{value:"1000",children:"1000 节点"}),e.jsx(le,{value:"all",children:"全部 (最多10000)"}),e.jsx(le,{value:"custom",children:"自定义..."})]})]}),k&&e.jsx(ie,{type:"number",min:"50",value:y,onChange:ge=>N(ge.target.value),onBlur:()=>{const ge=parseInt(y);!isNaN(ge)&&ge>=50?j(ge):(N("50"),j(50))},onKeyDown:ge=>{if(ge.key==="Enter"){const ae=parseInt(y);!isNaN(ae)&&ae>=50?j(ae):(N("50"),j(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(S,{onClick:()=>se(),variant:"outline",size:"sm",disabled:r,children:e.jsx(zt,{className:$("h-4 w-4",r&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:r?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(zt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):K.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Fc,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),e.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):e.jsxs(e0,{nodes:K,edges:A,onNodesChange:T,onEdgesChange:fe,onNodeClick:Ce,onEdgeClick:ze,nodeTypes:w2,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:je<=500,nodesDraggable:je<=1e3,attributionPosition:"bottom-left",children:[e.jsx(s0,{variant:t0.Dots,gap:12,size:1}),e.jsx(a0,{}),je<=500&&e.jsx(l0,{nodeColor:q,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(n0,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[e.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),e.jsx("span",{children:"实体节点"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),e.jsx("span",{children:"段落节点"})]}),je>200&&e.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[e.jsx("div",{className:"font-semibold",children:"性能模式"}),e.jsx("div",{children:"已禁用动画"}),je>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(qs,{open:!!he,onOpenChange:ge=>!ge&&ve(null),children:e.jsxs(Ls,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Us,{children:e.jsx(Bs,{children:"节点详情"})}),he&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),e.jsx("div",{className:"mt-1",children:e.jsx(Qe,{variant:he.type==="entity"?"default":"secondary",children:he.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),e.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:he.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(Ze,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:he.content})})]})]})]})}),e.jsx(qs,{open:!!be,onOpenChange:ge=>!ge&&D(null),children:e.jsxs(Ls,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Us,{children:e.jsx(Bs,{children:"边详情"})}),be&&e.jsx(Ze,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:be.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[be.source.id.slice(0,40),"..."]})]}),e.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:be.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[be.target.id.slice(0,40),"..."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),e.jsx("div",{className:"mt-1",children:e.jsx(Qe,{variant:"outline",className:"text-base font-mono",children:be.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(hs,{open:U,onOpenChange:O,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"加载知识图谱"}),e.jsxs(cs,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(rs,{children:[e.jsx(ds,{onClick:()=>n({to:"/"}),children:"取消 (返回首页)"}),e.jsx(os,{onClick:me,children:"确认加载"})]})]})}),e.jsx(hs,{open:L,onOpenChange:z,children:e.jsxs(ls,{children:[e.jsxs(ns,{children:[e.jsx(is,{children:"⚠️ 节点数量较多"}),e.jsx(cs,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["您正在尝试加载 ",e.jsx("strong",{className:"text-orange-600",children:b>=1e4?"全部 (最多10000个)":b})," 个节点。"]}),e.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),e.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[e.jsx("li",{children:"页面加载时间较长"}),e.jsx("li",{children:"浏览器卡顿或崩溃"}),e.jsx("li",{children:"系统资源占用过高"})]}),e.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),e.jsxs(rs,{children:[e.jsx(ds,{onClick:()=>{z(!1),b>200&&(j(50),w(!1))},children:"取消"}),e.jsx(os,{onClick:_e,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function bp({className:n,classNames:r,showOutsideDays:i=!0,captionLayout:d="label",buttonVariant:m="ghost",formatters:x,components:f,...p}){const g=_g();return e.jsx(Dy,{showOutsideDays:i,className:$("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,n),captionLayout:d,formatters:{formatMonthDropdown:b=>b.toLocaleString("default",{month:"short"}),...x},classNames:{root:$("w-fit",g.root),months:$("relative flex flex-col gap-4 md:flex-row",g.months),month:$("flex w-full flex-col gap-4",g.month),nav:$("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",g.nav),button_previous:$(ui({variant:m}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",g.button_previous),button_next:$(ui({variant:m}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",g.button_next),month_caption:$("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",g.month_caption),dropdowns:$("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",g.dropdowns),dropdown_root:$("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",g.dropdown_root),dropdown:$("bg-popover absolute inset-0 opacity-0",g.dropdown),caption_label:$("select-none font-medium",d==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",g.caption_label),table:"w-full border-collapse",weekdays:$("flex",g.weekdays),weekday:$("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",g.weekday),week:$("mt-2 flex w-full",g.week),week_number_header:$("w-[--cell-size] select-none",g.week_number_header),week_number:$("text-muted-foreground select-none text-[0.8rem]",g.week_number),day:$("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",g.day),range_start:$("bg-accent rounded-l-md",g.range_start),range_middle:$("rounded-none",g.range_middle),range_end:$("bg-accent rounded-r-md",g.range_end),today:$("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",g.today),outside:$("text-muted-foreground aria-selected:text-muted-foreground",g.outside),disabled:$("text-muted-foreground opacity-50",g.disabled),hidden:$("invisible",g.hidden),...r},components:{Root:({className:b,rootRef:j,...y})=>e.jsx("div",{"data-slot":"calendar",ref:j,className:$(b),...y}),Chevron:({className:b,orientation:j,...y})=>j==="left"?e.jsx(il,{className:$("size-4",b),...y}):j==="right"?e.jsx(Ba,{className:$("size-4",b),...y}):e.jsx(Ll,{className:$("size-4",b),...y}),DayButton:C2,WeekNumber:({children:b,...j})=>e.jsx("td",{...j,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:b})}),...f},...p})}function C2({className:n,day:r,modifiers:i,...d}){const m=_g(),x=u.useRef(null);return u.useEffect(()=>{i.focused&&x.current?.focus()},[i.focused]),e.jsx(S,{ref:x,variant:"ghost",size:"icon","data-day":r.date.toLocaleDateString(),"data-selected-single":i.selected&&!i.range_start&&!i.range_end&&!i.range_middle,"data-range-start":i.range_start,"data-range-end":i.range_end,"data-range-middle":i.range_middle,className:$("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",m.day,n),...d})}const Lc={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function k2(){const[n,r]=u.useState([]),[i,d]=u.useState(""),[m,x]=u.useState("all"),[f,p]=u.useState("all"),[g,b]=u.useState(void 0),[j,y]=u.useState(void 0),[N,k]=u.useState(!0),[w,U]=u.useState(!1),[O,B]=u.useState("xs"),[Y,L]=u.useState(4),z=u.useRef(null);u.useEffect(()=>{const q=tn.getAllLogs();r(q);const se=tn.onLog(()=>{r(tn.getAllLogs())}),R=tn.onConnectionChange(ue=>{U(ue)});return()=>{se(),R()}},[]);const K=u.useMemo(()=>{const q=new Set(n.map(se=>se.module).filter(se=>se&&se.trim()!==""));return Array.from(q).sort()},[n]),I=q=>{switch(q){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},T=q=>{switch(q){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},A=()=>{window.location.reload()},te=()=>{tn.clearLogs(),r([])},fe=()=>{const q=he.map(me=>`${me.timestamp} [${me.level.padEnd(8)}] [${me.module}] ${me.message}`).join(` +`),se=new Blob([q],{type:"text/plain;charset=utf-8"}),R=URL.createObjectURL(se),ue=document.createElement("a");ue.href=R,ue.download=`logs-${ju(new Date,"yyyy-MM-dd-HHmmss")}.txt`,ue.click(),URL.revokeObjectURL(R)},je=()=>{k(!N)},pe=()=>{b(void 0),y(void 0)},he=u.useMemo(()=>n.filter(q=>{const se=i===""||q.message.toLowerCase().includes(i.toLowerCase())||q.module.toLowerCase().includes(i.toLowerCase()),R=m==="all"||q.level===m,ue=f==="all"||q.module===f;let me=!0;if(g||j){const _e=new Date(q.timestamp);if(g){const Ce=new Date(g);Ce.setHours(0,0,0,0),me=me&&_e>=Ce}if(j){const Ce=new Date(j);Ce.setHours(23,59,59,999),me=me&&_e<=Ce}}return se&&R&&ue&&me}),[n,i,m,f,g,j]),ve=Lc[O].rowHeight+Y,be=Bb({count:he.length,getScrollElement:()=>z.current,estimateSize:()=>ve,overscan:50}),D=u.useRef(!1),J=u.useRef(he.length);return u.useEffect(()=>{const q=z.current;if(!q)return;const se=()=>{if(D.current)return;const{scrollTop:R,scrollHeight:ue,clientHeight:me}=q,_e=ue-R-me;_e>100&&N?k(!1):_e<50&&!N&&k(!0)};return q.addEventListener("scroll",se,{passive:!0}),()=>q.removeEventListener("scroll",se)},[N]),u.useEffect(()=>{const q=he.length>J.current;J.current=he.length,N&&he.length>0&&q&&(D.current=!0,be.scrollToIndex(he.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{D.current=!1})}))},[he.length,N,be]),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:$("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",w?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:w?"已连接":"未连接"})]})]}),e.jsx(Fe,{className:"p-3 sm:p-4",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索日志...",value:i,onChange:q=>d(q.target.value),className:"pl-9 h-9 text-sm"})]}),e.jsxs(Ue,{value:m,onValueChange:x,children:[e.jsxs(Oe,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[e.jsx(Ou,{className:"h-4 w-4 mr-2"}),e.jsx(Be,{placeholder:"级别"})]}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部级别"}),e.jsx(le,{value:"DEBUG",children:"DEBUG"}),e.jsx(le,{value:"INFO",children:"INFO"}),e.jsx(le,{value:"WARNING",children:"WARNING"}),e.jsx(le,{value:"ERROR",children:"ERROR"}),e.jsx(le,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Ue,{value:f,onValueChange:p,children:[e.jsxs(Oe,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[e.jsx(Ou,{className:"h-4 w-4 mr-2"}),e.jsx(Be,{placeholder:"模块"})]}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部模块"}),K.map(q=>e.jsx(le,{value:q,children:q},q))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:$("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!g&&"text-muted-foreground"),children:[e.jsx(Zf,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:g?ju(g,"PPP",{locale:Rc}):"开始日期"})]})}),e.jsx(ka,{className:"w-auto p-0",align:"start",children:e.jsx(bp,{mode:"single",selected:g,onSelect:b,initialFocus:!0,locale:Rc})})]}),e.jsxs(La,{children:[e.jsx(Ua,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:$("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!j&&"text-muted-foreground"),children:[e.jsx(Zf,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:j?ju(j,"PPP",{locale:Rc}):"结束日期"})]})}),e.jsx(ka,{className:"w-auto p-0",align:"start",children:e.jsx(bp,{mode:"single",selected:j,onSelect:y,initialFocus:!0,locale:Rc})})]}),(g||j)&&e.jsxs(S,{variant:"outline",size:"sm",onClick:pe,className:"w-full sm:w-auto h-9",children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),e.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(S,{variant:N?"default":"outline",size:"sm",onClick:je,className:"flex-1 sm:flex-none h-9",children:[N?e.jsx(my,{className:"h-4 w-4"}):e.jsx(xy,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:N?"自动滚动":"已暂停"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:A,className:"flex-1 sm:flex-none h-9",children:[e.jsx(zt,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:te,className:"flex-1 sm:flex-none h-9",children:[e.jsx(We,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:fe,className:"flex-1 sm:flex-none h-9",children:[e.jsx(Oa,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),e.jsx("div",{className:"flex-1 hidden sm:block"}),e.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[e.jsxs("span",{className:"font-mono",children:[he.length," / ",n.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(hy,{className:"h-4 w-4"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Lc).map(q=>e.jsx(S,{variant:O===q?"default":"outline",size:"sm",onClick:()=>B(q),className:"h-7 px-3 text-xs",children:Lc[q].label},q))})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[e.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),e.jsx(pa,{value:[Y],onValueChange:([q])=>L(q),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[Y,"px"]})]})]})]})})]}),e.jsx("div",{className:"flex-1 min-h-0 px-3 sm:px-4 lg:px-6 pb-3 sm:pb-4 lg:pb-6",children:e.jsx(Fe,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:z,className:$("h-full overflow-auto","[&::-webkit-scrollbar]:w-2.5","[&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb:hover]:bg-border/80"),children:e.jsx("div",{className:$("p-2 sm:p-3 font-mono relative",Lc[O].class),style:{height:`${be.getTotalSize()}px`},children:he.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):be.getVirtualItems().map(q=>{const se=he[q.index];return e.jsxs("div",{"data-index":q.index,ref:be.measureElement,className:$("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",T(se.level)),style:{transform:`translateY(${q.start}px)`,paddingTop:`${Y/2}px`,paddingBottom:`${Y/2}px`},children:[e.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:se.timestamp}),e.jsxs("span",{className:$("font-semibold",I(se.level)),children:["[",se.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:se.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:se.message})]}),e.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:se.timestamp}),e.jsxs("span",{className:$("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",I(se.level)),children:["[",se.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:se.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:se.message})]})]},q.key)})})})})})]})}const T2="Mai-with-u",E2="plugin-repo",z2="main",A2="plugin_details.json";async function M2(){try{const n=await Se("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:T2,repo:E2,branch:z2,file_path:A2})});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=await n.json();if(!r.success||!r.data)throw new Error(r.error||"获取插件列表失败");return JSON.parse(r.data).filter(m=>!m?.id||!m?.manifest?(console.warn("跳过无效插件数据:",m),!1):!m.manifest.name||!m.manifest.version?(console.warn("跳过缺少必需字段的插件:",m.id),!1):!0).map(m=>({id:m.id,manifest:{manifest_version:m.manifest.manifest_version||1,name:m.manifest.name,version:m.manifest.version,description:m.manifest.description||"",author:m.manifest.author||{name:"Unknown"},license:m.manifest.license||"Unknown",host_application:m.manifest.host_application||{min_version:"0.0.0"},homepage_url:m.manifest.homepage_url,repository_url:m.manifest.repository_url,keywords:m.manifest.keywords||[],categories:m.manifest.categories||[],default_locale:m.manifest.default_locale||"zh-CN",locales_path:m.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(n){throw console.error("Failed to fetch plugin list:",n),n}}async function D2(){try{const n=await Se("/api/webui/plugins/git-status");if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return await n.json()}catch(n){return console.error("Failed to check Git status:",n),{installed:!1,error:"无法检测 Git 安装状态"}}}async function O2(){try{const n=await Se("/api/webui/plugins/version");if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return await n.json()}catch(n){return console.error("Failed to get Maimai version:",n),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function R2(n,r,i){const d=n.split(".").map(p=>parseInt(p)||0),m=d[0]||0,x=d[1]||0,f=d[2]||0;if(i.version_majorparseInt(y)||0),g=p[0]||0,b=p[1]||0,j=p[2]||0;if(i.version_major>g||i.version_major===g&&i.version_minor>b||i.version_major===g&&i.version_minor===b&&i.version_patch>j)return!1}return!0}function L2(n,r){const i=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,m=new WebSocket(`${i}//${d}/api/webui/ws/plugin-progress`);return m.onopen=()=>{console.log("Plugin progress WebSocket connected");const x=setInterval(()=>{m.readyState===WebSocket.OPEN?m.send("ping"):clearInterval(x)},3e4)},m.onmessage=x=>{try{if(x.data==="pong")return;const f=JSON.parse(x.data);n(f)}catch(f){console.error("Failed to parse progress data:",f)}},m.onerror=x=>{console.error("Plugin progress WebSocket error:",x),r?.(x)},m.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},m}async function li(){try{const n=await Se("/api/webui/plugins/installed",{headers:Gs()});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=await n.json();if(!r.success)throw new Error(r.message||"获取已安装插件列表失败");return r.plugins||[]}catch(n){return console.error("Failed to get installed plugins:",n),[]}}function Uc(n,r){return r.some(i=>i.id===n)}function Bc(n,r){const i=r.find(d=>d.id===n);if(i)return i.manifest?.version||i.version}async function U2(n,r,i="main"){const d=await Se("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:n,repository_url:r,branch:i})});if(!d.ok){const m=await d.json();throw new Error(m.detail||"安装失败")}return await d.json()}async function B2(n){const r=await Se("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:n})});if(!r.ok){const i=await r.json();throw new Error(i.detail||"卸载失败")}return await r.json()}async function H2(n,r,i="main"){const d=await Se("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:n,repository_url:r,branch:i})});if(!d.ok){const m=await d.json();throw new Error(m.detail||"更新失败")}return await d.json()}async function q2(n){const r=await Se(`/api/webui/plugins/config/${n}/schema`,{headers:Gs()});if(!r.ok){const d=await r.json();throw new Error(d.detail||"获取配置 Schema 失败")}const i=await r.json();if(!i.success)throw new Error(i.message||"获取配置 Schema 失败");return i.schema}async function G2(n){const r=await Se(`/api/webui/plugins/config/${n}`,{headers:Gs()});if(!r.ok){const d=await r.json();throw new Error(d.detail||"获取配置失败")}const i=await r.json();if(!i.success)throw new Error(i.message||"获取配置失败");return i.config}async function $2(n,r){const i=await Se(`/api/webui/plugins/config/${n}`,{method:"PUT",body:JSON.stringify({config:r})});if(!i.ok){const d=await i.json();throw new Error(d.detail||"保存配置失败")}return await i.json()}async function F2(n){const r=await Se(`/api/webui/plugins/config/${n}/reset`,{method:"POST",headers:Gs()});if(!r.ok){const i=await r.json();throw new Error(i.detail||"重置配置失败")}return await r.json()}async function V2(n){const r=await Se(`/api/webui/plugins/config/${n}/toggle`,{method:"POST",headers:Gs()});if(!r.ok){const i=await r.json();throw new Error(i.detail||"切换状态失败")}return await r.json()}const pi="https://maibot-plugin-stats.maibot-webui.workers.dev";async function Jg(n){try{const r=await fetch(`${pi}/stats/${n}`);return r.ok?await r.json():(console.error("Failed to fetch plugin stats:",r.statusText),null)}catch(r){return console.error("Error fetching plugin stats:",r),null}}async function Q2(n,r){try{const i=r||em(),d=await fetch(`${pi}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n,user_id:i})}),m=await d.json();return d.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:d.ok?{success:!0,...m}:{success:!1,error:m.error||"点赞失败"}}catch(i){return console.error("Error liking plugin:",i),{success:!1,error:"网络错误"}}}async function I2(n,r){try{const i=r||em(),d=await fetch(`${pi}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n,user_id:i})}),m=await d.json();return d.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:d.ok?{success:!0,...m}:{success:!1,error:m.error||"点踩失败"}}catch(i){return console.error("Error disliking plugin:",i),{success:!1,error:"网络错误"}}}async function Y2(n,r,i,d){if(r<1||r>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const m=d||em(),x=await fetch(`${pi}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n,rating:r,comment:i,user_id:m})}),f=await x.json();return x.status===429?{success:!1,error:"每天最多评分 3 次"}:x.ok?{success:!0,...f}:{success:!1,error:f.error||"评分失败"}}catch(m){return console.error("Error rating plugin:",m),{success:!1,error:"网络错误"}}}async function K2(n){try{const r=await fetch(`${pi}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n})}),i=await r.json();return r.status===429?(console.warn("Download recording rate limited"),{success:!0}):r.ok?{success:!0,...i}:(console.error("Failed to record download:",i.error),{success:!1,error:i.error})}catch(r){return console.error("Error recording download:",r),{success:!1,error:"网络错误"}}}function X2(){const n=navigator,r=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,n.deviceMemory||0].join("|");let i=0;for(let d=0;d{x(!0);const B=await Jg(n);B&&d(B),x(!1)};u.useEffect(()=>{k()},[n]);const w=async()=>{const B=await Q2(n);B.success?(N({title:"已点赞",description:"感谢你的支持!"}),k()):N({title:"点赞失败",description:B.error||"未知错误",variant:"destructive"})},U=async()=>{const B=await I2(n);B.success?(N({title:"已反馈",description:"感谢你的反馈!"}),k()):N({title:"操作失败",description:B.error||"未知错误",variant:"destructive"})},O=async()=>{if(f===0){N({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const B=await Y2(n,f,g||void 0);B.success?(N({title:"评分成功",description:"感谢你的评价!"}),y(!1),p(0),b(""),k()):N({title:"评分失败",description:B.error||"未知错误",variant:"destructive"})};return m?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Oa,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nl,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):i?r?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${i.downloads.toLocaleString()}`,children:[e.jsx(Oa,{className:"h-4 w-4"}),e.jsx("span",{children:i.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${i.rating.toFixed(1)} (${i.rating_count} 条评价)`,children:[e.jsx(nl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:i.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${i.likes}`,children:[e.jsx(bu,{className:"h-4 w-4"}),e.jsx("span",{children:i.likes})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Oa,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.downloads.toLocaleString()}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(nl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:i.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[i.rating_count," 条评价"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(bu,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.likes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Pf,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.dislikes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:w,children:[e.jsx(bu,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:U,children:[e.jsx(Pf,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(qs,{open:j,onOpenChange:y,children:[e.jsx(Xu,{asChild:!0,children:e.jsxs(S,{variant:"default",size:"sm",children:[e.jsx(nl,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Ls,{children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"为插件评分"}),e.jsx(Ps,{children:"分享你的使用体验,帮助其他用户"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(B=>e.jsx("button",{onClick:()=>p(B),className:"focus:outline-none",children:e.jsx(nl,{className:`h-8 w-8 transition-colors ${B<=f?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},B))}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[f===0&&"点击星星进行评分",f===1&&"很差",f===2&&"一般",f===3&&"还行",f===4&&"不错",f===5&&"非常好"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),e.jsx(Qs,{value:g,onChange:B=>b(B.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[g.length," / 500"]})]})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>y(!1),children:"取消"}),e.jsx(S,{onClick:O,disabled:f===0,children:"提交评分"})]})]})]})]}),i.recent_ratings&&i.recent_ratings.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),e.jsx("div",{className:"space-y-3",children:i.recent_ratings.map((B,Y)=>e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(L=>e.jsx(nl,{className:`h-3 w-3 ${L<=B.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},L))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(B.created_at).toLocaleDateString()})]}),B.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:B.comment})]},Y))})]})]}):null}const Np={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function Z2(){const n=va(),[r,i]=u.useState(null),[d,m]=u.useState(""),[x,f]=u.useState("all"),[p,g]=u.useState("all"),[b,j]=u.useState(!0),[y,N]=u.useState([]),[k,w]=u.useState(!0),[U,O]=u.useState(null),[B,Y]=u.useState(null),[L,z]=u.useState(null),[K,I]=u.useState(null),[,T]=u.useState([]),[A,te]=u.useState({}),[fe,je]=u.useState(!1),[pe,he]=u.useState(null),[ve,be]=u.useState("main"),[D,J]=u.useState(""),[q,se]=u.useState("preset"),[R,ue]=u.useState(!1),{toast:me}=$s(),_e=async E=>{const xe=E.map(async Q=>{try{const Ne=await Jg(Q.id);return{id:Q.id,stats:Ne}}catch(Ne){return console.warn(`Failed to load stats for ${Q.id}:`,Ne),{id:Q.id,stats:null}}}),Ye=await Promise.all(xe),ke={};Ye.forEach(({id:Q,stats:Ne})=>{Ne&&(ke[Q]=Ne)}),te(ke)};u.useEffect(()=>{let E=null,xe=!1;return(async()=>{if(E=L2(ke=>{xe||(z(ke),ke.stage==="success"?setTimeout(()=>{xe||z(null)},2e3):ke.stage==="error"&&(w(!1),O(ke.error||"加载失败")))},ke=>{console.error("WebSocket error:",ke),xe||me({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(ke=>{if(!E){ke();return}const Q=()=>{E&&E.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ke()):E&&E.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ke()):setTimeout(Q,100)};Q()}),!xe){const ke=await D2();Y(ke),ke.installed||me({title:"Git 未安装",description:ke.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!xe){const ke=await O2();I(ke)}if(!xe)try{w(!0),O(null);const ke=await M2();if(!xe){const Q=await li();T(Q);const Ne=ke.map(qe=>{const Fs=Uc(qe.id,Q),ks=Bc(qe.id,Q);return{...qe,installed:Fs,installed_version:ks}});for(const qe of Q)!Ne.some(ks=>ks.id===qe.id)&&qe.manifest&&Ne.push({id:qe.id,manifest:{manifest_version:qe.manifest.manifest_version||1,name:qe.manifest.name,version:qe.manifest.version,description:qe.manifest.description||"",author:qe.manifest.author,license:qe.manifest.license||"Unknown",host_application:qe.manifest.host_application,homepage_url:qe.manifest.homepage_url,repository_url:qe.manifest.repository_url,keywords:qe.manifest.keywords||[],categories:qe.manifest.categories||[],default_locale:qe.manifest.default_locale||"zh-CN",locales_path:qe.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:qe.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});N(Ne),_e(Ne)}}catch(ke){if(!xe){const Q=ke instanceof Error?ke.message:"加载插件列表失败";O(Q),me({title:"加载失败",description:Q,variant:"destructive"})}}finally{xe||w(!1)}})(),()=>{xe=!0,E&&E.close()}},[me]);const Ce=E=>{if(!E.installed&&K&&!ze(E))return e.jsxs(Qe,{variant:"destructive",className:"gap-1",children:[e.jsx(At,{className:"h-3 w-3"}),"不兼容"]});if(E.installed){const xe=E.installed_version?.trim(),Ye=E.manifest.version?.trim();if(xe!==Ye){const ke=xe?.split(".").map(Number)||[0,0,0],Q=Ye?.split(".").map(Number)||[0,0,0];for(let Ne=0;Ne<3;Ne++){if((Q[Ne]||0)>(ke[Ne]||0))return e.jsxs(Qe,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(At,{className:"h-3 w-3"}),"可更新"]});if((Q[Ne]||0)<(ke[Ne]||0))break}}return e.jsxs(Qe,{variant:"default",className:"gap-1",children:[e.jsx(aa,{className:"h-3 w-3"}),"已安装"]})}return null},ze=E=>!K||!E.manifest?.host_application?!0:R2(E.manifest.host_application.min_version,E.manifest.host_application.max_version,K),ge=E=>{if(!E.installed||!E.installed_version||!E.manifest?.version)return!1;const xe=E.installed_version.trim(),Ye=E.manifest.version.trim();if(xe===Ye)return!1;const ke=xe.split(".").map(Number),Q=Ye.split(".").map(Number);for(let Ne=0;Ne<3;Ne++){if((Q[Ne]||0)>(ke[Ne]||0))return!0;if((Q[Ne]||0)<(ke[Ne]||0))return!1}return!1},ae=y.filter(E=>{if(!E.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",E.id),!1;const xe=d===""||E.manifest.name?.toLowerCase().includes(d.toLowerCase())||E.manifest.description?.toLowerCase().includes(d.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(Ne=>Ne.toLowerCase().includes(d.toLowerCase())),Ye=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x);let ke=!0;p==="installed"?ke=E.installed===!0:p==="updates"&&(ke=E.installed===!0&&ge(E));const Q=!b||!K||ze(E);return xe&&Ye&&ke&&Q}),re=()=>{i(null)},F=E=>{if(!B?.installed){me({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(K&&!ze(E)){me({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}he(E),be("main"),J(""),se("preset"),ue(!1),je(!0)},P=async()=>{if(!pe)return;const E=q==="custom"?D:ve;if(!E||E.trim()===""){me({title:"分支名称不能为空",variant:"destructive"});return}try{je(!1),await U2(pe.id,pe.manifest.repository_url||"",E),K2(pe.id).catch(Ye=>{console.warn("Failed to record download:",Ye)}),me({title:"安装成功",description:`${pe.manifest.name} 已成功安装`});const xe=await li();T(xe),N(Ye=>Ye.map(ke=>{if(ke.id===pe.id){const Q=Uc(ke.id,xe),Ne=Bc(ke.id,xe);return{...ke,installed:Q,installed_version:Ne}}return ke}))}catch(xe){me({title:"安装失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}finally{he(null)}},Te=async E=>{try{await B2(E.id),me({title:"卸载成功",description:`${E.manifest.name} 已成功卸载`});const xe=await li();T(xe),N(Ye=>Ye.map(ke=>{if(ke.id===E.id){const Q=Uc(ke.id,xe),Ne=Bc(ke.id,xe);return{...ke,installed:Q,installed_version:Ne}}return ke}))}catch(xe){me({title:"卸载失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}},Le=async E=>{if(!B?.installed){me({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const xe=await H2(E.id,E.manifest.repository_url||"","main");me({title:"更新成功",description:`${E.manifest.name} 已从 ${xe.old_version} 更新到 ${xe.new_version}`});const Ye=await li();T(Ye),N(ke=>ke.map(Q=>{if(Q.id===E.id){const Ne=Uc(Q.id,Ye),qe=Bc(Q.id,Ye);return{...Q,installed:Ne,installed_version:qe}}return Q}))}catch(xe){me({title:"更新失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs(S,{onClick:()=>n({to:"/plugin-mirrors"}),children:[e.jsx(fy,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),B&&!B.installed&&e.jsxs(Fe,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(ts,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ca,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(as,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(et,{className:"text-orange-800 dark:text-orange-200",children:B.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(xs,{children:e.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",e.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),e.jsx(Fe,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索插件...",value:d,onChange:E=>m(E.target.value),className:"pl-9"})]}),e.jsxs(Ue,{value:x,onValueChange:f,children:[e.jsx(Oe,{className:"w-full sm:w-[200px]",children:e.jsx(Be,{placeholder:"选择分类"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部分类"}),e.jsx(le,{value:"Group Management",children:"群组管理"}),e.jsx(le,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(le,{value:"Utility Tools",children:"实用工具"}),e.jsx(le,{value:"Content Generation",children:"内容生成"}),e.jsx(le,{value:"Multimedia",children:"多媒体"}),e.jsx(le,{value:"External Integration",children:"外部集成"}),e.jsx(le,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(le,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(mt,{id:"compatible-only",checked:b,onCheckedChange:E=>j(E===!0)}),e.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),e.jsx(ga,{value:p,onValueChange:g,className:"w-full",children:e.jsxs(la,{className:"grid w-full grid-cols-3",children:[e.jsxs(ss,{value:"all",children:["全部插件 (",y.filter(E=>{if(!E.manifest)return!1;const xe=d===""||E.manifest.name?.toLowerCase().includes(d.toLowerCase())||E.manifest.description?.toLowerCase().includes(d.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(Q=>Q.toLowerCase().includes(d.toLowerCase())),Ye=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),ke=!b||!K||ze(E);return xe&&Ye&&ke}).length,")"]}),e.jsxs(ss,{value:"installed",children:["已安装 (",y.filter(E=>{if(!E.manifest)return!1;const xe=d===""||E.manifest.name?.toLowerCase().includes(d.toLowerCase())||E.manifest.description?.toLowerCase().includes(d.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(Q=>Q.toLowerCase().includes(d.toLowerCase())),Ye=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),ke=!b||!K||ze(E);return E.installed&&xe&&Ye&&ke}).length,")"]}),e.jsxs(ss,{value:"updates",children:["可更新 (",y.filter(E=>{if(!E.manifest)return!1;const xe=d===""||E.manifest.name?.toLowerCase().includes(d.toLowerCase())||E.manifest.description?.toLowerCase().includes(d.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(Q=>Q.toLowerCase().includes(d.toLowerCase())),Ye=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),ke=!b||!K||ze(E);return E.installed&&ge(E)&&xe&&Ye&&ke}).length,")"]})]})}),L&&L.stage==="loading"&&e.jsx(Fe,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(it,{className:"h-4 w-4 animate-spin"}),e.jsxs("span",{className:"text-sm font-medium",children:[L.operation==="fetch"&&"加载插件列表",L.operation==="install"&&`安装插件${L.plugin_id?`: ${L.plugin_id}`:""}`,L.operation==="uninstall"&&`卸载插件${L.plugin_id?`: ${L.plugin_id}`:""}`,L.operation==="update"&&`更新插件${L.plugin_id?`: ${L.plugin_id}`:""}`]})]}),e.jsxs("span",{className:"text-sm font-medium",children:[L.progress,"%"]})]}),e.jsx(rr,{value:L.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:L.message}),L.operation==="fetch"&&L.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",L.loaded_plugins," / ",L.total_plugins," 个插件"]})]})}),L&&L.stage==="error"&&L.error&&e.jsx(Fe,{className:"border-destructive bg-destructive/10",children:e.jsx(ts,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ca,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(as,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(et,{className:"text-destructive/80",children:L.error})]})]})})}),k?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(it,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):U?e.jsx(Fe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ca,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:U}),e.jsx(S,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):ae.length===0?e.jsx(Fe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Mt,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d||x!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:ae.map(E=>e.jsxs(Fe,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(ts,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(as,{className:"text-xl",children:E.manifest?.name||E.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[E.manifest?.categories&&E.manifest.categories[0]&&e.jsx(Qe,{variant:"secondary",className:"text-xs whitespace-nowrap",children:Np[E.manifest.categories[0]]||E.manifest.categories[0]}),Ce(E)]})]}),e.jsx(et,{className:"line-clamp-2",children:E.manifest?.description||"无描述"})]}),e.jsx(xs,{className:"flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Oa,{className:"h-4 w-4"}),e.jsx("span",{children:(A[E.id]?.downloads??E.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(A[E.id]?.rating??E.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[E.manifest?.keywords&&E.manifest.keywords.slice(0,3).map(xe=>e.jsx(Qe,{variant:"outline",className:"text-xs",children:xe},xe)),E.manifest?.keywords&&E.manifest.keywords.length>3&&e.jsxs(Qe,{variant:"outline",className:"text-xs",children:["+",E.manifest.keywords.length-3]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[e.jsxs("div",{children:["v",E.manifest?.version||"unknown"," · ",E.manifest?.author?.name||"Unknown"]}),E.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[E.manifest.host_application.min_version,E.manifest.host_application.max_version?` - ${E.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(Sg,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>i(E),children:"查看详情"}),E.installed?ge(E)?e.jsxs(S,{size:"sm",disabled:!B?.installed,title:B?.installed?void 0:"Git 未安装",onClick:()=>Le(E),children:[e.jsx(zt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(S,{variant:"destructive",size:"sm",disabled:!B?.installed,title:B?.installed?void 0:"Git 未安装",onClick:()=>Te(E),children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(S,{size:"sm",disabled:!B?.installed||L?.operation==="install"||K!==null&&!ze(E),title:B?.installed?K!==null&&!ze(E)?`不兼容当前版本 (需要 ${E.manifest?.host_application?.min_version||"未知"}${E.manifest?.host_application?.max_version?` - ${E.manifest.host_application.max_version}`:"+"},当前 ${K?.version})`:void 0:"Git 未安装",onClick:()=>F(E),children:[e.jsx(Oa,{className:"h-4 w-4 mr-1"}),L?.operation==="install"&&L?.plugin_id===E.id?"安装中...":"安装"]})]})})]},E.id))}),e.jsx(qs,{open:r!==null,onOpenChange:re,children:r&&r.manifest&&e.jsx(Ls,{className:"max-w-2xl max-h-[80vh] p-0 flex flex-col",children:e.jsx(Ze,{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-6",children:[e.jsx(Us,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(Bs,{className:"text-2xl",children:r.manifest.name}),e.jsxs(Ps,{children:["作者: ",r.manifest.author?.name||"Unknown",r.manifest.author?.url&&e.jsx("a",{href:r.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:e.jsx(Hc,{className:"h-3 w-3 inline"})})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[r.manifest.categories&&r.manifest.categories[0]&&e.jsx(Qe,{variant:"secondary",children:Np[r.manifest.categories[0]]||r.manifest.categories[0]}),Ce(r)]})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(J2,{pluginId:r.id}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"版本"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",r.manifest?.version||"unknown"]}),r.installed&&r.installed_version&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",r.installed_version]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"下载量"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:(A[r.id]?.downloads??r.downloads??0).toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"评分"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(A[r.id]?.rating??r.rating??0).toFixed(1)," (",A[r.id]?.rating_count??r.review_count??0,")"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"许可证"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r.manifest.license||"Unknown"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.manifest.host_application?.min_version||"未知",r.manifest.host_application?.max_version?` - ${r.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.manifest.keywords&&r.manifest.keywords.map(E=>e.jsx(Qe,{variant:"outline",children:E},E))})]}),r.detailed_description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:r.detailed_description})]}),!r.detailed_description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r.manifest.description||"无描述"})]}),e.jsxs("div",{className:"space-y-2",children:[r.manifest.homepage_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"主页: "}),e.jsx("a",{href:r.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:r.manifest.homepage_url})]}),r.manifest.repository_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"仓库: "}),e.jsx("a",{href:r.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:r.manifest.repository_url})]})]})]}),e.jsxs(st,{children:[r.manifest.homepage_url&&e.jsxs(S,{onClick:()=>window.open(r.manifest.homepage_url,"_blank"),children:[e.jsx(Hc,{className:"h-4 w-4 mr-2"}),"访问主页"]}),r.manifest.repository_url&&e.jsxs(S,{variant:"outline",onClick:()=>window.open(r.manifest.repository_url,"_blank"),children:[e.jsx(Hc,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})})}),e.jsx(qs,{open:fe,onOpenChange:je,children:e.jsxs(Ls,{children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"安装插件"}),e.jsxs(Ps,{children:["安装 ",pe?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",pe?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof pe?.manifest.author=="string"?pe.manifest.author:pe?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(mt,{id:"advanced-options",checked:R,onCheckedChange:E=>ue(E)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),R&&e.jsx("div",{className:"space-y-4 p-4 border rounded-lg",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"分支选择"}),e.jsxs(ga,{value:q,onValueChange:E=>se(E),children:[e.jsxs(la,{className:"grid w-full grid-cols-2",children:[e.jsx(ss,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(ss,{value:"custom",className:"text-xs",children:"自定义分支"})]}),q==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Ue,{value:ve,onValueChange:be,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择分支"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"main",children:"main (默认)"}),e.jsx(le,{value:"master",children:"master"}),e.jsx(le,{value:"dev",children:"dev (开发版)"}),e.jsx(le,{value:"develop",children:"develop"}),e.jsx(le,{value:"beta",children:"beta (测试版)"}),e.jsx(le,{value:"stable",children:"stable (稳定版)"})]})]})}),q==="custom"&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("input",{type:"text",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"输入分支名称,例如: feature/new-feature",value:D,onChange:E=>J(E.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!R&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>je(!1),children:"取消"}),e.jsxs(S,{onClick:P,children:[e.jsx(Oa,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})})]})})}function P2(){return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(vg,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(Ze,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(Fe,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(ts,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Ol,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(as,{className:"text-2xl",children:"功能开发中"}),e.jsx(et,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(xs,{children:e.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground",children:"📦 即将推出的功能:"}),e.jsxs("ul",{className:"space-y-2 ml-6",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"浏览社区共享的模型分配预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"一键下载和应用预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"分享自己的模型分配方案"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"预设配置评分和评论系统"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"根据使用场景智能推荐配置"})]})]})]})})]})})})]})}const qu=dN,Gu=uN,$u=mN;function W2({field:n,value:r,onChange:i}){const[d,m]=u.useState(!1);switch(n.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:n.label}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]}),e.jsx($e,{checked:!!r,onCheckedChange:i,disabled:n.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:n.label}),e.jsx(ie,{type:"number",value:r??n.default,onChange:x=>i(parseFloat(x.target.value)||0),min:n.min,max:n.max,step:n.step??1,placeholder:n.placeholder,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:n.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:r??n.default})]}),e.jsx(pa,{value:[r??n.default],onValueChange:x=>i(x[0]),min:n.min??0,max:n.max??100,step:n.step??1,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:n.label}),e.jsxs(Ue,{value:String(r??n.default),onValueChange:i,disabled:n.disabled,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:n.placeholder??"请选择"})}),e.jsx(Re,{children:n.choices?.map(x=>e.jsx(le,{value:String(x),children:String(x)},String(x)))})]}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:n.label}),e.jsx(Qs,{value:r??n.default,onChange:x=>i(x.target.value),placeholder:n.placeholder,rows:n.rows??3,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:n.label}),e.jsxs("div",{className:"relative",children:[e.jsx(ie,{type:d?"text":"password",value:r??"",onChange:x=>i(x.target.value),placeholder:n.placeholder,disabled:n.disabled,className:"pr-10"}),e.jsx(S,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>m(!d),children:d?e.jsx(ci,{className:"h-4 w-4"}):e.jsx(Rt,{className:"h-4 w-4"})})]}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:n.label}),e.jsx(ie,{type:"text",value:r??n.default??"",onChange:x=>i(x.target.value),placeholder:n.placeholder,maxLength:n.max_length,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]})}}function yp({section:n,config:r,onChange:i}){const[d,m]=u.useState(!n.collapsed),x=Object.entries(n.fields).filter(([,f])=>!f.hidden).sort(([,f],[,p])=>f.order-p.order);return e.jsx(qu,{open:d,onOpenChange:m,children:e.jsxs(Fe,{children:[e.jsx(Gu,{asChild:!0,children:e.jsxs(ts,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[d?e.jsx(Ll,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(as,{className:"text-lg",children:n.title})]}),e.jsxs(Qe,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),n.description&&e.jsx(et,{className:"ml-6",children:n.description})]})}),e.jsx($u,{children:e.jsx(xs,{className:"space-y-4 pt-0",children:x.map(([f,p])=>e.jsx(W2,{field:p,value:r[n.name]?.[f],onChange:g=>i(n.name,f,g),sectionName:n.name},f))})})]})})}function e_({plugin:n,onBack:r}){const{toast:i}=$s(),[d,m]=u.useState(null),[x,f]=u.useState({}),[p,g]=u.useState({}),[b,j]=u.useState(!0),[y,N]=u.useState(!1),[k,w]=u.useState(!1),[U,O]=u.useState(!1),B=u.useCallback(async()=>{j(!0);try{const[A,te]=await Promise.all([q2(n.id),G2(n.id)]);m(A),f(te),g(JSON.parse(JSON.stringify(te)))}catch(A){i({title:"加载配置失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}finally{j(!1)}},[n.id,i]);u.useEffect(()=>{B()},[B]),u.useEffect(()=>{w(JSON.stringify(x)!==JSON.stringify(p))},[x,p]);const Y=(A,te,fe)=>{f(je=>({...je,[A]:{...je[A]||{},[te]:fe}}))},L=async()=>{N(!0);try{await $2(n.id,x),g(JSON.parse(JSON.stringify(x))),i({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(A){i({title:"保存失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}finally{N(!1)}},z=async()=>{try{await F2(n.id),i({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),O(!1),B()}catch(A){i({title:"重置失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},K=async()=>{try{const A=await V2(n.id);i({title:A.message,description:A.note}),B()}catch(A){i({title:"切换状态失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}};if(b)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(it,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!d)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(At,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(S,{onClick:r,variant:"outline",children:[e.jsx(er,{className:"h-4 w-4 mr-2"}),"返回"]})]});const I=Object.values(d.sections).sort((A,te)=>A.order-te.order),T=x.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(S,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(er,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:d.plugin_info.name||n.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Qe,{variant:T?"default":"secondary",children:T?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",d.plugin_info.version||n.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:K,children:[e.jsx(hi,{className:"h-4 w-4 mr-2"}),T?"禁用":"启用"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>O(!0),children:[e.jsx($c,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(S,{size:"sm",onClick:L,disabled:!k||y,children:[y?e.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(fi,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),k&&e.jsx(Fe,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(xs,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ra,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),d.layout.type==="tabs"&&d.layout.tabs.length>0?e.jsxs(ga,{defaultValue:d.layout.tabs[0]?.id,children:[e.jsx(la,{children:d.layout.tabs.map(A=>e.jsxs(ss,{value:A.id,children:[A.title,A.badge&&e.jsx(Qe,{variant:"secondary",className:"ml-2 text-xs",children:A.badge})]},A.id))}),d.layout.tabs.map(A=>e.jsx(Ts,{value:A.id,className:"space-y-4 mt-4",children:A.sections.map(te=>{const fe=d.sections[te];return fe?e.jsx(yp,{section:fe,config:x,onChange:Y},te):null})},A.id))]}):e.jsx("div",{className:"space-y-4",children:I.map(A=>e.jsx(yp,{section:A,config:x,onChange:Y},A.name))}),e.jsx(qs,{open:U,onOpenChange:O,children:e.jsxs(Ls,{children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"确认重置配置"}),e.jsx(Ps,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>O(!1),children:"取消"}),e.jsx(S,{variant:"destructive",onClick:z,children:"确认重置"})]})]})})]})}function s_(){const{toast:n}=$s(),[r,i]=u.useState([]),[d,m]=u.useState(!0),[x,f]=u.useState(""),[p,g]=u.useState(null),b=async()=>{m(!0);try{const k=await li();i(k)}catch(k){n({title:"加载插件列表失败",description:k instanceof Error?k.message:"未知错误",variant:"destructive"})}finally{m(!1)}};u.useEffect(()=>{b()},[]);const j=r.filter(k=>{const w=x.toLowerCase();return k.id.toLowerCase().includes(w)||k.manifest.name.toLowerCase().includes(w)||k.manifest.description?.toLowerCase().includes(w)}),y=r.length,N=0;return p?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(e_,{plugin:p,onBack:()=>g(null)})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:b,children:[e.jsx(zt,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(Ol,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(xs,{children:[e.jsx("div",{className:"text-2xl font-bold",children:r.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d?"正在加载...":"个插件"})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"已启用"}),e.jsx(aa,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(xs,{children:[e.jsx("div",{className:"text-2xl font-bold",children:y}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(At,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(xs,{children:[e.jsx("div",{className:"text-2xl font-bold",children:N}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索插件...",value:x,onChange:k=>f(k.target.value),className:"pl-9"})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"已安装的插件"}),e.jsx(et,{children:"点击插件查看和编辑配置"})]}),e.jsx(xs,{children:d?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(it,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(Ol,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:x?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:x?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:j.map(k=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>g(k),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(Ol,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:k.manifest.name}),e.jsxs(Qe,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",k.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:k.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(S,{variant:"ghost",size:"sm",children:e.jsx(ar,{className:"h-4 w-4"})}),e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"})]})]},k.id))})})]})]})})}function t_(){const n=va(),{toast:r}=$s(),[i,d]=u.useState([]),[m,x]=u.useState(!0),[f,p]=u.useState(null),[g,b]=u.useState(null),[j,y]=u.useState(!1),[N,k]=u.useState(!1),[w,U]=u.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=u.useCallback(async()=>{try{x(!0),p(null);const T=localStorage.getItem("access-token"),A=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${T}`}});if(!A.ok)throw new Error("获取镜像源列表失败");const te=await A.json();d(te.mirrors||[])}catch(T){const A=T instanceof Error?T.message:"加载镜像源失败";p(A),r({title:"加载失败",description:A,variant:"destructive"})}finally{x(!1)}},[r]);u.useEffect(()=>{O()},[O]);const B=async()=>{try{const T=localStorage.getItem("access-token"),A=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${T}`,"Content-Type":"application/json"},body:JSON.stringify(w)});if(!A.ok){const te=await A.json();throw new Error(te.detail||"添加镜像源失败")}r({title:"添加成功",description:"镜像源已添加"}),y(!1),U({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(T){r({title:"添加失败",description:T instanceof Error?T.message:"未知错误",variant:"destructive"})}},Y=async()=>{if(g)try{const T=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${g.id}`,{method:"PUT",headers:{Authorization:`Bearer ${T}`,"Content-Type":"application/json"},body:JSON.stringify({name:w.name,raw_prefix:w.raw_prefix,clone_prefix:w.clone_prefix,enabled:w.enabled,priority:w.priority})})).ok)throw new Error("更新镜像源失败");r({title:"更新成功",description:"镜像源已更新"}),k(!1),b(null),O()}catch(T){r({title:"更新失败",description:T instanceof Error?T.message:"未知错误",variant:"destructive"})}},L=async T=>{if(confirm("确定要删除这个镜像源吗?"))try{const A=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${T}`,{method:"DELETE",headers:{Authorization:`Bearer ${A}`}})).ok)throw new Error("删除镜像源失败");r({title:"删除成功",description:"镜像源已删除"}),O()}catch(A){r({title:"删除失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},z=async T=>{try{const A=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${T.id}`,{method:"PUT",headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!T.enabled})})).ok)throw new Error("更新状态失败");O()}catch(A){r({title:"更新失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},K=T=>{b(T),U({id:T.id,name:T.name,raw_prefix:T.raw_prefix,clone_prefix:T.clone_prefix,enabled:T.enabled,priority:T.priority}),k(!0)},I=async(T,A)=>{const te=A==="up"?T.priority-1:T.priority+1;if(!(te<1))try{const fe=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${T.id}`,{method:"PUT",headers:{Authorization:`Bearer ${fe}`,"Content-Type":"application/json"},body:JSON.stringify({priority:te})})).ok)throw new Error("更新优先级失败");O()}catch(fe){r({title:"更新失败",description:fe instanceof Error?fe.message:"未知错误",variant:"destructive"})}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(S,{variant:"ghost",size:"icon",onClick:()=>n({to:"/plugins"}),children:e.jsx(er,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),e.jsxs(S,{onClick:()=>y(!0),children:[e.jsx(dt,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),m?e.jsx(Fe,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(it,{className:"h-8 w-8 animate-spin text-primary"})})}):f?e.jsx(Fe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ca,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:f}),e.jsx(S,{onClick:O,children:"重新加载"})]})}):e.jsxs(Fe,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ut,{children:[e.jsx(Xe,{children:"状态"}),e.jsx(Xe,{children:"名称"}),e.jsx(Xe,{children:"ID"}),e.jsx(Xe,{children:"优先级"}),e.jsx(Xe,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:i.map(T=>e.jsxs(ut,{children:[e.jsx(Ve,{children:e.jsx($e,{checked:T.enabled,onCheckedChange:()=>z(T)})}),e.jsx(Ve,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:T.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",T.raw_prefix]})]})}),e.jsx(Ve,{children:e.jsx(Qe,{variant:"outline",children:T.id})}),e.jsx(Ve,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:T.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(S,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>I(T,"up"),disabled:T.priority===1,children:e.jsx(di,{className:"h-3 w-3"})}),e.jsx(S,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>I(T,"down"),children:e.jsx(Ll,{className:"h-3 w-3"})})]})]})}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(S,{variant:"ghost",size:"icon",onClick:()=>K(T),children:e.jsx(ln,{className:"h-4 w-4"})}),e.jsx(S,{variant:"ghost",size:"icon",onClick:()=>L(T.id),children:e.jsx(We,{className:"h-4 w-4 text-destructive"})})]})})]},T.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:i.map(T=>e.jsx(Fe,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:T.name}),T.enabled&&e.jsx(Qe,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(Qe,{variant:"outline",className:"mt-1 text-xs",children:T.id})]}),e.jsx($e,{checked:T.enabled,onCheckedChange:()=>z(T)})]}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Raw: "}),e.jsx("span",{className:"break-all",children:T.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:T.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(S,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>K(T),children:[e.jsx(ln,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>I(T,"up"),disabled:T.priority===1,children:e.jsx(di,{className:"h-4 w-4"})}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>I(T,"down"),children:e.jsx(Ll,{className:"h-4 w-4"})}),e.jsx(S,{variant:"destructive",size:"sm",onClick:()=>L(T.id),children:e.jsx(We,{className:"h-4 w-4"})})]})]})},T.id))})]}),e.jsx(qs,{open:j,onOpenChange:y,children:e.jsxs(Ls,{className:"max-w-lg",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"添加镜像源"}),e.jsx(Ps,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(ie,{id:"add-id",placeholder:"例如: my-mirror",value:w.id,onChange:T=>U({...w,id:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-name",children:"名称 *"}),e.jsx(ie,{id:"add-name",placeholder:"例如: 我的镜像源",value:w.name,onChange:T=>U({...w,name:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(ie,{id:"add-raw",placeholder:"https://example.com/raw",value:w.raw_prefix,onChange:T=>U({...w,raw_prefix:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(ie,{id:"add-clone",placeholder:"https://example.com/clone",value:w.clone_prefix,onChange:T=>U({...w,clone_prefix:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-priority",children:"优先级"}),e.jsx(ie,{id:"add-priority",type:"number",min:"1",value:w.priority,onChange:T=>U({...w,priority:parseInt(T.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"add-enabled",checked:w.enabled,onCheckedChange:T=>U({...w,enabled:T})}),e.jsx(C,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>y(!1),children:"取消"}),e.jsx(S,{onClick:B,children:"添加"})]})]})}),e.jsx(qs,{open:N,onOpenChange:k,children:e.jsxs(Ls,{className:"max-w-lg",children:[e.jsxs(Us,{children:[e.jsx(Bs,{children:"编辑镜像源"}),e.jsx(Ps,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"镜像源 ID"}),e.jsx(ie,{value:w.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(ie,{id:"edit-name",value:w.name,onChange:T=>U({...w,name:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(ie,{id:"edit-raw",value:w.raw_prefix,onChange:T=>U({...w,raw_prefix:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(ie,{id:"edit-clone",value:w.clone_prefix,onChange:T=>U({...w,clone_prefix:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(ie,{id:"edit-priority",type:"number",min:"1",value:w.priority,onChange:T=>U({...w,priority:parseInt(T.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($e,{id:"edit-enabled",checked:w.enabled,onCheckedChange:T=>U({...w,enabled:T})}),e.jsx(C,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(st,{children:[e.jsx(S,{variant:"outline",onClick:()=>k(!1),children:"取消"}),e.jsx(S,{onClick:Y,children:"保存"})]})]})})]})})}const ni=u.forwardRef(({className:n,...r},i)=>e.jsx(Gp,{ref:i,className:$("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",n),...r}));ni.displayName=Gp.displayName;const a_=u.forwardRef(({className:n,...r},i)=>e.jsx($p,{ref:i,className:$("aspect-square h-full w-full",n),...r}));a_.displayName=$p.displayName;const ri=u.forwardRef(({className:n,...r},i)=>e.jsx(Fp,{ref:i,className:$("flex h-full w-full items-center justify-center rounded-full bg-muted",n),...r}));ri.displayName=Fp.displayName;function l_(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function n_(){const n="maibot_webui_user_id";let r=localStorage.getItem(n);return r||(r=l_(),localStorage.setItem(n,r)),r}function r_(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function i_(n){localStorage.setItem("maibot_webui_user_name",n)}const Zg="maibot_webui_virtual_tabs";function c_(){try{const n=localStorage.getItem(Zg);if(n)return JSON.parse(n)}catch(n){console.error("[Chat] 加载虚拟标签页失败:",n)}return[]}function wp(n){try{localStorage.setItem(Zg,JSON.stringify(n))}catch(r){console.error("[Chat] 保存虚拟标签页失败:",r)}}function o_({segment:n}){switch(n.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(n.data)});case"image":case"emoji":return e.jsx("img",{src:String(n.data),alt:n.type==="emoji"?"表情包":"图片",className:$("rounded-lg max-w-full",n.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:r=>{const i=r.target;i.style.display="none",i.parentElement?.insertAdjacentHTML("beforeend",`[${n.type==="emoji"?"表情包":"图片"}加载失败]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(n.data),className:"max-w-[200px] h-8",children:"您的浏览器不支持音频播放"})});case"video":return e.jsx("video",{controls:!0,src:String(n.data),className:"rounded-lg max-w-full max-h-64",children:"您的浏览器不支持视频播放"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[表情:",String(n.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[音乐分享]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[文件: ",String(n.data),"]"]});case"reply":return e.jsx("span",{className:"text-muted-foreground text-xs",children:"[回复消息]"});case"forward":return e.jsx("span",{className:"text-muted-foreground",children:"[转发消息]"});case"unknown":default:return e.jsxs("span",{className:"text-muted-foreground",children:["[",n.original_type||"未知消息","]"]})}}function d_({message:n,isBot:r}){return n.message_type==="rich"&&n.segments&&n.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:n.segments.map((i,d)=>e.jsx(o_,{segment:i},d))}):e.jsx("span",{className:"whitespace-pre-wrap",children:n.content})}function u_(){const n={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},r=()=>{const He=c_().map(De=>{const Ke=De.virtualConfig;return!Ke.groupId&&Ke.platform&&Ke.userId&&(Ke.groupId=`webui_virtual_group_${Ke.platform}_${Ke.userId}`),{id:De.id,type:"virtual",label:De.label,virtualConfig:Ke,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[n,...He]},[i,d]=u.useState(r),[m,x]=u.useState("webui-default"),f=i.find(X=>X.id===m)||i[0],[p,g]=u.useState(""),[b,j]=u.useState(!1),[y,N]=u.useState(!0),[k,w]=u.useState(r_()),[U,O]=u.useState(!1),[B,Y]=u.useState(""),[L,z]=u.useState(!1),[K,I]=u.useState([]),[T,A]=u.useState([]),[te,fe]=u.useState(!1),[je,pe]=u.useState(!1),[he,ve]=u.useState(""),[be,D]=u.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),J=u.useRef(n_()),q=u.useRef(new Map),se=u.useRef(null),R=u.useRef(new Map),ue=u.useRef(0),me=u.useRef(new Map),{toast:_e}=$s(),Ce=X=>(ue.current+=1,`${X}-${Date.now()}-${ue.current}-${Math.random().toString(36).substr(2,9)}`),ze=u.useCallback((X,He)=>{d(De=>De.map(Ke=>Ke.id===X?{...Ke,...He}:Ke))},[]),ge=u.useCallback((X,He)=>{d(De=>De.map(Ke=>Ke.id===X?{...Ke,messages:[...Ke.messages,He]}:Ke))},[]),ae=u.useCallback(()=>{se.current?.scrollIntoView({behavior:"smooth"})},[]);u.useEffect(()=>{ae()},[f?.messages,ae]);const re=u.useCallback(async()=>{fe(!0);try{const X=await Se("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",X.status,X.headers.get("content-type")),X.ok){const He=X.headers.get("content-type");if(He&&He.includes("application/json")){const De=await X.json();console.log("[Chat] 平台列表数据:",De),I(De.platforms||[])}else{const De=await X.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",De.substring(0,200)),_e({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",X.status),_e({title:"获取平台失败",description:`服务器返回错误: ${X.status}`,variant:"destructive"})}catch(X){console.error("[Chat] 获取平台列表失败:",X),_e({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{fe(!1)}},[_e]),F=u.useCallback(async(X,He)=>{pe(!0);try{const De=new URLSearchParams;X&&De.append("platform",X),He&&De.append("search",He),De.append("limit","50");const Ke=await Se(`/api/chat/persons?${De.toString()}`);if(Ke.ok){const Ns=Ke.headers.get("content-type");if(Ns&&Ns.includes("application/json")){const Je=await Ke.json();A(Je.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(De){console.error("[Chat] 获取用户列表失败:",De)}finally{pe(!1)}},[]);u.useEffect(()=>{be.platform&&F(be.platform,he)},[be.platform,he,F]);const P=u.useCallback(async(X,He)=>{N(!0);try{const De=new URLSearchParams;De.append("user_id",J.current),De.append("limit","50"),He&&De.append("group_id",He);const Ke=`/api/chat/history?${De.toString()}`;console.log("[Chat] 正在加载历史消息:",Ke);const Ns=await Se(Ke);if(Ns.ok){const Je=await Ns.text();try{const Ks=JSON.parse(Je);if(Ks.messages&&Ks.messages.length>0){const ye=Ks.messages.map(Ae=>({id:Ae.id,type:Ae.type,content:Ae.content,timestamp:Ae.timestamp,sender:{name:Ae.sender_name||(Ae.is_bot?"麦麦":"WebUI用户"),user_id:Ae.user_id,is_bot:Ae.is_bot}}));ze(X,{messages:ye});const _s=me.current.get(X)||new Set;ye.forEach(Ae=>{if(Ae.type==="bot"){const vs=`bot-${Ae.content}-${Math.floor(Ae.timestamp*1e3)}`;_s.add(vs)}}),me.current.set(X,_s)}}catch(Ks){console.error("[Chat] JSON 解析失败:",Ks)}}}catch(De){console.error("[Chat] 加载历史消息失败:",De)}finally{N(!1)}},[ze]),Te=u.useCallback((X,He,De)=>{const Ke=q.current.get(X);if(Ke?.readyState===WebSocket.OPEN||Ke?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${X}] WebSocket 已存在,跳过连接`);return}j(!0);const Ns=window.location.protocol==="https:"?"wss:":"ws:",Je=new URLSearchParams;He==="virtual"&&De?(Je.append("user_id",De.userId),Je.append("user_name",De.userName),Je.append("platform",De.platform),Je.append("person_id",De.personId),Je.append("group_name",De.groupName||"WebUI虚拟群聊"),De.groupId&&Je.append("group_id",De.groupId)):(Je.append("user_id",J.current),Je.append("user_name",k));const Ks=`${Ns}//${window.location.host}/api/chat/ws?${Je.toString()}`;console.log(`[Tab ${X}] 正在连接 WebSocket:`,Ks);try{const ye=new WebSocket(Ks);q.current.set(X,ye),ye.onopen=()=>{ze(X,{isConnected:!0}),j(!1),console.log(`[Tab ${X}] WebSocket 已连接`)},ye.onmessage=_s=>{try{const Ae=JSON.parse(_s.data);switch(Ae.type){case"session_info":ze(X,{sessionInfo:{session_id:Ae.session_id,user_id:Ae.user_id,user_name:Ae.user_name,bot_name:Ae.bot_name}});break;case"system":ge(X,{id:Ce("sys"),type:"system",content:Ae.content||"",timestamp:Ae.timestamp||Date.now()/1e3});break;case"user_message":{const vs=Ae.sender?.user_id,bs=He==="virtual"&&De?De.userId:J.current;console.log(`[Tab ${X}] 收到 user_message, sender: ${vs}, current: ${bs}`);const Nt=vs?vs.replace(/^webui_user_/,""):"",Xs=bs?bs.replace(/^webui_user_/,""):"";if(Nt&&Xs&&Nt===Xs){console.log(`[Tab ${X}] 跳过自己的消息(user_id 匹配)`);break}const Ss=me.current.get(X)||new Set,Es=`user-${Ae.content}-${Math.floor((Ae.timestamp||0)*1e3)}`;if(Ss.has(Es)){console.log(`[Tab ${X}] 跳过自己的消息(内容去重)`);break}if(Ss.add(Es),me.current.set(X,Ss),Ss.size>100){const Js=Ss.values().next().value;Js&&Ss.delete(Js)}ge(X,{id:Ae.message_id||Ce("user"),type:"user",content:Ae.content||"",timestamp:Ae.timestamp||Date.now()/1e3,sender:Ae.sender});break}case"bot_message":{ze(X,{isTyping:!1});const vs=me.current.get(X)||new Set,bs=`bot-${Ae.content}-${Math.floor((Ae.timestamp||0)*1e3)}`;if(vs.has(bs))break;if(vs.add(bs),me.current.set(X,vs),vs.size>100){const Nt=vs.values().next().value;Nt&&vs.delete(Nt)}d(Nt=>Nt.map(Xs=>{if(Xs.id!==X)return Xs;const Ss=Xs.messages.filter(Js=>Js.type!=="thinking"),Es={id:Ce("bot"),type:"bot",content:Ae.content||"",message_type:Ae.message_type==="rich"?"rich":"text",segments:Ae.segments,timestamp:Ae.timestamp||Date.now()/1e3,sender:Ae.sender};return{...Xs,messages:[...Ss,Es]}}));break}case"typing":ze(X,{isTyping:Ae.is_typing||!1});break;case"error":d(vs=>vs.map(bs=>{if(bs.id!==X)return bs;const Nt=bs.messages.filter(Xs=>Xs.type!=="thinking");return{...bs,messages:[...Nt,{id:Ce("error"),type:"error",content:Ae.content||"发生错误",timestamp:Ae.timestamp||Date.now()/1e3}]}})),_e({title:"错误",description:Ae.content,variant:"destructive"});break;case"pong":break;case"history":{const vs=Ae.messages||[];if(vs.length>0){const bs=me.current.get(X)||new Set,Nt=vs.map(Xs=>{const Ss=Xs.is_bot||!1,Es=Xs.id||Ce(Ss?"bot":"user"),Js=`${Ss?"bot":"user"}-${Xs.content}-${Math.floor(Xs.timestamp*1e3)}`;return bs.add(Js),{id:Es,type:Ss?"bot":"user",content:Xs.content,timestamp:Xs.timestamp,sender:{name:Xs.sender_name||(Ss?"麦麦":"用户"),user_id:Xs.sender_id,is_bot:Ss}}});me.current.set(X,bs),ze(X,{messages:Nt}),console.log(`[Tab ${X}] 已加载 ${Nt.length} 条历史消息`)}break}default:console.log("未知消息类型:",Ae.type)}}catch(Ae){console.error("解析消息失败:",Ae)}},ye.onclose=()=>{ze(X,{isConnected:!1}),j(!1),q.current.delete(X),console.log(`[Tab ${X}] WebSocket 已断开`);const _s=R.current.get(X);_s&&clearTimeout(_s);const Ae=window.setTimeout(()=>{if(!Le.current){const vs=i.find(bs=>bs.id===X);vs&&Te(X,vs.type,vs.virtualConfig)}},5e3);R.current.set(X,Ae)},ye.onerror=_s=>{console.error(`[Tab ${X}] WebSocket 错误:`,_s),j(!1)}}catch(ye){console.error(`[Tab ${X}] 创建 WebSocket 失败:`,ye),j(!1)}},[k,ze,ge,_e,i]),Le=u.useRef(!1);u.useEffect(()=>{Le.current=!1;const X=q.current,He=R.current,De=me.current;P("webui-default");const Ke=setTimeout(()=>{Le.current||(Te("webui-default","webui"),i.forEach(Je=>{Je.type==="virtual"&&Je.virtualConfig&&(De.set(Je.id,new Set),setTimeout(()=>{Le.current||Te(Je.id,"virtual",Je.virtualConfig)},200))}))},100),Ns=setInterval(()=>{X.forEach(Je=>{Je.readyState===WebSocket.OPEN&&Je.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{Le.current=!0,clearTimeout(Ke),clearInterval(Ns),He.forEach(Je=>{clearTimeout(Je)}),He.clear(),X.forEach(Je=>{Je.close()}),X.clear()}},[]);const E=u.useCallback(()=>{const X=q.current.get(m);if(!p.trim()||!X||X.readyState!==WebSocket.OPEN)return;const He=f?.type==="virtual"&&f.virtualConfig?.userName||k,De=p.trim(),Ke=Date.now()/1e3;X.send(JSON.stringify({type:"message",content:De,user_name:He}));const Ns=me.current.get(m)||new Set,Je=`user-${De}-${Math.floor(Ke*1e3)}`;if(Ns.add(Je),me.current.set(m,Ns),Ns.size>100){const _s=Ns.values().next().value;_s&&Ns.delete(_s)}const Ks={id:Ce("user"),type:"user",content:De,timestamp:Ke,sender:{name:He,is_bot:!1}};ge(m,Ks);const ye={id:Ce("thinking"),type:"thinking",content:"",timestamp:Ke+.001,sender:{name:f?.sessionInfo.bot_name||"麦麦",is_bot:!0}};ge(m,ye),g("")},[p,k,m,f,ge]),xe=X=>{X.key==="Enter"&&!X.shiftKey&&(X.preventDefault(),E())},Ye=()=>{Y(k),O(!0)},ke=()=>{const X=B.trim()||"WebUI用户";w(X),i_(X),O(!1);const He=q.current.get(m);He?.readyState===WebSocket.OPEN&&He.send(JSON.stringify({type:"update_nickname",user_name:X}))},Q=()=>{Y(""),O(!1)},Ne=X=>new Date(X*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),qe=()=>{const X=q.current.get(m);X&&(X.close(),q.current.delete(m)),Te(m,f?.type||"webui",f?.virtualConfig)},Fs=()=>{D({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),ve(""),re(),z(!0)},ks=()=>{if(!be.platform||!be.personId){_e({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const X=`webui_virtual_group_${be.platform}_${be.userId}`,He=`virtual-${be.platform}-${be.userId}-${Date.now()}`,De=be.userName||be.userId,Ke={id:He,type:"virtual",label:De,virtualConfig:{...be,groupId:X},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};d(Ns=>{const Je=[...Ns,Ke],Ks=Je.filter(ye=>ye.type==="virtual"&&ye.virtualConfig).map(ye=>({id:ye.id,label:ye.label,virtualConfig:ye.virtualConfig,createdAt:Date.now()}));return wp(Ks),Je}),x(He),z(!1),me.current.set(He,new Set),setTimeout(()=>{Te(He,"virtual",be)},100),_e({title:"虚拟身份标签页",description:`已创建 ${De} 的对话`})},xt=(X,He)=>{if(He?.stopPropagation(),X==="webui-default")return;const De=q.current.get(X);De&&(De.close(),q.current.delete(X));const Ke=R.current.get(X);Ke&&(clearTimeout(Ke),R.current.delete(X)),me.current.delete(X),d(Ns=>{const Je=Ns.filter(ye=>ye.id!==X),Ks=Je.filter(ye=>ye.type==="virtual"&&ye.virtualConfig).map(ye=>({id:ye.id,label:ye.label,virtualConfig:ye.virtualConfig,createdAt:Date.now()}));return wp(Ks),Je}),m===X&&x("webui-default")},js=X=>{x(X)},Vs=X=>{D(He=>({...He,personId:X.person_id,userId:X.user_id,userName:X.nickname||X.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(qs,{open:L,onOpenChange:z,children:e.jsxs(Ls,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Us,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(Nu,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(Ps,{children:"选择一个麦麦已认识的用户,以该用户的身份与麦麦对话。麦麦将使用她对该用户的记忆和认知来回应。"})]}),e.jsxs("div",{className:"space-y-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(Ru,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Ue,{value:be.platform,onValueChange:X=>{D(He=>({...He,platform:X,personId:"",userId:"",userName:""})),A([])},children:[e.jsx(Oe,{disabled:te,children:e.jsx(Be,{placeholder:te?"加载中...":"选择平台"})}),e.jsx(Re,{children:K.map(X=>e.jsxs(le,{value:X.platform,children:[X.platform," (",X.count," 人)"]},X.platform))})]})]}),be.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(Lu,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索用户名...",value:he,onChange:X=>ve(X.target.value),className:"pl-9"})]}),e.jsx(Ze,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:je?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(it,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(Lu,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:T.map(X=>e.jsxs("button",{onClick:()=>Vs(X),className:$("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",be.personId===X.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(ni,{className:"h-8 w-8 shrink-0",children:e.jsx(ri,{className:$("text-xs",be.personId===X.person_id?"bg-primary-foreground/20":"bg-muted"),children:(X.nickname||X.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:X.nickname||X.person_name}),e.jsxs("div",{className:$("text-xs truncate",be.personId===X.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",X.user_id,X.is_known&&" · 已认识"]})]})]},X.person_id))})})})]}),be.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"虚拟群名(可选)"}),e.jsx(ie,{placeholder:"WebUI虚拟群聊",value:be.groupName,onChange:X=>D(He=>({...He,groupName:X.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(st,{className:"gap-2 sm:gap-0",children:[e.jsx(S,{variant:"outline",onClick:()=>z(!1),children:"取消"}),e.jsx(S,{onClick:ks,disabled:!be.platform||!be.personId,children:"创建对话"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[i.map(X=>e.jsxs("div",{className:$("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",m===X.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>js(X.id),children:[X.type==="webui"?e.jsx(Rl,{className:"h-3.5 w-3.5"}):e.jsx(Nu,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:X.label}),e.jsx("span",{className:$("w-1.5 h-1.5 rounded-full",X.isConnected?"bg-green-500":"bg-muted-foreground/50")}),X.id!=="webui-default"&&e.jsx("span",{onClick:He=>xt(X.id,He),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:He=>{(He.key==="Enter"||He.key===" ")&&(He.preventDefault(),xt(X.id,He))},children:e.jsx(rl,{className:"h-3 w-3"})})]},X.id)),e.jsx("button",{onClick:Fs,className:"flex items-center gap-1 px-2 py-1.5 rounded-md text-sm text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"新建虚拟身份对话",children:e.jsx(dt,{className:"h-3.5 w-3.5"})})]})})}),e.jsx("div",{className:"shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx(ni,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(ri,{className:"bg-primary/10 text-primary",children:e.jsx(ti,{className:"h-4 w-4 sm:h-5 sm:w-5"})})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:f?.sessionInfo.bot_name||"麦麦"}),e.jsx("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:f?.isConnected?e.jsxs(e.Fragment,{children:[e.jsx(py,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):b?e.jsxs(e.Fragment,{children:[e.jsx(it,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(gy,{className:"h-3 w-3 text-red-500"}),e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"未连接"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[y&&e.jsx(it,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(S,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:qe,disabled:b,title:"重新连接",children:e.jsx(zt,{className:$("h-4 w-4",b&&"animate-spin")})})]})]}),e.jsx("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:f?.type==="virtual"&&f.virtualConfig?e.jsxs(e.Fragment,{children:[e.jsx(Nu,{className:"h-3 w-3 text-primary"}),e.jsx("span",{children:"虚拟身份:"}),e.jsx("span",{className:"font-medium text-primary",children:f.virtualConfig.userName}),e.jsxs("span",{className:"text-xs",children:["(",f.virtualConfig.platform,")"]}),f.virtualConfig.groupName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1",children:"·"}),e.jsxs("span",{className:"text-xs",children:["群:",f.virtualConfig.groupName]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Qc,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),U?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{value:B,onChange:X=>Y(X.target.value),onKeyDown:X=>{X.key==="Enter"&&ke(),X.key==="Escape"&&Q()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:ke,children:"保存"}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Q,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:k}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:Ye,title:"修改昵称",children:e.jsx(jy,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[f?.messages.length===0&&!y&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(ti,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",f?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),f?.messages.map(X=>e.jsxs("div",{className:$("flex gap-2 sm:gap-3",X.type==="user"&&"flex-row-reverse",X.type==="system"&&"justify-center",X.type==="error"&&"justify-center"),children:[X.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:X.content}),X.type==="error"&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:X.content}),X.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(ni,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(ri,{className:"bg-primary/10 text-primary",children:e.jsx(ti,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:"flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",children:[e.jsx("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:e.jsx("span",{className:"hidden sm:inline",children:X.sender?.name||f?.sessionInfo.bot_name})}),e.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"思考中..."})]})})]})]}),(X.type==="user"||X.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(ni,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(ri,{className:$("text-xs",X.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:X.type==="bot"?e.jsx(ti,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(Qc,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:$("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",X.type==="user"&&"items-end"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:X.sender?.name||(X.type==="bot"?f?.sessionInfo.bot_name:k)}),e.jsx("span",{children:Ne(X.timestamp)})]}),e.jsx("div",{className:$("rounded-2xl px-3 py-2 text-sm break-words",X.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(d_,{message:X,isBot:X.type==="bot"})})]})]})]},X.id)),e.jsx("div",{ref:se})]})})}),e.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{value:p,onChange:X=>g(X.target.value),onKeyDown:xe,placeholder:f?.isConnected?"输入消息...":"等待连接...",disabled:!f?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(S,{onClick:E,disabled:!f?.isConnected||!p.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(vy,{className:"h-4 w-4"})})]})})})]})}var sm="Radio",[m_,Pg]=lg(sm),[x_,h_]=m_(sm),Wg=u.forwardRef((n,r)=>{const{__scopeRadio:i,name:d,checked:m=!1,required:x,disabled:f,value:p="on",onCheck:g,form:b,...j}=n,[y,N]=u.useState(null),k=Fu(r,O=>N(O)),w=u.useRef(!1),U=y?b||!!y.closest("form"):!0;return e.jsxs(x_,{scope:i,checked:m,disabled:f,children:[e.jsx(Xc.button,{type:"button",role:"radio","aria-checked":m,"data-state":aj(m),"data-disabled":f?"":void 0,disabled:f,value:p,...j,ref:k,onClick:Du(n.onClick,O=>{m||g?.(),U&&(w.current=O.isPropagationStopped(),w.current||O.stopPropagation())})}),U&&e.jsx(tj,{control:y,bubbles:!w.current,name:d,value:p,checked:m,required:x,disabled:f,form:b,style:{transform:"translateX(-100%)"}})]})});Wg.displayName=sm;var ej="RadioIndicator",sj=u.forwardRef((n,r)=>{const{__scopeRadio:i,forceMount:d,...m}=n,x=h_(ej,i);return e.jsx(BN,{present:d||x.checked,children:e.jsx(Xc.span,{"data-state":aj(x.checked),"data-disabled":x.disabled?"":void 0,...m,ref:r})})});sj.displayName=ej;var f_="RadioBubbleInput",tj=u.forwardRef(({__scopeRadio:n,control:r,checked:i,bubbles:d=!0,...m},x)=>{const f=u.useRef(null),p=Fu(f,x),g=HN(i),b=qN(r);return u.useEffect(()=>{const j=f.current;if(!j)return;const y=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(y,"checked").set;if(g!==i&&k){const w=new Event("click",{bubbles:d});k.call(j,i),j.dispatchEvent(w)}},[g,i,d]),e.jsx(Xc.input,{type:"radio","aria-hidden":!0,defaultChecked:i,...m,tabIndex:-1,ref:p,style:{...m.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});tj.displayName=f_;function aj(n){return n?"checked":"unchecked"}var p_=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],no="RadioGroup",[g_]=lg(no,[Vp,Pg]),lj=Vp(),nj=Pg(),[j_,v_]=g_(no),rj=u.forwardRef((n,r)=>{const{__scopeRadioGroup:i,name:d,defaultValue:m,value:x,required:f=!1,disabled:p=!1,orientation:g,dir:b,loop:j=!0,onValueChange:y,...N}=n,k=lj(i),w=LN(b),[U,O]=UN({prop:x,defaultProp:m??null,onChange:y,caller:no});return e.jsx(j_,{scope:i,name:d,required:f,disabled:p,value:U,onValueChange:O,children:e.jsx(xN,{asChild:!0,...k,orientation:g,dir:w,loop:j,children:e.jsx(Xc.div,{role:"radiogroup","aria-required":f,"aria-orientation":g,"data-disabled":p?"":void 0,dir:w,...N,ref:r})})})});rj.displayName=no;var ij="RadioGroupItem",cj=u.forwardRef((n,r)=>{const{__scopeRadioGroup:i,disabled:d,...m}=n,x=v_(ij,i),f=x.disabled||d,p=lj(i),g=nj(i),b=u.useRef(null),j=Fu(r,b),y=x.value===m.value,N=u.useRef(!1);return u.useEffect(()=>{const k=U=>{p_.includes(U.key)&&(N.current=!0)},w=()=>N.current=!1;return document.addEventListener("keydown",k),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",k),document.removeEventListener("keyup",w)}},[]),e.jsx(hN,{asChild:!0,...p,focusable:!f,active:y,children:e.jsx(Wg,{disabled:f,required:x.required,checked:y,...g,...m,name:x.name,ref:j,onCheck:()=>x.onValueChange(m.value),onKeyDown:Du(k=>{k.key==="Enter"&&k.preventDefault()}),onFocus:Du(m.onFocus,()=>{N.current&&b.current?.click()})})})});cj.displayName=ij;var b_="RadioGroupIndicator",oj=u.forwardRef((n,r)=>{const{__scopeRadioGroup:i,...d}=n,m=nj(i);return e.jsx(sj,{...m,...d,ref:r})});oj.displayName=b_;var dj=rj,uj=cj,N_=oj;const mj=u.forwardRef(({className:n,...r},i)=>e.jsx(dj,{className:$("grid gap-2",n),...r,ref:i}));mj.displayName=dj.displayName;const xj=u.forwardRef(({className:n,...r},i)=>e.jsx(uj,{ref:i,className:$("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",n),...r,children:e.jsx(N_,{className:"flex items-center justify-center",children:e.jsx(by,{className:"h-2.5 w-2.5 fill-current text-current"})})}));xj.displayName=uj.displayName;function y_({question:n,value:r,onChange:i,error:d,disabled:m=!1}){const[x,f]=u.useState(null),p=m||n.readOnly,g=()=>{switch(n.type){case"single":return e.jsx(mj,{value:r||"",onValueChange:i,disabled:p,className:"space-y-2",children:n.options?.map(b=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(xj,{value:b.value,id:`${n.id}-${b.id}`}),e.jsx(C,{htmlFor:`${n.id}-${b.id}`,className:"cursor-pointer font-normal",children:b.label})]},b.id))});case"multiple":{const b=r||[];return e.jsxs("div",{className:"space-y-2",children:[n.options?.map(j=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(mt,{id:`${n.id}-${j.id}`,checked:b.includes(j.value),disabled:p||n.maxSelections!==void 0&&b.length>=n.maxSelections&&!b.includes(j.value),onCheckedChange:y=>{i(y?[...b,j.value]:b.filter(N=>N!==j.value))}}),e.jsx(C,{htmlFor:`${n.id}-${j.id}`,className:"cursor-pointer font-normal",children:j.label})]},j.id)),n.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",n.maxSelections," 项"]})]})}case"text":return e.jsx(ie,{value:r||"",onChange:b=>i(b.target.value),placeholder:n.placeholder||"请输入...",disabled:p,readOnly:n.readOnly,maxLength:n.maxLength,className:$(n.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(Qs,{value:r||"",onChange:b=>i(b.target.value),placeholder:n.placeholder||"请输入...",disabled:p,readOnly:n.readOnly,maxLength:n.maxLength,rows:4,className:$(n.readOnly&&"bg-muted cursor-not-allowed")}),n.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(r||"").length," / ",n.maxLength]})]});case"rating":{const b=r||0,j=x!==null?x:b;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(y=>e.jsx("button",{type:"button",disabled:p,className:$("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",p&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!p&&f(y),onMouseLeave:()=>f(null),onClick:()=>!p&&i(y),children:e.jsx(nl,{className:$("h-6 w-6 transition-colors",y<=j?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},y)),b>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[b," / 5"]})]})}case"scale":{const b=n.min??1,j=n.max??10,y=n.step??1,N=r??b;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(pa,{value:[N],onValueChange:([k])=>i(k),min:b,max:j,step:y,disabled:p}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:n.minLabel||b}),e.jsx("span",{className:"font-medium text-foreground",children:N}),e.jsx("span",{children:n.maxLabel||j})]})]})}case"dropdown":return e.jsxs(Ue,{value:r||"",onValueChange:i,disabled:p,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:n.placeholder||"请选择..."})}),e.jsx(Re,{children:n.options?.map(b=>e.jsx(le,{value:b.value,children:b.label},b.id))})]});default:return e.jsx("div",{className:"text-muted-foreground",children:"不支持的问题类型"})}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-base font-medium",children:[n.title,n.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),n.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]}),g(),d&&e.jsx("p",{className:"text-sm text-destructive",children:d})]})}const hj="https://maibot-plugin-stats.maibot-webui.workers.dev";function fj(){const n="maibot_user_id";let r=localStorage.getItem(n);if(!r){const i=Math.random().toString(36).substring(2,10),d=Date.now().toString(36),m=Math.random().toString(36).substring(2,10);r=`fp_${i}_${d}_${m}`,localStorage.setItem(n,r)}return r}async function w_(n,r,i,d){try{const m=d?.userId||fj(),x={surveyId:n,surveyVersion:r,userId:m,answers:i,submittedAt:new Date().toISOString(),allowMultiple:d?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},f=await fetch(`${hj}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}),p=await f.json();return f.status===429?{success:!1,error:"提交过于频繁,请稍后再试"}:f.status===409?{success:!1,error:p.error||"你已经提交过这份问卷了"}:f.ok?{success:!0,submissionId:p.submissionId,message:p.message}:{success:!1,error:p.error||"提交失败"}}catch(m){return console.error("Error submitting survey:",m),{success:!1,error:"网络错误"}}}async function __(n,r){try{const i=r||fj(),d=new URLSearchParams({user_id:i,survey_id:n}),m=await fetch(`${hj}/survey/check?${d}`);return m.ok?{success:!0,hasSubmitted:(await m.json()).hasSubmitted}:{success:!1,error:(await m.json()).error||"检查失败"}}catch(i){return console.error("Error checking submission:",i),{success:!1,error:"网络错误"}}}function pj({config:n,initialAnswers:r,onSubmitSuccess:i,onSubmitError:d,showProgress:m=!0,paginateQuestions:x=!1,className:f}){const p=u.useCallback(()=>!r||r.length===0?{}:r.reduce((q,se)=>(q[se.questionId]=se.value,q),{}),[r]),[g,b]=u.useState(()=>p()),[j,y]=u.useState({}),[N,k]=u.useState(0),[w,U]=u.useState(!1),[O,B]=u.useState(!1),[Y,L]=u.useState(null),[z,K]=u.useState(null),[I,T]=u.useState(!1),[A,te]=u.useState(!0);u.useEffect(()=>{r&&r.length>0&&b(q=>({...q,...p()}))},[r,p]),u.useEffect(()=>{(async()=>{if(!n.settings?.allowMultiple){const se=await __(n.id);se.success&&se.hasSubmitted&&T(!0)}te(!1)})()},[n.id,n.settings?.allowMultiple]);const fe=u.useCallback(()=>{const q=new Date;return!(n.settings?.startTime&&new Date(n.settings.startTime)>q||n.settings?.endTime&&new Date(n.settings.endTime){const se=g[q.id];return se==null?!1:Array.isArray(se)?se.length>0:typeof se=="string"?se.trim()!=="":!0}).length,pe=je/n.questions.length*100,he=u.useCallback((q,se)=>{b(R=>({...R,[q]:se})),y(R=>{const ue={...R};return delete ue[q],ue})},[]),ve=u.useCallback(()=>{const q={};for(const se of n.questions){if(se.required){const R=g[se.id];if(R==null){q[se.id]="此题为必填项";continue}if(Array.isArray(R)&&R.length===0){q[se.id]="请至少选择一项";continue}if(typeof R=="string"&&R.trim()===""){q[se.id]="此题为必填项";continue}}se.minLength&&typeof g[se.id]=="string"&&g[se.id].length{if(!ve()){if(x){const q=n.questions.findIndex(se=>j[se.id]);q>=0&&k(q)}return}U(!0),L(null);try{const q=n.questions.filter(R=>g[R.id]!==void 0).map(R=>({questionId:R.id,value:g[R.id]})),se=await w_(n.id,n.version,q,{allowMultiple:n.settings?.allowMultiple});if(se.success&&se.submissionId)B(!0),K(se.submissionId),i?.(se.submissionId);else{const R=se.error||"提交失败";L(R),d?.(R)}}catch(q){const se=q instanceof Error?q.message:"提交失败";L(se),d?.(se)}finally{U(!1)}},[ve,x,n,g,j,i,d]),D=u.useCallback(q=>{q>=0&&qe.jsxs("div",{className:$("p-4 rounded-lg border bg-card",j[q.id]?"border-destructive bg-destructive/5":"border-border"),children:[x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",N+1," / ",n.questions.length]}),!x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[se+1,"."]}),e.jsx(y_,{question:q,value:g[q.id],onChange:R=>he(q.id,R),error:j[q.id],disabled:w})]},q.id)),Y&&e.jsxs(It,{variant:"destructive",children:[e.jsx(At,{className:"h-4 w-4"}),e.jsx(Yt,{children:Y})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(S,{variant:"outline",onClick:()=>D(N-1),disabled:N===0||w,children:[e.jsx(il,{className:"h-4 w-4 mr-1"}),"上一题"]}),N===n.questions.length-1?e.jsxs(S,{onClick:be,disabled:w,children:[w&&e.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(S,{onClick:()=>D(N+1),disabled:w,children:["下一题",e.jsx(Ba,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(j).length>0&&e.jsxs("span",{className:"text-destructive",children:["还有 ",Object.keys(j).length," 个必填项未完成"]})}),e.jsxs(S,{onClick:be,disabled:w,size:"lg",children:[w&&e.jsx(it,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const S_={id:"webui-feedback-v1",version:"1.0.0",title:"麦麦 WebUI 使用反馈问卷",description:"感谢您使用麦麦 WebUI!您的反馈将帮助我们不断改进产品体验。",questions:[{id:"webui_version",type:"text",title:"你正在使用的 WebUI 版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"ui_design_satisfaction",type:"single",title:"你觉得当前的 WebUI 界面设计如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"problems_encountered",type:"multiple",title:"你在使用 WebUI 时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"lag",label:"界面卡顿",value:"lag"},{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"complex",label:"操作复杂",value:"complex"},{id:"bugs",label:"存在 Bug",value:"bugs"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"useful_features",type:"textarea",title:"你觉得哪些功能是最有用的?",required:!0,placeholder:"请分享你认为最有价值的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦 WebUI 的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦 WebUI 给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},C_={id:"maibot-feedback-v1",version:"1.0.0",title:"麦麦使用体验反馈问卷",description:"感谢您使用麦麦!您的反馈将帮助我们打造更好的 AI 伙伴。",questions:[{id:"maibot_version",type:"text",title:"你正在使用的麦麦版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"improvement_areas",type:"textarea",title:"你认为麦麦还有哪些部分可以改进?",required:!0,placeholder:"请分享你认为可以改进的方面...",maxLength:1e3},{id:"problems_encountered",type:"multiple",title:"你在使用麦麦时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"slow_response",label:"响应速度慢",value:"slow_response"},{id:"complex",label:"操作复杂",value:"complex"},{id:"unstable",label:"运行不稳定",value:"unstable"},{id:"config_difficult",label:"配置困难",value:"config_difficult"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"helpful_features",type:"textarea",title:"你觉得麦麦的哪些功能对你最有帮助?",required:!0,placeholder:"请分享对你最有帮助的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对麦麦的成长非常重要,我们会认真考虑每一条建议。"}};function k_(){const[n,r]=u.useState(null),[i,d]=u.useState(!0);u.useEffect(()=>{const p=JSON.parse(JSON.stringify(S_));r(p),d(!1)},[]);const m=u.useMemo(()=>[{questionId:"webui_version",value:`v${Zc}`}],[]),x=u.useCallback(p=>{console.log("WebUI Survey submitted:",p)},[]),f=u.useCallback(p=>{console.error("WebUI Survey submission error:",p)},[]);return i?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(it,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(bg,{className:"h-8 w-8",strokeWidth:2}),"WebUI 使用反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们持续改进产品体验"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(pj,{config:n,initialAnswers:m,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:x,onSubmitError:f})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(It,{variant:"destructive",className:"max-w-md",children:[e.jsx(At,{className:"h-4 w-4"}),e.jsx(Yt,{children:"无法加载问卷配置"})]}),e.jsx(S,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function T_(){const[n,r]=u.useState(null),[i,d]=u.useState(!0),[m,x]=u.useState("未知版本");u.useEffect(()=>{(async()=>{try{const y=await Lg();x(y.version||"未知版本")}catch(y){console.error("Failed to get MaiBot version:",y),x("获取失败")}const j=JSON.parse(JSON.stringify(C_));r(j),d(!1)})()},[]);const f=u.useMemo(()=>[{questionId:"maibot_version",value:m}],[m]),p=u.useCallback(b=>{console.log("MaiBot Survey submitted:",b)},[]),g=u.useCallback(b=>{console.error("MaiBot Survey submission error:",b)},[]);return i?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(it,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(bg,{className:"h-8 w-8",strokeWidth:2}),"麦麦使用体验反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们打造更好的 AI 伙伴"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(pj,{config:n,initialAnswers:f,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:p,onSubmitError:g})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(It,{variant:"destructive",className:"max-w-md",children:[e.jsx(At,{className:"h-4 w-4"}),e.jsx(Yt,{children:"无法加载问卷配置"})]}),e.jsx(S,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function E_(){const n=va(),[r,i]=u.useState(!0);return u.useEffect(()=>{let d=!1;return(async()=>{try{const x=await Ju();!d&&!x&&n({to:"/auth"})}catch{d||n({to:"/auth"})}finally{d||i(!1)}})(),()=>{d=!0}},[n]),{checking:r}}async function z_(){return await Ju()}const A_=tr("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),gj=u.forwardRef(({className:n,size:r,abbrTitle:i,children:d,...m},x)=>e.jsx("kbd",{className:$(A_({size:r,className:n})),ref:x,...m,children:i?e.jsx("abbr",{title:i,children:d}):d}));gj.displayName="Kbd";const M_=[{icon:Jc,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Sa,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Ng,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:yg,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Vu,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Rl,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:wg,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:sr,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:Ny,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Ol,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Qu,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:ar,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function D_({open:n,onOpenChange:r}){const[i,d]=u.useState(""),[m,x]=u.useState(0),f=va(),p=M_.filter(j=>j.title.toLowerCase().includes(i.toLowerCase())||j.description.toLowerCase().includes(i.toLowerCase())||j.category.toLowerCase().includes(i.toLowerCase()));u.useEffect(()=>{n&&(d(""),x(0))},[n]);const g=u.useCallback(j=>{f({to:j}),r(!1)},[f,r]),b=u.useCallback(j=>{j.key==="ArrowDown"?(j.preventDefault(),x(y=>(y+1)%p.length)):j.key==="ArrowUp"?(j.preventDefault(),x(y=>(y-1+p.length)%p.length)):j.key==="Enter"&&p[m]&&(j.preventDefault(),g(p[m].path))},[p,m,g]);return e.jsx(qs,{open:n,onOpenChange:r,children:e.jsxs(Ls,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Us,{className:"px-4 pt-4 pb-0",children:[e.jsx(Bs,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(ie,{value:i,onChange:j=>{d(j.target.value),x(0)},onKeyDown:b,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(Ze,{className:"h-[400px]",children:p.length>0?e.jsx("div",{className:"p-2",children:p.map((j,y)=>{const N=j.icon;return e.jsxs("button",{onClick:()=>g(j.path),onMouseEnter:()=>x(y),className:$("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",y===m?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(N,{className:"h-5 w-5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm",children:j.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:j.description})]}),e.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:j.category})]},j.path)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Mt,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),e.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}const O_=$N,R_=FN,L_=VN,jj=u.forwardRef(({className:n,sideOffset:r=4,...i},d)=>e.jsx(GN,{children:e.jsx(ng,{ref:d,sideOffset:r,className:$("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]",n),...i})}));jj.displayName=ng.displayName;function U_({children:n}){const{checking:r}=E_(),[i,d]=u.useState(!0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),{theme:g,setTheme:b}=Yu(),j=Hb();if(u.useEffect(()=>{const U=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),p(!0))};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[]),r)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const y=[{title:"概览",items:[{icon:Jc,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Sa,label:"麦麦主程序配置",path:"/config/bot"},{icon:Ng,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:yg,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:Wf,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Vu,label:"表情包管理",path:"/resource/emoji"},{icon:Rl,label:"表达方式管理",path:"/resource/expression"},{icon:sr,label:"黑话管理",path:"/resource/jargon"},{icon:wg,label:"人物信息管理",path:"/resource/person"},{icon:jg,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:Ol,label:"插件市场",path:"/plugins"},{icon:vg,label:"模型分配预设市场",path:"/model-presets"},{icon:Wf,label:"插件配置",path:"/plugin-config"},{icon:Qu,label:"日志查看器",path:"/logs"},{icon:Rl,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:ar,label:"系统设置",path:"/settings"}]}],k=g==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":g,w=async()=>{await V0()};return e.jsx(O_,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:$("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",i?"lg:w-64":"lg:w-16",m?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:$("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!i&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:$("flex items-baseline gap-2",!i&&"lg:hidden"),children:[e.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),e.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:T0()})]}),!i&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(Ze,{className:$("flex-1 overflow-x-hidden",!i&&"lg:w-16"),children:e.jsx("nav",{className:$("p-4",!i&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:$("space-y-6",!i&&"lg:space-y-3 lg:w-full"),children:y.map((U,O)=>e.jsxs("li",{children:[e.jsx("div",{className:$("px-3 h-[1.25rem]","mb-2",!i&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:U.title})}),!i&&O>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:U.items.map(B=>{const Y=j({to:B.path}),L=B.icon,z=e.jsxs(e.Fragment,{children:[Y&&e.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),e.jsxs("div",{className:$("flex items-center transition-all duration-300",i?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(L,{className:$("h-5 w-5 flex-shrink-0",Y&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:$("text-sm font-medium whitespace-nowrap transition-all duration-300",Y&&"font-semibold",i?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:B.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(R_,{children:[e.jsx(L_,{asChild:!0,children:e.jsx(Kn,{to:B.path,"data-tour":B.tourId,className:$("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",Y?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",i?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>x(!1),children:z})}),!i&&e.jsx(jj,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:B.label})})]})},B.path)})})]},U.title))})})})]}),m&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>x(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>x(!m),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(yy,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>d(!i),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:i?"收起侧边栏":"展开侧边栏",children:e.jsx(il,{className:$("h-5 w-5 transition-transform",!i&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>p(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),e.jsxs(gj,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(D_,{open:f,onOpenChange:p}),e.jsxs(S,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(wy,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:U=>{w0(k==="dark"?"light":"dark",b,U)},className:"rounded-lg p-2 hover:bg-accent",title:k==="dark"?"切换到浅色模式":"切换到深色模式",children:k==="dark"?e.jsx(xg,{className:"h-5 w-5"}):e.jsx(hg,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(S,{variant:"ghost",size:"sm",onClick:w,className:"gap-2",title:"登出系统",children:[e.jsx(_y,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:n})]})]})})}function B_(n){const r=n.split(` +`).slice(1),i=[];for(const d of r){const m=d.trim();if(!m.startsWith("at "))continue;const x=m.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);x?i.push({functionName:x[1]||"",fileName:x[2],lineNumber:x[3],columnNumber:x[4],raw:m}):i.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:m})}return i}function H_({error:n,errorInfo:r}){const[i,d]=u.useState(!0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),g=n.stack?B_(n.stack):[],b=async()=>{const j=` +Error: ${n.name} +Message: ${n.message} + +Stack Trace: +${n.stack||"No stack trace available"} + +Component Stack: +${r?.componentStack||"No component stack available"} + +URL: ${window.location.href} +User Agent: ${navigator.userAgent} +Time: ${new Date().toISOString()} + `.trim();try{await navigator.clipboard.writeText(j),p(!0),setTimeout(()=>p(!1),2e3)}catch(y){console.error("Failed to copy:",y)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(It,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Ca,{className:"h-4 w-4"}),e.jsxs(Yt,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[n.name,":"]})," ",n.message]})]}),g.length>0&&e.jsxs(qu,{open:i,onOpenChange:d,children:[e.jsx(Gu,{asChild:!0,children:e.jsxs(S,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(Sy,{className:"h-4 w-4"}),"Stack Trace (",g.length," frames)"]}),i?e.jsx(di,{className:"h-4 w-4"}):e.jsx(Ll,{className:"h-4 w-4"})]})}),e.jsx($u,{children:e.jsx(Ze,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:g.map((j,y)=>e.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[y+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:j.functionName}),j.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[j.fileName,j.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",j.lineNumber,":",j.columnNumber]})]})]})]})},y))})})})]}),r?.componentStack&&e.jsxs(qu,{open:m,onOpenChange:x,children:[e.jsx(Gu,{asChild:!0,children:e.jsxs(S,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(Ca,{className:"h-4 w-4"}),"Component Stack"]}),m?e.jsx(di,{className:"h-4 w-4"}):e.jsx(Ll,{className:"h-4 w-4"})]})}),e.jsx($u,{children:e.jsx(Ze,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:r.componentStack})})})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:b,className:"w-full",children:f?e.jsxs(e.Fragment,{children:[e.jsx(Qt,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(Vc,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function vj({error:n,errorInfo:r}){const i=()=>{window.location.href="/"},d=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(Fe,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(ts,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:e.jsx(Ca,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(as,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(et,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(xs,{className:"space-y-4",children:[e.jsx(H_,{error:n,errorInfo:r}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(S,{onClick:d,className:"flex-1",children:[e.jsx(zt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(S,{onClick:i,variant:"outline",className:"flex-1",children:[e.jsx(Jc,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class q_ extends u.Component{constructor(r){super(r),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,i){console.error("ErrorBoundary caught an error:",r,i),this.setState({errorInfo:i})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:e.jsx(vj,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function bj({error:n}){return e.jsx(vj,{error:n,errorInfo:null})}const gi=qb({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(_p,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!z_())throw $b({to:"/auth"})}}),G_=tt({getParentRoute:()=>gi,path:"/auth",component:Q0}),$_=tt({getParentRoute:()=>gi,path:"/setup",component:iw}),jt=tt({getParentRoute:()=>gi,id:"protected",component:()=>e.jsx(U_,{children:e.jsx(_p,{})}),errorComponent:({error:n})=>e.jsx(bj,{error:n})}),F_=tt({getParentRoute:()=>jt,path:"/",component:N0}),V_=tt({getParentRoute:()=>jt,path:"/config/bot",component:Bw}),Q_=tt({getParentRoute:()=>jt,path:"/config/modelProvider",component:Kw}),I_=tt({getParentRoute:()=>jt,path:"/config/model",component:o1}),Y_=tt({getParentRoute:()=>jt,path:"/config/adapter",component:u1}),K_=tt({getParentRoute:()=>jt,path:"/resource/emoji",component:O1}),X_=tt({getParentRoute:()=>jt,path:"/resource/expression",component:I1}),J_=tt({getParentRoute:()=>jt,path:"/resource/person",component:p2}),Z_=tt({getParentRoute:()=>jt,path:"/resource/jargon",component:r2}),P_=tt({getParentRoute:()=>jt,path:"/resource/knowledge-graph",component:S2}),W_=tt({getParentRoute:()=>jt,path:"/logs",component:k2}),eS=tt({getParentRoute:()=>jt,path:"/chat",component:u_}),sS=tt({getParentRoute:()=>jt,path:"/plugins",component:Z2}),tS=tt({getParentRoute:()=>jt,path:"/model-presets",component:P2}),aS=tt({getParentRoute:()=>jt,path:"/plugin-config",component:s_}),lS=tt({getParentRoute:()=>jt,path:"/plugin-mirrors",component:t_}),nS=tt({getParentRoute:()=>jt,path:"/settings",component:B0}),rS=tt({getParentRoute:()=>jt,path:"/survey/webui-feedback",component:k_}),iS=tt({getParentRoute:()=>jt,path:"/survey/maibot-feedback",component:T_}),cS=tt({getParentRoute:()=>gi,path:"*",component:Ug}),oS=gi.addChildren([G_,$_,jt.addChildren([F_,V_,Q_,I_,Y_,K_,X_,Z_,J_,P_,sS,tS,aS,lS,W_,eS,nS,rS,iS]),cS]),dS=Gb({routeTree:oS,defaultNotFoundComponent:Ug,defaultErrorComponent:({error:n})=>e.jsx(bj,{error:n})});function uS({children:n,defaultTheme:r="system",storageKey:i="ui-theme",...d}){const[m,x]=u.useState(()=>localStorage.getItem(i)||r);u.useEffect(()=>{const p=window.document.documentElement;if(p.classList.remove("light","dark"),m==="system"){const g=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";p.classList.add(g);return}p.classList.add(m)},[m]),u.useEffect(()=>{const p=localStorage.getItem("accent-color");if(p){const g=document.documentElement,j={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[p];j&&(g.style.setProperty("--primary",j.hsl),j.gradient?(g.style.setProperty("--primary-gradient",j.gradient),g.classList.add("has-gradient")):(g.style.removeProperty("--primary-gradient"),g.classList.remove("has-gradient")))}},[]);const f={theme:m,setTheme:p=>{localStorage.setItem(i,p),x(p)}};return e.jsx(zg.Provider,{...d,value:f,children:n})}function mS({children:n,defaultEnabled:r=!0,defaultWavesEnabled:i=!0,storageKey:d="enable-animations",wavesStorageKey:m="enable-waves-background"}){const[x,f]=u.useState(()=>{const j=localStorage.getItem(d);return j!==null?j==="true":r}),[p,g]=u.useState(()=>{const j=localStorage.getItem(m);return j!==null?j==="true":i});u.useEffect(()=>{const j=document.documentElement;x?j.classList.remove("no-animations"):j.classList.add("no-animations"),localStorage.setItem(d,String(x))},[x,d]),u.useEffect(()=>{localStorage.setItem(m,String(p))},[p,m]);const b={enableAnimations:x,setEnableAnimations:f,enableWavesBackground:p,setEnableWavesBackground:g};return e.jsx(Ag.Provider,{value:b,children:n})}const xS=QN,Nj=u.forwardRef(({className:n,...r},i)=>e.jsx(rg,{ref:i,className:$("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",n),...r}));Nj.displayName=rg.displayName;const hS=tr("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),yj=u.forwardRef(({className:n,variant:r,...i},d)=>e.jsx(ig,{ref:d,className:$(hS({variant:r}),n),...i}));yj.displayName=ig.displayName;const fS=u.forwardRef(({className:n,...r},i)=>e.jsx(cg,{ref:i,className:$("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",n),...r}));fS.displayName=cg.displayName;const wj=u.forwardRef(({className:n,...r},i)=>e.jsx(og,{ref:i,className:$("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",n),"toast-close":"",...r,children:e.jsx(rl,{className:"h-4 w-4"})}));wj.displayName=og.displayName;const _j=u.forwardRef(({className:n,...r},i)=>e.jsx(dg,{ref:i,className:$("text-sm font-semibold [&+div]:text-xs",n),...r}));_j.displayName=dg.displayName;const Sj=u.forwardRef(({className:n,...r},i)=>e.jsx(ug,{ref:i,className:$("text-sm opacity-90",n),...r}));Sj.displayName=ug.displayName;function pS(){const{toasts:n}=$s();return e.jsxs(xS,{children:[n.map(function({id:r,title:i,description:d,action:m,...x}){return e.jsxs(yj,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[i&&e.jsx(_j,{children:i}),d&&e.jsx(Sj,{children:d})]}),m,e.jsx(wj,{})]},r)}),e.jsx(Nj,{})]})}d0.createRoot(document.getElementById("root")).render(e.jsx(u.StrictMode,{children:e.jsx(q_,{children:e.jsx(uS,{defaultTheme:"system",children:e.jsx(mS,{children:e.jsxs(Fw,{children:[e.jsx(Fb,{router:dS}),e.jsx(Iw,{}),e.jsx(pS,{})]})})})})})); diff --git a/webui/dist/assets/index-DHIER1DT.js b/webui/dist/assets/index-DHIER1DT.js deleted file mode 100644 index fdeaa7e3..00000000 --- a/webui/dist/assets/index-DHIER1DT.js +++ /dev/null @@ -1,54 +0,0 @@ -import{r as u,j as e,L as Xn,e as ba,R as gt,b as qb,f as Gb,g as Fb,h as Vb,k as st,l as $b,m as Qb,O as Tp,n as Ib}from"./router-CWhjJi2n.js";import{a as Yb,b as Xb,g as Kb}from"./react-vendor-Dtc2IqVY.js";import{I as Jb,c as Pb,J as ti,K as Oc,L as bu,M as Zb,N as Zi,O as Wi,P as Wb,n as Nu}from"./utils-CCeOswSm.js";import{L as Ep,T as zp,C as Mp,R as eN,a as Ap,V as sN,b as tN,S as Dp,c as aN,d as Op,I as lN,e as Rp,f as nN,g as Lp,h as iN,i as rN,j as cN,O as Up,P as oN,k as Bp,l as Hp,D as qp,A as Gp,m as Fp,n as dN,o as uN,p as Vp,q as mN,r as $p,s as xN,t as hN,u as fN,v as pN,w as gN,x as Qp,y as Ip,F as Yp,z as Xp,B as jN,E as vN}from"./radix-extra-DnIxMvW0.js";import{aj as bN,ak as NN,al as yN,am as wN,an as Rc,ao as Lc,ap as er,aq as _N,ar as yu,as as Uc,at as SN,au as CN,av as kN}from"./charts-Dhri-zxi.js";import{S as TN,G as Kp,O as Jp,o as EN,C as Pp,p as zN,T as Zp,D as Wp,R as MN,q as AN,H as eg,I as DN,J as sg,K as tg,L as ON,M as ag,V as RN,N as lg,Q as ng,U as LN,X as UN,Y as ig,Z as BN,_ as HN,$ as rg,a0 as qN,e as GN,f as FN,c as cg,P as Zc,d as Iu,b as Lu,h as VN,l as $N,m as QN,a1 as IN,a2 as og,a3 as YN,a4 as XN,a5 as KN,a6 as dg,a7 as ug,a8 as mg,a9 as xg,aa as hg,ab as fg,ac as JN}from"./radix-core-C3XKqQJw.js";import{R as Et,P as gr,C as aa,a as Mt,Z as an,b as Qc,F as Ca,c as PN,S as ai,d as ZN,M as Rl,A as WN,D as ey,e as Ic,f as Zn,T as sy,X as il,g as ty,h as ay,I as La,i as ka,j as $t,k as Yc,E as dr,l as Rt,m as pg,H as ly,n as We,o as Ra,U as ur,p as gg,q as jg,L as Wf,K as vg,r as bg,s as ny,t as Fc,u as Ws,v as iy,B as lr,w as Xc,x as Yu,y as ry,z as cy,G as At,J as Wc,N as ei,O as ct,Q as Ll,V as mr,W as Xu,Y as jr,_ as oy,$ as dy,a0 as ln,a1 as li,a2 as rl,a3 as Ha,a4 as ni,a5 as Ku,a6 as uy,a7 as my,a8 as xy,a9 as Ol,aa as hy,ab as Ng,ac as Uu,ad as nn,ae as fy,af as si,ag as py,ah as Bu,ai as Hu,aj as yg,ak as ep,al as gy,am as jy,an as vy,ao as nl,ap as wu,aq as sp,ar as by,as as wg,at as _u,au as Ny,av as yy,aw as wy,ax as _y,ay as Sy,az as _g,aA as Sg,aB as Cg,aC as kg,aD as Cy,aE as tp,aF as ky,aG as Ty,aH as Ey,aI as zy}from"./icons-BusT0Ku_.js";import{S as My,p as Ay,j as Dy,a as Oy,E as ap,R as Ry,o as Ly}from"./codemirror-BHeANvwm.js";import{_ as Yt,c as Uy,g as Tg,D as By}from"./misc-DyBU7ISD.js";import{u as Hy,a as lp,D as qy,c as Gy,S as Fy,h as Vy,b as $y,s as Qy,K as Iy,P as Yy,d as Xy,C as Ky}from"./dnd-Dyi3CnuX.js";import{D as Jy,U as Py}from"./uppy-DUr9_tfX.js";import{M as Zy,r as Wy,a as e0,b as s0}from"./markdown-A1ShuLvG.js";import{r as t0,H as Kc,P as Jc,u as a0,a as l0,R as n0,B as i0,b as r0,C as c0,M as o0,c as d0}from"./reactflow-B3n3_Vkw.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))d(m);new MutationObserver(m=>{for(const x of m)if(x.type==="childList")for(const f of x.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&d(f)}).observe(document,{childList:!0,subtree:!0});function r(m){const x={};return m.integrity&&(x.integrity=m.integrity),m.referrerPolicy&&(x.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?x.credentials="include":m.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function d(m){if(m.ep)return;m.ep=!0;const x=r(m);fetch(m.href,x)}})();var Su={exports:{}},sr={},Cu={exports:{}},ku={};var np;function u0(){return np||(np=1,(function(n){function i(O,V){var q=O.length;O.push(V);e:for(;0>>1,R=O[se];if(0>>1;sem(ke,q))wem(Me,ke)?(O[se]=Me,O[we]=q,se=we):(O[se]=ke,O[xe]=q,se=xe);else if(wem(Me,q))O[se]=Me,O[we]=q,se=we;else break e}}return V}function m(O,V){var q=O.sortIndex-V.sortIndex;return q!==0?q:O.id-V.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;n.unstable_now=function(){return x.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var g=[],b=[],j=1,y=null,N=3,k=!1,w=!1,U=!1,D=!1,B=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function z(O){for(var V=r(b);V!==null;){if(V.callback===null)d(b);else if(V.startTime<=O)d(b),V.sortIndex=V.expirationTime,i(g,V);else break;V=r(b)}}function X(O){if(U=!1,z(O),!w)if(r(g)!==null)w=!0,I||(I=!0,ge());else{var V=r(b);V!==null&&Te(X,V.startTime-O)}}var I=!1,T=-1,M=5,ae=-1;function he(){return D?!0:!(n.unstable_now()-aeO&&he());){var se=y.callback;if(typeof se=="function"){y.callback=null,N=y.priorityLevel;var R=se(y.expirationTime<=O);if(O=n.unstable_now(),typeof R=="function"){y.callback=R,z(O),V=!0;break s}y===r(g)&&d(g),z(O)}else d(g);y=r(g)}if(y!==null)V=!0;else{var ue=r(b);ue!==null&&Te(X,ue.startTime-O),V=!1}}break e}finally{y=null,N=q,k=!1}V=void 0}}finally{V?ge():I=!1}}}var ge;if(typeof L=="function")ge=function(){L(je)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,be=fe.port2;fe.port1.onmessage=je,ge=function(){be.postMessage(null)}}else ge=function(){B(je,0)};function Te(O,V){T=B(function(){O(n.unstable_now())},V)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(O){O.callback=null},n.unstable_forceFrameRate=function(O){0>O||125se?(O.sortIndex=q,i(b,O),r(g)===null&&O===r(b)&&(U?(Y(T),T=-1):U=!0,Te(X,q-se))):(O.sortIndex=R,i(g,O),w||k||(w=!0,I||(I=!0,ge()))),O},n.unstable_shouldYield=he,n.unstable_wrapCallback=function(O){var V=N;return function(){var q=N;N=V;try{return O.apply(this,arguments)}finally{N=q}}}})(ku)),ku}var ip;function m0(){return ip||(ip=1,Cu.exports=u0()),Cu.exports}var rp;function x0(){if(rp)return sr;rp=1;var n=m0(),i=Yb(),r=Xb();function d(s){var t="https://react.dev/errors/"+s;if(1R||(s.current=se[R],se[R]=null,R--)}function ke(s,t){R++,se[R]=s.current,s.current=t}var we=ue(null),Me=ue(null),pe=ue(null),ee=ue(null);function ie(s,t){switch(ke(pe,t),ke(Me,s),ke(we,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?yf(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=yf(t),s=wf(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}xe(we),ke(we,s)}function $(){xe(we),xe(Me),xe(pe)}function Z(s){s.memoizedState!==null&&ke(ee,s);var t=we.current,a=wf(t,s.type);t!==a&&(ke(Me,s),ke(we,a))}function Ee(s){Me.current===s&&(xe(we),xe(Me)),ee.current===s&&(xe(ee),Xi._currentValue=q)}var qe,E;function me(s){if(qe===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);qe=t&&t[1]||"",E=-1)":-1c||A[l]!==W[c]){var ce=` -`+A[l].replace(" at new "," at ");return s.displayName&&ce.includes("")&&(ce=ce.replace("",s.displayName)),ce}while(1<=l&&0<=c);break}}}finally{Ie=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?me(a):""}function J(s,t){switch(s.tag){case 26:case 27:case 5:return me(s.type);case 16:return me("Lazy");case 13:return s.child!==t&&t!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("SuspenseList");case 0:case 15:return Se(s.type,!1);case 11:return Se(s.type.render,!1);case 1:return Se(s.type,!0);case 31:return me("Activity");default:return""}}function Ne(s){try{var t="",a=null;do t+=J(s,a),a=s,s=s.return;while(s);return t}catch(l){return` -Error generating stack: `+l.message+` -`+l.stack}}var Ce=Object.prototype.hasOwnProperty,Gs=n.unstable_scheduleCallback,ws=n.unstable_cancelCallback,bt=n.unstable_shouldYield,ut=n.unstable_requestPaint,Us=n.unstable_now,ks=n.unstable_getCurrentPriorityLevel,na=n.unstable_ImmediatePriority,K=n.unstable_UserBlockingPriority,Ge=n.unstable_NormalPriority,Ae=n.unstable_LowPriority,Xe=n.unstable_IdlePriority,Vs=n.log,Pe=n.unstable_setDisableYieldValue,$s=null,ve=null;function _s(s){if(typeof Vs=="function"&&Pe(s),ve&&typeof ve.setStrictMode=="function")try{ve.setStrictMode($s,s)}catch{}}var Le=Math.clz32?Math.clz32:Fs,Qs=Math.log,mt=Math.LN2;function Fs(s){return s>>>=0,s===0?32:31-(Qs(s)/mt|0)|0}var ls=256,Is=262144,Xt=4194304;function zt(s){var t=s&42;if(t!==0)return t;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ol(s,t,a){var l=s.pendingLanes;if(l===0)return 0;var c=0,o=s.suspendedLanes,h=s.pingedLanes;s=s.warmLanes;var v=l&134217727;return v!==0?(l=v&~o,l!==0?c=zt(l):(h&=v,h!==0?c=zt(h):a||(a=v&~s,a!==0&&(c=zt(a))))):(v=l&~o,v!==0?c=zt(v):h!==0?c=zt(h):a||(a=l&~s,a!==0&&(c=zt(a)))),c===0?0:t!==0&&t!==c&&(t&o)===0&&(o=c&-c,a=t&-t,o>=a||o===32&&(a&4194048)!==0)?t:c}function Na(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function _(s,t){switch(s){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function G(){var s=Xt;return Xt<<=1,(Xt&62914560)===0&&(Xt=4194304),s}function ye(s){for(var t=[],a=0;31>a;a++)t.push(s);return t}function Ts(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Dt(s,t,a,l,c,o){var h=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var v=s.entanglements,A=s.expirationTimes,W=s.hiddenUpdates;for(a=h&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Oj=/[\n"\\]/g;function ra(s){return s.replace(Oj,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ho(s,t,a,l,c,o,h,v){s.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?s.type=h:s.removeAttribute("type"),t!=null?h==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+ia(t)):s.value!==""+ia(t)&&(s.value=""+ia(t)):h!=="submit"&&h!=="reset"||s.removeAttribute("value"),t!=null?fo(s,h,ia(t)):a!=null?fo(s,h,ia(a)):l!=null&&s.removeAttribute("value"),c==null&&o!=null&&(s.defaultChecked=!!o),c!=null&&(s.checked=c&&typeof c!="function"&&typeof c!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?s.name=""+ia(v):s.removeAttribute("name")}function fm(s,t,a,l,c,o,h,v){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(s.type=o),t!=null||a!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){xo(s);return}a=a!=null?""+ia(a):"",t=t!=null?""+ia(t):a,v||t===s.value||(s.value=t),s.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,s.checked=v?s.checked:!!l,s.defaultChecked=!!l,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(s.name=h),xo(s)}function fo(s,t,a){t==="number"&&_r(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function fn(s,t,a,l){if(s=s.options,t){t={};for(var c=0;c"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bo=!1;if(Fa)try{var mi={};Object.defineProperty(mi,"passive",{get:function(){bo=!0}}),window.addEventListener("test",mi,mi),window.removeEventListener("test",mi,mi)}catch{bo=!1}var ul=null,No=null,Cr=null;function ym(){if(Cr)return Cr;var s,t=No,a=t.length,l,c="value"in ul?ul.value:ul.textContent,o=c.length;for(s=0;s=fi),Tm=" ",Em=!1;function zm(s,t){switch(s){case"keyup":return cv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mm(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var vn=!1;function dv(s,t){switch(s){case"compositionend":return Mm(t);case"keypress":return t.which!==32?null:(Em=!0,Tm);case"textInput":return s=t.data,s===Tm&&Em?null:s;default:return null}}function uv(s,t){if(vn)return s==="compositionend"||!Co&&zm(s,t)?(s=ym(),Cr=No=ul=null,vn=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-s};s=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Hm(a)}}function Gm(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?Gm(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function Fm(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=_r(s.document);t instanceof s.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)s=t.contentWindow;else break;t=_r(s.document)}return t}function Eo(s){var t=s&&s.nodeName&&s.nodeName.toLowerCase();return t&&(t==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||t==="textarea"||s.contentEditable==="true")}var vv=Fa&&"documentMode"in document&&11>=document.documentMode,bn=null,zo=null,vi=null,Mo=!1;function Vm(s,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Mo||bn==null||bn!==_r(l)||(l=bn,"selectionStart"in l&&Eo(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),vi&&ji(vi,l)||(vi=l,l=vc(zo,"onSelect"),0>=h,c-=h,Ea=1<<32-Le(t)+c|a<es?(gs=De,De=null):gs=De.sibling;var bs=te(Q,De,P[es],oe);if(bs===null){De===null&&(De=gs);break}s&&De&&bs.alternate===null&&t(Q,De),H=o(bs,H,es),vs===null?He=bs:vs.sibling=bs,vs=bs,De=gs}if(es===P.length)return a(Q,De),js&&$a(Q,es),He;if(De===null){for(;eses?(gs=De,De=null):gs=De.sibling;var Dl=te(Q,De,bs.value,oe);if(Dl===null){De===null&&(De=gs);break}s&&De&&Dl.alternate===null&&t(Q,De),H=o(Dl,H,es),vs===null?He=Dl:vs.sibling=Dl,vs=Dl,De=gs}if(bs.done)return a(Q,De),js&&$a(Q,es),He;if(De===null){for(;!bs.done;es++,bs=P.next())bs=de(Q,bs.value,oe),bs!==null&&(H=o(bs,H,es),vs===null?He=bs:vs.sibling=bs,vs=bs);return js&&$a(Q,es),He}for(De=l(De);!bs.done;es++,bs=P.next())bs=ne(De,Q,es,bs.value,oe),bs!==null&&(s&&bs.alternate!==null&&De.delete(bs.key===null?es:bs.key),H=o(bs,H,es),vs===null?He=bs:vs.sibling=bs,vs=bs);return s&&De.forEach(function(Hb){return t(Q,Hb)}),js&&$a(Q,es),He}function Ms(Q,H,P,oe){if(typeof P=="object"&&P!==null&&P.type===U&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case k:e:{for(var He=P.key;H!==null;){if(H.key===He){if(He=P.type,He===U){if(H.tag===7){a(Q,H.sibling),oe=c(H,P.props.children),oe.return=Q,Q=oe;break e}}else if(H.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===M&&Kl(He)===H.type){a(Q,H.sibling),oe=c(H,P.props),Si(oe,P),oe.return=Q,Q=oe;break e}a(Q,H);break}else t(Q,H);H=H.sibling}P.type===U?(oe=$l(P.props.children,Q.mode,oe,P.key),oe.return=Q,Q=oe):(oe=Lr(P.type,P.key,P.props,null,Q.mode,oe),Si(oe,P),oe.return=Q,Q=oe)}return h(Q);case w:e:{for(He=P.key;H!==null;){if(H.key===He)if(H.tag===4&&H.stateNode.containerInfo===P.containerInfo&&H.stateNode.implementation===P.implementation){a(Q,H.sibling),oe=c(H,P.children||[]),oe.return=Q,Q=oe;break e}else{a(Q,H);break}else t(Q,H);H=H.sibling}oe=Bo(P,Q.mode,oe),oe.return=Q,Q=oe}return h(Q);case M:return P=Kl(P),Ms(Q,H,P,oe)}if(Te(P))return ze(Q,H,P,oe);if(ge(P)){if(He=ge(P),typeof He!="function")throw Error(d(150));return P=He.call(P),Ye(Q,H,P,oe)}if(typeof P.then=="function")return Ms(Q,H,Vr(P),oe);if(P.$$typeof===L)return Ms(Q,H,Hr(Q,P),oe);$r(Q,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,H!==null&&H.tag===6?(a(Q,H.sibling),oe=c(H,P),oe.return=Q,Q=oe):(a(Q,H),oe=Uo(P,Q.mode,oe),oe.return=Q,Q=oe),h(Q)):a(Q,H)}return function(Q,H,P,oe){try{_i=0;var He=Ms(Q,H,P,oe);return Mn=null,He}catch(De){if(De===zn||De===Gr)throw De;var vs=Jt(29,De,null,Q.mode);return vs.lanes=oe,vs.return=Q,vs}finally{}}}var Pl=mx(!0),xx=mx(!1),pl=!1;function Jo(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Po(s,t){s=s.updateQueue,t.updateQueue===s&&(t.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function gl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function jl(s,t,a){var l=s.updateQueue;if(l===null)return null;if(l=l.shared,(Ns&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=Rr(s),Jm(s,null,a),t}return Or(s,l,t,a),Rr(s)}function Ci(s,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=s.pendingLanes,a|=l,t.lanes=a,ci(s,a)}}function Zo(s,t){var a=s.updateQueue,l=s.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var c=null,o=null;if(a=a.firstBaseUpdate,a!==null){do{var h={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};o===null?c=o=h:o=o.next=h,a=a.next}while(a!==null);o===null?c=o=t:o=o.next=t}else c=o=t;a={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:o,shared:l.shared,callbacks:l.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=t:s.next=t,a.lastBaseUpdate=t}var Wo=!1;function ki(){if(Wo){var s=En;if(s!==null)throw s}}function Ti(s,t,a,l){Wo=!1;var c=s.updateQueue;pl=!1;var o=c.firstBaseUpdate,h=c.lastBaseUpdate,v=c.shared.pending;if(v!==null){c.shared.pending=null;var A=v,W=A.next;A.next=null,h===null?o=W:h.next=W,h=A;var ce=s.alternate;ce!==null&&(ce=ce.updateQueue,v=ce.lastBaseUpdate,v!==h&&(v===null?ce.firstBaseUpdate=W:v.next=W,ce.lastBaseUpdate=A))}if(o!==null){var de=c.baseState;h=0,ce=W=A=null,v=o;do{var te=v.lane&-536870913,ne=te!==v.lane;if(ne?(ps&te)===te:(l&te)===te){te!==0&&te===Tn&&(Wo=!0),ce!==null&&(ce=ce.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var ze=s,Ye=v;te=t;var Ms=a;switch(Ye.tag){case 1:if(ze=Ye.payload,typeof ze=="function"){de=ze.call(Ms,de,te);break e}de=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=Ye.payload,te=typeof ze=="function"?ze.call(Ms,de,te):ze,te==null)break e;de=y({},de,te);break e;case 2:pl=!0}}te=v.callback,te!==null&&(s.flags|=64,ne&&(s.flags|=8192),ne=c.callbacks,ne===null?c.callbacks=[te]:ne.push(te))}else ne={lane:te,tag:v.tag,payload:v.payload,callback:v.callback,next:null},ce===null?(W=ce=ne,A=de):ce=ce.next=ne,h|=te;if(v=v.next,v===null){if(v=c.shared.pending,v===null)break;ne=v,v=ne.next,ne.next=null,c.lastBaseUpdate=ne,c.shared.pending=null}}while(!0);ce===null&&(A=de),c.baseState=A,c.firstBaseUpdate=W,c.lastBaseUpdate=ce,o===null&&(c.shared.lanes=0),wl|=h,s.lanes=h,s.memoizedState=de}}function hx(s,t){if(typeof s!="function")throw Error(d(191,s));s.call(t)}function fx(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;so?o:8;var h=O.T,v={};O.T=v,jd(s,!1,t,a);try{var A=c(),W=O.S;if(W!==null&&W(v,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var ce=Tv(A,l);Mi(s,t,ce,sa(s))}else Mi(s,t,l,sa(s))}catch(de){Mi(s,t,{then:function(){},status:"rejected",reason:de},sa())}finally{V.p=o,h!==null&&v.types!==null&&(h.types=v.types),O.T=h}}function Ov(){}function pd(s,t,a,l){if(s.tag!==5)throw Error(d(476));var c=Yx(s).queue;Ix(s,c,t,q,a===null?Ov:function(){return Xx(s),a(l)})}function Yx(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:q,baseState:q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xa,lastRenderedState:q},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xa,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function Xx(s){var t=Yx(s);t.next===null&&(t=s.alternate.memoizedState),Mi(s,t.next.queue,{},sa())}function gd(){return Ct(Xi)}function Kx(){return rt().memoizedState}function Jx(){return rt().memoizedState}function Rv(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=sa();s=gl(a);var l=jl(t,s,a);l!==null&&(Ft(l,t,a),Ci(l,t,a)),t={cache:Io()},s.payload=t;return}t=t.return}}function Lv(s,t,a){var l=sa();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ec(s)?Zx(t,a):(a=Ro(s,t,a,l),a!==null&&(Ft(a,s,l),Wx(a,t,l)))}function Px(s,t,a){var l=sa();Mi(s,t,a,l)}function Mi(s,t,a,l){var c={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(ec(s))Zx(t,c);else{var o=s.alternate;if(s.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var h=t.lastRenderedState,v=o(h,a);if(c.hasEagerState=!0,c.eagerState=v,Kt(v,h))return Or(s,t,c,0),Bs===null&&Dr(),!1}catch{}finally{}if(a=Ro(s,t,c,l),a!==null)return Ft(a,s,l),Wx(a,t,l),!0}return!1}function jd(s,t,a,l){if(l={lane:2,revertLane:Jd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ec(s)){if(t)throw Error(d(479))}else t=Ro(s,a,l,2),t!==null&&Ft(t,s,2)}function ec(s){var t=s.alternate;return s===Ze||t!==null&&t===Ze}function Zx(s,t){Dn=Yr=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function Wx(s,t,a){if((a&4194048)!==0){var l=t.lanes;l&=s.pendingLanes,a|=l,t.lanes=a,ci(s,a)}}var Ai={readContext:Ct,use:Jr,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useLayoutEffect:tt,useInsertionEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useSyncExternalStore:tt,useId:tt,useHostTransitionStatus:tt,useFormState:tt,useActionState:tt,useOptimistic:tt,useMemoCache:tt,useCacheRefresh:tt};Ai.useEffectEvent=tt;var eh={readContext:Ct,use:Jr,useCallback:function(s,t){return Ot().memoizedState=[s,t===void 0?null:t],s},useContext:Ct,useEffect:Ux,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,Zr(4194308,4,Gx.bind(null,t,s),a)},useLayoutEffect:function(s,t){return Zr(4194308,4,s,t)},useInsertionEffect:function(s,t){Zr(4,2,s,t)},useMemo:function(s,t){var a=Ot();t=t===void 0?null:t;var l=s();if(Zl){_s(!0);try{s()}finally{_s(!1)}}return a.memoizedState=[l,t],l},useReducer:function(s,t,a){var l=Ot();if(a!==void 0){var c=a(t);if(Zl){_s(!0);try{a(t)}finally{_s(!1)}}}else c=t;return l.memoizedState=l.baseState=c,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:c},l.queue=s,s=s.dispatch=Lv.bind(null,Ze,s),[l.memoizedState,s]},useRef:function(s){var t=Ot();return s={current:s},t.memoizedState=s},useState:function(s){s=ud(s);var t=s.queue,a=Px.bind(null,Ze,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:hd,useDeferredValue:function(s,t){var a=Ot();return fd(a,s,t)},useTransition:function(){var s=ud(!1);return s=Ix.bind(null,Ze,s.queue,!0,!1),Ot().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var l=Ze,c=Ot();if(js){if(a===void 0)throw Error(d(407));a=a()}else{if(a=t(),Bs===null)throw Error(d(349));(ps&127)!==0||Nx(l,t,a)}c.memoizedState=a;var o={value:a,getSnapshot:t};return c.queue=o,Ux(wx.bind(null,l,o,s),[s]),l.flags|=2048,Rn(9,{destroy:void 0},yx.bind(null,l,o,a,t),null),a},useId:function(){var s=Ot(),t=Bs.identifierPrefix;if(js){var a=za,l=Ea;a=(l&~(1<<32-Le(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Xr++,0<\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof l.is=="string"?h.createElement("select",{is:l.is}):h.createElement("select"),l.multiple?o.multiple=!0:l.size&&(o.size=l.size);break;default:o=typeof l.is=="string"?h.createElement(c,{is:l.is}):h.createElement(c)}}o[_t]=t,o[Lt]=l;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)o.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=o;e:switch(Tt(o,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Ja(t)}}return Xs(t),Ad(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==l&&Ja(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(d(166));if(s=pe.current,Cn(t)){if(s=t.stateNode,a=t.memoizedProps,l=null,c=St,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}s[_t]=t,s=!!(s.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||bf(s.nodeValue,a)),s||hl(t,!0)}else s=bc(s).createTextNode(l),s[_t]=t,t.stateNode=s}return Xs(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(l=Cn(t),a!==null){if(s===null){if(!l)throw Error(d(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(d(557));s[_t]=t}else Ql(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Xs(t),s=!1}else a=Fo(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(Zt(t),t):(Zt(t),null);if((t.flags&128)!==0)throw Error(d(558))}return Xs(t),null;case 13:if(l=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(c=Cn(t),l!==null&&l.dehydrated!==null){if(s===null){if(!c)throw Error(d(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(d(317));c[_t]=t}else Ql(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Xs(t),c=!1}else c=Fo(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Zt(t),t):(Zt(t),null)}return Zt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,s=s!==null&&s.memoizedState!==null,a&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==c&&(l.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),nc(t,t.updateQueue),Xs(t),null);case 4:return $(),s===null&&eu(t.stateNode.containerInfo),Xs(t),null;case 10:return Ia(t.type),Xs(t),null;case 19:if(xe(it),l=t.memoizedState,l===null)return Xs(t),null;if(c=(t.flags&128)!==0,o=l.rendering,o===null)if(c)Oi(l,!1);else{if(at!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(o=Ir(s),o!==null){for(t.flags|=128,Oi(l,!1),s=o.updateQueue,t.updateQueue=s,nc(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)Pm(a,s),a=a.sibling;return ke(it,it.current&1|2),js&&$a(t,l.treeForkCount),t.child}s=s.sibling}l.tail!==null&&Us()>dc&&(t.flags|=128,c=!0,Oi(l,!1),t.lanes=4194304)}else{if(!c)if(s=Ir(o),s!==null){if(t.flags|=128,c=!0,s=s.updateQueue,t.updateQueue=s,nc(t,s),Oi(l,!0),l.tail===null&&l.tailMode==="hidden"&&!o.alternate&&!js)return Xs(t),null}else 2*Us()-l.renderingStartTime>dc&&a!==536870912&&(t.flags|=128,c=!0,Oi(l,!1),t.lanes=4194304);l.isBackwards?(o.sibling=t.child,t.child=o):(s=l.last,s!==null?s.sibling=o:t.child=o,l.last=o)}return l.tail!==null?(s=l.tail,l.rendering=s,l.tail=s.sibling,l.renderingStartTime=Us(),s.sibling=null,a=it.current,ke(it,c?a&1|2:a&1),js&&$a(t,l.treeForkCount),s):(Xs(t),null);case 22:case 23:return Zt(t),sd(),l=t.memoizedState!==null,s!==null?s.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(Xs(t),t.subtreeFlags&6&&(t.flags|=8192)):Xs(t),a=t.updateQueue,a!==null&&nc(t,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),s!==null&&xe(Xl),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ia(xt),Xs(t),null;case 25:return null;case 30:return null}throw Error(d(156,t.tag))}function Gv(s,t){switch(qo(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return Ia(xt),$(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return Ee(t),null;case 31:if(t.memoizedState!==null){if(Zt(t),t.alternate===null)throw Error(d(340));Ql()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(Zt(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(d(340));Ql()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return xe(it),null;case 4:return $(),null;case 10:return Ia(t.type),null;case 22:case 23:return Zt(t),sd(),s!==null&&xe(Xl),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return Ia(xt),null;case 25:return null;default:return null}}function _h(s,t){switch(qo(t),t.tag){case 3:Ia(xt),$();break;case 26:case 27:case 5:Ee(t);break;case 4:$();break;case 31:t.memoizedState!==null&&Zt(t);break;case 13:Zt(t);break;case 19:xe(it);break;case 10:Ia(t.type);break;case 22:case 23:Zt(t),sd(),s!==null&&xe(Xl);break;case 24:Ia(xt)}}function Ri(s,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var c=l.next;a=c;do{if((a.tag&s)===s){l=void 0;var o=a.create,h=a.inst;l=o(),h.destroy=l}a=a.next}while(a!==c)}}catch(v){Cs(t,t.return,v)}}function Nl(s,t,a){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var o=c.next;l=o;do{if((l.tag&s)===s){var h=l.inst,v=h.destroy;if(v!==void 0){h.destroy=void 0,c=t;var A=a,W=v;try{W()}catch(ce){Cs(c,A,ce)}}}l=l.next}while(l!==o)}}catch(ce){Cs(t,t.return,ce)}}function Sh(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{fx(t,a)}catch(l){Cs(s,s.return,l)}}}function Ch(s,t,a){a.props=Wl(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(l){Cs(s,t,l)}}function Li(s,t){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var l=s.stateNode;break;case 30:l=s.stateNode;break;default:l=s.stateNode}typeof a=="function"?s.refCleanup=a(l):a.current=l}}catch(c){Cs(s,t,c)}}function Ma(s,t){var a=s.ref,l=s.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(c){Cs(s,t,c)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){Cs(s,t,c)}else a.current=null}function kh(s){var t=s.type,a=s.memoizedProps,l=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(c){Cs(s,s.return,c)}}function Dd(s,t,a){try{var l=s.stateNode;ob(l,s.type,a,t),l[Lt]=t}catch(c){Cs(s,s.return,c)}}function Th(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Tl(s.type)||s.tag===4}function Od(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Th(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Tl(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Rd(s,t,a){var l=s.tag;if(l===5||l===6)s=s.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(s),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Ga));else if(l!==4&&(l===27&&Tl(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(Rd(s,t,a),s=s.sibling;s!==null;)Rd(s,t,a),s=s.sibling}function ic(s,t,a){var l=s.tag;if(l===5||l===6)s=s.stateNode,t?a.insertBefore(s,t):a.appendChild(s);else if(l!==4&&(l===27&&Tl(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(ic(s,t,a),s=s.sibling;s!==null;)ic(s,t,a),s=s.sibling}function Eh(s){var t=s.stateNode,a=s.memoizedProps;try{for(var l=s.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Tt(t,l,a),t[_t]=s,t[Lt]=a}catch(o){Cs(s,s.return,o)}}var Pa=!1,pt=!1,Ld=!1,zh=typeof WeakSet=="function"?WeakSet:Set,yt=null;function Fv(s,t){if(s=s.containerInfo,au=kc,s=Fm(s),Eo(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var c=l.anchorOffset,o=l.focusNode;l=l.focusOffset;try{a.nodeType,o.nodeType}catch{a=null;break e}var h=0,v=-1,A=-1,W=0,ce=0,de=s,te=null;s:for(;;){for(var ne;de!==a||c!==0&&de.nodeType!==3||(v=h+c),de!==o||l!==0&&de.nodeType!==3||(A=h+l),de.nodeType===3&&(h+=de.nodeValue.length),(ne=de.firstChild)!==null;)te=de,de=ne;for(;;){if(de===s)break s;if(te===a&&++W===c&&(v=h),te===o&&++ce===l&&(A=h),(ne=de.nextSibling)!==null)break;de=te,te=de.parentNode}de=ne}a=v===-1||A===-1?null:{start:v,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for(lu={focusedElem:s,selectionRange:a},kc=!1,yt=t;yt!==null;)if(t=yt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,yt=s;else for(;yt!==null;){switch(t=yt,o=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(a=0;a title"))),Tt(o,l,a),o[_t]=s,Nt(o),l=o;break e;case"link":var h=Uf("link","href",c).get(l+(a.href||""));if(h){for(var v=0;vMs&&(h=Ms,Ms=Ye,Ye=h);var Q=qm(v,Ye),H=qm(v,Ms);if(Q&&H&&(ne.rangeCount!==1||ne.anchorNode!==Q.node||ne.anchorOffset!==Q.offset||ne.focusNode!==H.node||ne.focusOffset!==H.offset)){var P=de.createRange();P.setStart(Q.node,Q.offset),ne.removeAllRanges(),Ye>Ms?(ne.addRange(P),ne.extend(H.node,H.offset)):(P.setEnd(H.node,H.offset),ne.addRange(P))}}}}for(de=[],ne=v;ne=ne.parentNode;)ne.nodeType===1&&de.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;va?32:a,O.T=null,a=Vd,Vd=null;var o=Sl,h=tl;if(vt=0,qn=Sl=null,tl=0,(Ns&6)!==0)throw Error(d(331));var v=Ns;if(Ns|=4,Gh(o.current),Bh(o,o.current,h,a),Ns=v,Fi(0,!1),ve&&typeof ve.onPostCommitFiberRoot=="function")try{ve.onPostCommitFiberRoot($s,o)}catch{}return!0}finally{V.p=c,O.T=l,nf(s,t)}}function cf(s,t,a){t=oa(a,t),t=yd(s.stateNode,t,2),s=jl(s,t,2),s!==null&&(Ts(s,2),Aa(s))}function Cs(s,t,a){if(s.tag===3)cf(s,s,a);else for(;t!==null;){if(t.tag===3){cf(t,s,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(_l===null||!_l.has(l))){s=oa(a,s),a=ch(2),l=jl(t,a,2),l!==null&&(oh(a,l,t,s),Ts(l,2),Aa(l));break}}t=t.return}}function Yd(s,t,a){var l=s.pingCache;if(l===null){l=s.pingCache=new Qv;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(a)||(Hd=!0,c.add(a),s=Jv.bind(null,s,t,a),t.then(s,s))}function Jv(s,t,a){var l=s.pingCache;l!==null&&l.delete(t),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,Bs===s&&(ps&a)===a&&(at===4||at===3&&(ps&62914560)===ps&&300>Us()-oc?(Ns&2)===0&&Gn(s,0):qd|=a,Hn===ps&&(Hn=0)),Aa(s)}function of(s,t){t===0&&(t=G()),s=Vl(s,t),s!==null&&(Ts(s,t),Aa(s))}function Pv(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),of(s,a)}function Zv(s,t){var a=0;switch(s.tag){case 31:case 13:var l=s.stateNode,c=s.memoizedState;c!==null&&(a=c.retryLane);break;case 19:l=s.stateNode;break;case 22:l=s.stateNode._retryCache;break;default:throw Error(d(314))}l!==null&&l.delete(t),of(s,a)}function Wv(s,t){return Gs(s,t)}var pc=null,Vn=null,Xd=!1,gc=!1,Kd=!1,kl=0;function Aa(s){s!==Vn&&s.next===null&&(Vn===null?pc=Vn=s:Vn=Vn.next=s),gc=!0,Xd||(Xd=!0,sb())}function Fi(s,t){if(!Kd&&gc){Kd=!0;do for(var a=!1,l=pc;l!==null;){if(s!==0){var c=l.pendingLanes;if(c===0)var o=0;else{var h=l.suspendedLanes,v=l.pingedLanes;o=(1<<31-Le(42|s)+1)-1,o&=c&~(h&~v),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(a=!0,xf(l,o))}else o=ps,o=ol(l,l===Bs?o:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(o&3)===0||Na(l,o)||(a=!0,xf(l,o));l=l.next}while(a);Kd=!1}}function eb(){df()}function df(){gc=Xd=!1;var s=0;kl!==0&&ub()&&(s=kl);for(var t=Us(),a=null,l=pc;l!==null;){var c=l.next,o=uf(l,t);o===0?(l.next=null,a===null?pc=c:a.next=c,c===null&&(Vn=a)):(a=l,(s!==0||(o&3)!==0)&&(gc=!0)),l=c}vt!==0&&vt!==5||Fi(s),kl!==0&&(kl=0)}function uf(s,t){for(var a=s.suspendedLanes,l=s.pingedLanes,c=s.expirationTimes,o=s.pendingLanes&-62914561;0v)break;var ce=A.transferSize,de=A.initiatorType;ce&&Nf(de)&&(A=A.responseEnd,h+=ce*(A"u"?null:document;function Df(s,t,a){var l=$n;if(l&&typeof t=="string"&&t){var c=ra(t);c='link[rel="'+s+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),Af.has(c)||(Af.add(c),s={rel:s,crossOrigin:a,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),Tt(t,"link",s),Nt(t),l.head.appendChild(t)))}}function bb(s){al.D(s),Df("dns-prefetch",s,null)}function Nb(s,t){al.C(s,t),Df("preconnect",s,t)}function yb(s,t,a){al.L(s,t,a);var l=$n;if(l&&s&&t){var c='link[rel="preload"][as="'+ra(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+ra(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+ra(a.imageSizes)+'"]')):c+='[href="'+ra(s)+'"]';var o=c;switch(t){case"style":o=Qn(s);break;case"script":o=In(s)}fa.has(o)||(s=y({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),fa.set(o,s),l.querySelector(c)!==null||t==="style"&&l.querySelector(Ii(o))||t==="script"&&l.querySelector(Yi(o))||(t=l.createElement("link"),Tt(t,"link",s),Nt(t),l.head.appendChild(t)))}}function wb(s,t){al.m(s,t);var a=$n;if(a&&s){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+ra(l)+'"][href="'+ra(s)+'"]',o=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=In(s)}if(!fa.has(o)&&(s=y({rel:"modulepreload",href:s},t),fa.set(o,s),a.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Yi(o)))return}l=a.createElement("link"),Tt(l,"link",s),Nt(l),a.head.appendChild(l)}}}function _b(s,t,a){al.S(s,t,a);var l=$n;if(l&&s){var c=xn(l).hoistableStyles,o=Qn(s);t=t||"default";var h=c.get(o);if(!h){var v={loading:0,preload:null};if(h=l.querySelector(Ii(o)))v.loading=5;else{s=y({rel:"stylesheet",href:s,"data-precedence":t},a),(a=fa.get(o))&&uu(s,a);var A=h=l.createElement("link");Nt(A),Tt(A,"link",s),A._p=new Promise(function(W,ce){A.onload=W,A.onerror=ce}),A.addEventListener("load",function(){v.loading|=1}),A.addEventListener("error",function(){v.loading|=2}),v.loading|=4,yc(h,t,l)}h={type:"stylesheet",instance:h,count:1,state:v},c.set(o,h)}}}function Sb(s,t){al.X(s,t);var a=$n;if(a&&s){var l=xn(a).hoistableScripts,c=In(s),o=l.get(c);o||(o=a.querySelector(Yi(c)),o||(s=y({src:s,async:!0},t),(t=fa.get(c))&&mu(s,t),o=a.createElement("script"),Nt(o),Tt(o,"link",s),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(c,o))}}function Cb(s,t){al.M(s,t);var a=$n;if(a&&s){var l=xn(a).hoistableScripts,c=In(s),o=l.get(c);o||(o=a.querySelector(Yi(c)),o||(s=y({src:s,async:!0,type:"module"},t),(t=fa.get(c))&&mu(s,t),o=a.createElement("script"),Nt(o),Tt(o,"link",s),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(c,o))}}function Of(s,t,a,l){var c=(c=pe.current)?Nc(c):null;if(!c)throw Error(d(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Qn(a.href),a=xn(c).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=Qn(a.href);var o=xn(c).hoistableStyles,h=o.get(s);if(h||(c=c.ownerDocument||c,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(s,h),(o=c.querySelector(Ii(s)))&&!o._p&&(h.instance=o,h.state.loading=5),fa.has(s)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},fa.set(s,a),o||kb(c,s,a,h.state))),t&&l===null)throw Error(d(528,""));return h}if(t&&l!==null)throw Error(d(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=In(a),a=xn(c).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(d(444,s))}}function Qn(s){return'href="'+ra(s)+'"'}function Ii(s){return'link[rel="stylesheet"]['+s+"]"}function Rf(s){return y({},s,{"data-precedence":s.precedence,precedence:null})}function kb(s,t,a,l){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=s.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),Tt(t,"link",a),Nt(t),s.head.appendChild(t))}function In(s){return'[src="'+ra(s)+'"]'}function Yi(s){return"script[async]"+s}function Lf(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=s.querySelector('style[data-href~="'+ra(a.href)+'"]');if(l)return t.instance=l,Nt(l),l;var c=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(s.ownerDocument||s).createElement("style"),Nt(l),Tt(l,"style",c),yc(l,a.precedence,s),t.instance=l;case"stylesheet":c=Qn(a.href);var o=s.querySelector(Ii(c));if(o)return t.state.loading|=4,t.instance=o,Nt(o),o;l=Rf(a),(c=fa.get(c))&&uu(l,c),o=(s.ownerDocument||s).createElement("link"),Nt(o);var h=o;return h._p=new Promise(function(v,A){h.onload=v,h.onerror=A}),Tt(o,"link",l),t.state.loading|=4,yc(o,a.precedence,s),t.instance=o;case"script":return o=In(a.src),(c=s.querySelector(Yi(o)))?(t.instance=c,Nt(c),c):(l=a,(c=fa.get(o))&&(l=y({},a),mu(l,c)),s=s.ownerDocument||s,c=s.createElement("script"),Nt(c),Tt(c,"link",l),s.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(d(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,yc(l,a.precedence,s));return t.instance}function yc(s,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,o=c,h=0;h title"):null)}function Tb(s,t,a){if(a===1||t.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return s=t.disabled,typeof t.precedence=="string"&&s==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Hf(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Eb(s,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var c=Qn(l.href),o=t.querySelector(Ii(c));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=_c.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=o,Nt(o);return}o=t.ownerDocument||t,l=Rf(l),(c=fa.get(c))&&uu(l,c),o=o.createElement("link"),Nt(o);var h=o;h._p=new Promise(function(v,A){h.onload=v,h.onerror=A}),Tt(o,"link",l),a.instance=o}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=_c.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var xu=0;function zb(s,t){return s.stylesheets&&s.count===0&&Cc(s,s.stylesheets),0xu?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function _c(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cc(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Sc=null;function Cc(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Sc=new Map,t.forEach(Mb,s),Sc=null,_c.call(s))}function Mb(s,t){if(!(t.state.loading&4)){var a=Sc.get(s);if(a)var l=a.get(null);else{a=new Map,Sc.set(s,a);for(var c=s.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Su.exports=x0(),Su.exports}var f0=h0();function F(...n){return Jb(Pb(n))}const Fe=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:F("rounded-xl border bg-card text-card-foreground shadow",n),...i}));Fe.displayName="Card";const ts=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:F("flex flex-col space-y-1.5 p-6",n),...i}));ts.displayName="CardHeader";const as=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:F("font-semibold leading-none tracking-tight",n),...i}));as.displayName="CardTitle";const Zs=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:F("text-sm text-muted-foreground",n),...i}));Zs.displayName="CardDescription";const hs=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:F("p-6 pt-0",n),...i}));hs.displayName="CardContent";const Eg=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:F("flex items-center p-6 pt-0",n),...i}));Eg.displayName="CardFooter";const ja=eN,la=u.forwardRef(({className:n,...i},r)=>e.jsx(Ep,{ref:r,className:F("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",n),...i}));la.displayName=Ep.displayName;const ss=u.forwardRef(({className:n,...i},r)=>e.jsx(zp,{ref:r,className:F("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",n),...i}));ss.displayName=zp.displayName;const ys=u.forwardRef(({className:n,...i},r)=>e.jsx(Mp,{ref:r,className:F("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",n),...i}));ys.displayName=Mp.displayName;const Je=u.forwardRef(({className:n,children:i,viewportRef:r,...d},m)=>e.jsxs(Ap,{ref:m,className:F("relative overflow-hidden",n),...d,children:[e.jsx(sN,{ref:r,className:"h-full w-full rounded-[inherit]",children:i}),e.jsx(qu,{}),e.jsx(qu,{orientation:"horizontal"}),e.jsx(tN,{})]}));Je.displayName=Ap.displayName;const qu=u.forwardRef(({className:n,orientation:i="vertical",...r},d)=>e.jsx(Dp,{ref:d,orientation:i,className:F("flex touch-none select-none transition-colors",i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",n),...r,children:e.jsx(aN,{className:"relative flex-1 rounded-full bg-border"})}));qu.displayName=Dp.displayName;function zg({className:n,...i}){return e.jsx("div",{className:F("animate-pulse rounded-md bg-primary/10",n),...i})}const ii=u.forwardRef(({className:n,value:i,...r},d)=>e.jsx(Op,{ref:d,className:F("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...r,children:e.jsx(lN,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(i||0)}%)`}})}));ii.displayName=Op.displayName;const p0={light:"",dark:".dark"},Mg=u.createContext(null);function Ag(){const n=u.useContext(Mg);if(!n)throw new Error("useChart must be used within a ");return n}const Kn=u.forwardRef(({id:n,className:i,children:r,config:d,...m},x)=>{const f=u.useId(),p=`chart-${n||f.replace(/:/g,"")}`;return e.jsx(Mg.Provider,{value:{config:d},children:e.jsxs("div",{"data-chart":p,ref:x,className:F("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",i),...m,children:[e.jsx(g0,{id:p,config:d}),e.jsx(bN,{children:r})]})})});Kn.displayName="Chart";const g0=({id:n,config:i})=>{const r=Object.entries(i).filter(([,d])=>d.theme||d.color);return r.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(p0).map(([d,m])=>` -${m} [data-chart=${n}] { -${r.map(([x,f])=>{const p=f.theme?.[d]||f.color;return p?` --color-${x}: ${p};`:null}).join(` -`)} -} -`).join(` -`)}}):null},tr=NN,Jn=u.forwardRef(({active:n,payload:i,className:r,indicator:d="dot",hideLabel:m=!1,hideIndicator:x=!1,label:f,labelFormatter:p,labelClassName:g,formatter:b,color:j,nameKey:y,labelKey:N},k)=>{const{config:w}=Ag(),U=u.useMemo(()=>{if(m||!i?.length)return null;const[B]=i,Y=`${N||B?.dataKey||B?.name||"value"}`,L=Gu(w,B,Y),z=!N&&typeof f=="string"?w[f]?.label||f:L?.label;return p?e.jsx("div",{className:F("font-medium",g),children:p(z,i)}):z?e.jsx("div",{className:F("font-medium",g),children:z}):null},[f,p,i,m,g,w,N]);if(!n||!i?.length)return null;const D=i.length===1&&d!=="dot";return e.jsxs("div",{ref:k,className:F("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[D?null:U,e.jsx("div",{className:"grid gap-1.5",children:i.filter(B=>B.type!=="none").map((B,Y)=>{const L=`${y||B.name||B.dataKey||"value"}`,z=Gu(w,B,L),X=j||B.payload.fill||B.color;return e.jsx("div",{className:F("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",d==="dot"&&"items-center"),children:b&&B?.value!==void 0&&B.name?b(B.value,B.name,B,Y,B.payload):e.jsxs(e.Fragment,{children:[z?.icon?e.jsx(z.icon,{}):!x&&e.jsx("div",{className:F("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":d==="dot","w-1":d==="line","w-0 border-[1.5px] border-dashed bg-transparent":d==="dashed","my-0.5":D&&d==="dashed"}),style:{"--color-bg":X,"--color-border":X}}),e.jsxs("div",{className:F("flex flex-1 justify-between leading-none",D?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[D?U:null,e.jsx("span",{className:"text-muted-foreground",children:z?.label||B.name})]}),B.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:B.value.toLocaleString()})]})]})},B.dataKey)})})]})});Jn.displayName="ChartTooltip";const j0=yN,Dg=u.forwardRef(({className:n,hideIcon:i=!1,payload:r,verticalAlign:d="bottom",nameKey:m},x)=>{const{config:f}=Ag();return r?.length?e.jsx("div",{ref:x,className:F("flex items-center justify-center gap-4",d==="top"?"pb-3":"pt-3",n),children:r.filter(p=>p.type!=="none").map(p=>{const g=`${m||p.dataKey||"value"}`,b=Gu(f,p,g);return e.jsxs("div",{className:F("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[b?.icon&&!i?e.jsx(b.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:p.color}}),b?.label]},p.value)})}):null});Dg.displayName="ChartLegend";function Gu(n,i,r){if(typeof i!="object"||i===null)return;const d="payload"in i&&typeof i.payload=="object"&&i.payload!==null?i.payload:void 0;let m=r;return r in i&&typeof i[r]=="string"?m=i[r]:d&&r in d&&typeof d[r]=="string"&&(m=d[r]),m in n?n[m]:n[r]}const xr=ti("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),S=u.forwardRef(({className:n,variant:i,size:r,asChild:d=!1,...m},x)=>{const f=d?TN:"button";return e.jsx(f,{className:F(xr({variant:i,size:r,className:n})),ref:x,...m})});S.displayName="Button";const v0=ti("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function $e({className:n,variant:i,...r}){return e.jsx("div",{className:F(v0({variant:i}),n),...r})}const b0=5,N0=5e3;let Tu=0;function y0(){return Tu=(Tu+1)%Number.MAX_SAFE_INTEGER,Tu.toString()}const Eu=new Map,op=n=>{if(Eu.has(n))return;const i=setTimeout(()=>{Eu.delete(n),or({type:"REMOVE_TOAST",toastId:n})},N0);Eu.set(n,i)},w0=(n,i)=>{switch(i.type){case"ADD_TOAST":return{...n,toasts:[i.toast,...n.toasts].slice(0,b0)};case"UPDATE_TOAST":return{...n,toasts:n.toasts.map(r=>r.id===i.toast.id?{...r,...i.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=i;return r?op(r):n.toasts.forEach(d=>{op(d.id)}),{...n,toasts:n.toasts.map(d=>d.id===r||r===void 0?{...d,open:!1}:d)}}case"REMOVE_TOAST":return i.toastId===void 0?{...n,toasts:[]}:{...n,toasts:n.toasts.filter(r=>r.id!==i.toastId)}}},Vc=[];let $c={toasts:[]};function or(n){$c=w0($c,n),Vc.forEach(i=>{i($c)})}function _0({...n}){const i=y0(),r=m=>or({type:"UPDATE_TOAST",toast:{...m,id:i}}),d=()=>or({type:"DISMISS_TOAST",toastId:i});return or({type:"ADD_TOAST",toast:{...n,id:i,open:!0,onOpenChange:m=>{m||d()}}}),{id:i,dismiss:d,update:r}}function qs(){const[n,i]=u.useState($c);return u.useEffect(()=>(Vc.push(i),()=>{const r=Vc.indexOf(i);r>-1&&Vc.splice(r,1)}),[n]),{...n,toast:_0,dismiss:r=>or({type:"DISMISS_TOAST",toastId:r})}}const S0=n=>{const i=[];for(let r=0;r{try{k(!0);const R=await Oc.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");y({hitokoto:R.data.hitokoto,from:R.data.from||R.data.from_who||"未知"})}catch(R){console.error("获取一言失败:",R),y({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{k(!1)}},[]),z=u.useCallback(async()=>{try{const R=localStorage.getItem("access-token"),ue=await Oc.get("/api/webui/system/status",{headers:{Authorization:`Bearer ${R}`}});U(ue.data)}catch(R){console.error("获取机器人状态失败:",R),U(null)}},[]),X=async()=>{if(!D)try{B(!0);const R=localStorage.getItem("access-token");await Oc.post("/api/webui/system/restart",{},{headers:{Authorization:`Bearer ${R}`}}),Y({title:"重启中",description:"麦麦正在重启,请稍候..."}),setTimeout(()=>{z(),B(!1)},3e3)}catch(R){console.error("重启失败:",R),Y({title:"重启失败",description:"无法重启麦麦,请检查控制台",variant:"destructive"}),B(!1)}},I=u.useCallback(async()=>{try{const R=localStorage.getItem("access-token"),ue=await Oc.get(`/api/webui/statistics/dashboard?hours=${f}`,{headers:{Authorization:`Bearer ${R}`}});i(ue.data),d(!1),x(100)}catch(R){console.error("Failed to fetch dashboard data:",R),d(!1),x(100)}},[f]);if(u.useEffect(()=>{if(!r)return;x(0);const R=setTimeout(()=>x(15),200),ue=setTimeout(()=>x(30),800),xe=setTimeout(()=>x(45),2e3),ke=setTimeout(()=>x(60),4e3),we=setTimeout(()=>x(75),6500),Me=setTimeout(()=>x(85),9e3),pe=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(R),clearTimeout(ue),clearTimeout(xe),clearTimeout(ke),clearTimeout(we),clearTimeout(Me),clearTimeout(pe)}},[r]),u.useEffect(()=>{I(),L(),z()},[I,L,z]),u.useEffect(()=>{if(!g)return;const R=setInterval(()=>{I(),z()},3e4);return()=>clearInterval(R)},[g,I,z]),r||!n)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(Et,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ii,{value:m,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m,"%"]})]})]})});const{summary:T,model_stats:M=[],hourly_data:ae=[],daily_data:he=[],recent_activity:je=[]}=n,ge=T??{total_requests:0,total_cost:0,total_tokens:0,online_time:0,total_messages:0,total_replies:0,avg_response_time:0,cost_per_hour:0,tokens_per_hour:0},fe=R=>{const ue=Math.floor(R/3600),xe=Math.floor(R%3600/60);return`${ue}小时${xe}分钟`},be=R=>{const ue=R.toLocaleString("zh-CN");return R>=1e9?{display:`${(R/1e9).toFixed(2)}B`,exact:ue,needsExact:!0}:R>=1e6?{display:`${(R/1e6).toFixed(2)}M`,exact:ue,needsExact:!0}:R>=1e4?{display:`${(R/1e3).toFixed(1)}K`,exact:ue,needsExact:!0}:R>=1e3?{display:`${(R/1e3).toFixed(2)}K`,exact:ue,needsExact:!0}:{display:ue,exact:ue,needsExact:!1}},Te=R=>{const ue=`¥${R.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return R>=1e6?{display:`¥${(R/1e6).toFixed(2)}M`,exact:ue,needsExact:!0}:R>=1e4?{display:`¥${(R/1e3).toFixed(1)}K`,exact:ue,needsExact:!0}:R>=1e3?{display:`¥${(R/1e3).toFixed(2)}K`,exact:ue,needsExact:!0}:{display:ue,exact:ue,needsExact:!1}},O=R=>new Date(R).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),V=S0(M.length),q=M.map((R,ue)=>({name:R.model_name,value:R.request_count,fill:V[ue]})),se={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ja,{value:f.toString(),onValueChange:R=>p(Number(R)),children:e.jsxs(la,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(ss,{value:"24",children:"24小时"}),e.jsx(ss,{value:"168",children:"7天"}),e.jsx(ss,{value:"720",children:"30天"})]})}),e.jsxs(S,{variant:g?"default":"outline",size:"sm",onClick:()=>b(!g),className:"gap-2",children:[e.jsx(Et,{className:`h-4 w-4 ${g?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:I,children:e.jsx(Et,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[N?e.jsx(zg,{className:"h-5 flex-1"}):j?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',j.hitokoto,'" —— ',j.from]}):null,e.jsx(S,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:L,disabled:N,children:e.jsx(Et,{className:`h-3.5 w-3.5 ${N?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(Fe,{className:"lg:col-span-1",children:[e.jsx(ts,{className:"pb-3",children:e.jsxs(as,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(gr,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(hs,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:w?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs($e,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(aa,{className:"h-3 w-3 mr-1"}),"运行中"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-500"}),e.jsxs($e,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(Mt,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),w&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",w.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["运行 ",fe(w.uptime)]})]})]})})]}),e.jsxs(Fe,{children:[e.jsx(ts,{className:"pb-3",children:e.jsxs(as,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(an,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(hs,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:X,disabled:D,className:"gap-2",children:[e.jsx(Qc,{className:`h-4 w-4 ${D?"animate-spin":""}`}),D?"重启中...":"重启麦麦"]}),e.jsx(S,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Xn,{to:"/logs",children:[e.jsx(Ca,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(S,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Xn,{to:"/plugins",children:[e.jsx(PN,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(S,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Xn,{to:"/settings",children:[e.jsx(ai,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"pb-3",children:[e.jsxs(as,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ZN,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(Zs,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(hs,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Xn,{to:"/survey/webui-feedback",children:[e.jsx(Ca,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(S,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Xn,{to:"/survey/maibot-feedback",children:[e.jsx(Rl,{className:"h-4 w-4"}),"麦麦反馈"]})})]})})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(WN,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[be(ge.total_requests).display,be(ge.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",be(ge.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",f<48?f+"小时":Math.floor(f/24)+"天"]})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"总花费"}),e.jsx(ey,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Te(ge.total_cost).display,Te(ge.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Te(ge.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ge.cost_per_hour>0?`¥${ge.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(Ic,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[be(ge.total_tokens).display,be(ge.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",be(ge.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ge.tokens_per_hour>0?`${be(ge.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(an,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ge.avg_response_time.toFixed(2),"s"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(Zn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(hs,{children:e.jsxs("div",{className:"text-xl font-bold",children:[fe(ge.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ge.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(Rl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[be(ge.total_messages).display,be(ge.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",be(ge.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",be(ge.total_replies).display,be(ge.total_replies).needsExact&&e.jsxs("span",{children:["(",be(ge.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(sy,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsx("div",{className:"text-xl font-bold",children:ge.total_messages>0?`¥${(ge.total_cost/ge.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(ja,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(la,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(ss,{value:"trends",children:"趋势"}),e.jsx(ss,{value:"models",children:"模型"}),e.jsx(ss,{value:"activity",children:"活动"}),e.jsx(ss,{value:"daily",children:"日统计"})]}),e.jsxs(ys,{value:"trends",className:"space-y-4",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"请求趋势"}),e.jsxs(Zs,{children:["最近",f,"小时的请求量变化"]})]}),e.jsx(hs,{children:e.jsx(Kn,{config:se,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(wN,{data:ae,children:[e.jsx(Rc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Lc,{dataKey:"timestamp",tickFormatter:R=>O(R),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(er,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(tr,{content:e.jsx(Jn,{labelFormatter:R=>O(R)})}),e.jsx(_N,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"花费趋势"}),e.jsx(Zs,{children:"API调用成本变化"})]}),e.jsx(hs,{children:e.jsx(Kn,{config:se,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(yu,{data:ae,children:[e.jsx(Rc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Lc,{dataKey:"timestamp",tickFormatter:R=>O(R),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(er,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(tr,{content:e.jsx(Jn,{labelFormatter:R=>O(R)})}),e.jsx(Uc,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"Token消耗"}),e.jsx(Zs,{children:"Token使用量变化"})]}),e.jsx(hs,{children:e.jsx(Kn,{config:se,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(yu,{data:ae,children:[e.jsx(Rc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Lc,{dataKey:"timestamp",tickFormatter:R=>O(R),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(er,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(tr,{content:e.jsx(Jn,{labelFormatter:R=>O(R)})}),e.jsx(Uc,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(ys,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"模型请求分布"}),e.jsxs(Zs,{children:["各模型使用占比 (共 ",M.length," 个模型)"]})]}),e.jsx(hs,{children:e.jsx(Kn,{config:Object.fromEntries(M.map((R,ue)=>[R.model_name,{label:R.model_name,color:V[ue]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(SN,{children:[e.jsx(tr,{content:e.jsx(Jn,{})}),e.jsx(CN,{data:q,cx:"50%",cy:"50%",labelLine:!1,label:({name:R,percent:ue})=>ue&&ue<.05?"":`${R} ${ue?(ue*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:q.map((R,ue)=>e.jsx(kN,{fill:R.fill},`cell-${ue}`))})]})})})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"模型详细统计"}),e.jsx(Zs,{children:"请求数、花费和性能"})]}),e.jsx(hs,{children:e.jsx(Je,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:M.map((R,ue)=>e.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:R.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${ue%5+1}))`}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),e.jsx("span",{className:"ml-1 font-medium",children:R.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",R.total_cost.toFixed(2)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[(R.total_tokens/1e3).toFixed(1),"K"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[R.avg_response_time.toFixed(2),"s"]})]})]})]},ue))})})})]})]})}),e.jsx(ys,{value:"activity",children:e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"最近活动"}),e.jsx(Zs,{children:"最新的API调用记录"})]}),e.jsx(hs,{children:e.jsx(Je,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:je.map((R,ue)=>e.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:R.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:R.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:O(R.timestamp)})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsx("span",{className:"ml-1",children:R.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",R.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[R.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${R.status==="success"?"text-green-600":"text-red-600"}`,children:R.status})]})]})]},ue))})})})]})}),e.jsx(ys,{value:"daily",children:e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"每日统计"}),e.jsx(Zs,{children:"最近7天的数据汇总"})]}),e.jsx(hs,{children:e.jsx(Kn,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:e.jsxs(yu,{data:he,children:[e.jsx(Rc,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Lc,{dataKey:"timestamp",tickFormatter:R=>{const ue=new Date(R);return`${ue.getMonth()+1}/${ue.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(er,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(er,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(tr,{content:e.jsx(Jn,{labelFormatter:R=>new Date(R).toLocaleDateString("zh-CN")})}),e.jsx(j0,{content:e.jsx(Dg,{})}),e.jsx(Uc,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Uc,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]})]})})}const k0={theme:"system",setTheme:()=>null},Og=u.createContext(k0),Ju=()=>{const n=u.useContext(Og);if(n===void 0)throw new Error("useTheme must be used within a ThemeProvider");return n},T0=(n,i,r)=>{const d=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||d){i(n);return}const m=r.clientX,x=r.clientY,f=Math.hypot(Math.max(m,innerWidth-m),Math.max(x,innerHeight-x));document.startViewTransition(()=>{i(n)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${m}px ${x}px)`,`circle(${f}px at ${m}px ${x}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Rg=u.createContext(void 0),Lg=()=>{const n=u.useContext(Rg);if(n===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return n},Qe=u.forwardRef(({className:n,...i},r)=>e.jsx(Rp,{className:F("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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",n),...i,ref:r,children:e.jsx(nN,{className:F("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Qe.displayName=Rp.displayName;const E0=ti("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),C=u.forwardRef(({className:n,...i},r)=>e.jsx(Kp,{ref:r,className:F(E0(),n),...i}));C.displayName=Kp.displayName;const re=u.forwardRef(({className:n,type:i,...r},d)=>e.jsx("input",{type:i,className:F("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:d,...r}));re.displayName="Input";const z0=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:n=>n.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:n=>/[A-Z]/.test(n)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:n=>/[a-z]/.test(n)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:n=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(n)}];function M0(n){const i=z0.map(d=>({id:d.id,label:d.label,description:d.description,passed:d.validate(n)}));return{isValid:i.every(d=>d.passed),rules:i}}const eo="0.11.7 Beta",Pu="MaiBot Dashboard",A0=`${Pu} v${eo}`,D0=(n="v")=>`${n}${eo}`,Vt={THEME:"maibot-ui-theme",ACCENT_COLOR:"accent-color",ENABLE_ANIMATIONS:"maibot-animations",ENABLE_WAVES_BACKGROUND:"maibot-waves-background",LOG_CACHE_SIZE:"maibot-log-cache-size",LOG_AUTO_SCROLL:"maibot-log-auto-scroll",LOG_FONT_SIZE:"maibot-log-font-size",LOG_LINE_SPACING:"maibot-log-line-spacing",DATA_SYNC_INTERVAL:"maibot-data-sync-interval",WS_RECONNECT_INTERVAL:"maibot-ws-reconnect-interval",WS_MAX_RECONNECT_ATTEMPTS:"maibot-ws-max-reconnect-attempts",COMPLETED_TOURS:"maibot-completed-tours"},Oa={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function lt(n){const i=Ug(n),r=localStorage.getItem(i);if(r===null)return Oa[n];const d=Oa[n];if(typeof d=="boolean")return r==="true";if(typeof d=="number"){const m=parseFloat(r);return isNaN(m)?d:m}return r}function Pn(n,i){const r=Ug(n);localStorage.setItem(r,String(i)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:n,value:i}}))}function O0(){return{theme:lt("theme"),accentColor:lt("accentColor"),enableAnimations:lt("enableAnimations"),enableWavesBackground:lt("enableWavesBackground"),logCacheSize:lt("logCacheSize"),logAutoScroll:lt("logAutoScroll"),logFontSize:lt("logFontSize"),logLineSpacing:lt("logLineSpacing"),dataSyncInterval:lt("dataSyncInterval"),wsReconnectInterval:lt("wsReconnectInterval"),wsMaxReconnectAttempts:lt("wsMaxReconnectAttempts")}}function R0(){const n=O0(),i=localStorage.getItem(Vt.COMPLETED_TOURS),r=i?JSON.parse(i):[];return{...n,completedTours:r}}function L0(n){const i=[],r=[];for(const[d,m]of Object.entries(n)){if(d==="completedTours"){Array.isArray(m)?(localStorage.setItem(Vt.COMPLETED_TOURS,JSON.stringify(m)),i.push("completedTours")):r.push("completedTours");continue}if(d in Oa){const x=d,f=Oa[x];if(typeof m==typeof f){if(x==="theme"&&!["light","dark","system"].includes(m)){r.push(d);continue}if(x==="logFontSize"&&!["xs","sm","base"].includes(m)){r.push(d);continue}Pn(x,m),i.push(d)}else r.push(d)}else r.push(d)}return{success:i.length>0,imported:i,skipped:r}}function U0(){for(const n of Object.keys(Oa))Pn(n,Oa[n]);localStorage.removeItem(Vt.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function B0(){const n=[],i=[],r=[];for(let d=0;dd.size-r.size),{used:n,items:localStorage.length,details:i}}function H0(n){if(n===0)return"0 B";const i=1024,r=["B","KB","MB"],d=Math.floor(Math.log(n)/Math.log(i));return parseFloat((n/Math.pow(i,d)).toFixed(2))+" "+r[d]}function Ug(n){return{theme:Vt.THEME,accentColor:Vt.ACCENT_COLOR,enableAnimations:Vt.ENABLE_ANIMATIONS,enableWavesBackground:Vt.ENABLE_WAVES_BACKGROUND,logCacheSize:Vt.LOG_CACHE_SIZE,logAutoScroll:Vt.LOG_AUTO_SCROLL,logFontSize:Vt.LOG_FONT_SIZE,logLineSpacing:Vt.LOG_LINE_SPACING,dataSyncInterval:Vt.DATA_SYNC_INTERVAL,wsReconnectInterval:Vt.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:Vt.WS_MAX_RECONNECT_ATTEMPTS}[n]}const ga=u.forwardRef(({className:n,...i},r)=>e.jsxs(Lp,{ref:r,className:F("relative flex w-full touch-none select-none items-center",n),...i,children:[e.jsx(iN,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(rN,{className:"absolute h-full bg-primary"})}),e.jsx(cN,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));ga.displayName=Lp.displayName;class q0{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return lt("logCacheSize")}getMaxReconnectAttempts(){return lt("wsMaxReconnectAttempts")}getReconnectInterval(){return lt("wsReconnectInterval")}getWebSocketUrl(){{const i=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host;return`${i}//${r}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const i=this.getWebSocketUrl();try{this.ws=new WebSocket(i),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=r=>{try{if(r.data==="pong")return;const d=JSON.parse(r.data);this.notifyLog(d)}catch(d){console.error("解析日志消息失败:",d)}},this.ws.onerror=r=>{console.error("❌ WebSocket 错误:",r),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(r){console.error("创建 WebSocket 连接失败:",r),this.attemptReconnect()}}attemptReconnect(){const i=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=i)return;this.reconnectAttempts+=1;const r=this.getReconnectInterval(),d=Math.min(r*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},d)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(i){return this.logCallbacks.add(i),()=>this.logCallbacks.delete(i)}onConnectionChange(i){return this.connectionCallbacks.add(i),i(this.isConnected),()=>this.connectionCallbacks.delete(i)}notifyLog(i){if(!this.logCache.some(d=>d.id===i.id)){this.logCache.push(i);const d=this.getMaxCacheSize();this.logCache.length>d&&(this.logCache=this.logCache.slice(-d)),this.logCallbacks.forEach(m=>{try{m(i)}catch(x){console.error("日志回调执行失败:",x)}})}}notifyConnection(i){this.connectionCallbacks.forEach(r=>{try{r(i)}catch(d){console.error("连接状态回调执行失败:",d)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const tn=new q0;typeof window<"u"&&tn.connect();const Hs=MN,Zu=AN,G0=EN,Bg=u.forwardRef(({className:n,...i},r)=>e.jsx(Jp,{ref:r,className:F("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...i}));Bg.displayName=Jp.displayName;const Os=u.forwardRef(({className:n,children:i,preventOutsideClose:r=!1,...d},m)=>e.jsxs(G0,{children:[e.jsx(Bg,{}),e.jsxs(Pp,{ref:m,className:F("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),onPointerDownOutside:r?x=>x.preventDefault():void 0,onInteractOutside:r?x=>x.preventDefault():void 0,...d,children:[i,e.jsxs(zN,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(il,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Os.displayName=Pp.displayName;const Rs=({className:n,...i})=>e.jsx("div",{className:F("flex flex-col space-y-1.5 text-center sm:text-left",n),...i});Rs.displayName="DialogHeader";const et=({className:n,...i})=>e.jsx("div",{className:F("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...i});et.displayName="DialogFooter";const Ls=u.forwardRef(({className:n,...i},r)=>e.jsx(Zp,{ref:r,className:F("text-lg font-semibold leading-none tracking-tight",n),...i}));Ls.displayName=Zp.displayName;const Js=u.forwardRef(({className:n,...i},r)=>e.jsx(Wp,{ref:r,className:F("text-sm text-muted-foreground",n),...i}));Js.displayName=Wp.displayName;const fs=dN,nt=uN,F0=oN,Hg=u.forwardRef(({className:n,...i},r)=>e.jsx(Up,{className:F("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...i,ref:r}));Hg.displayName=Up.displayName;const ns=u.forwardRef(({className:n,...i},r)=>e.jsxs(F0,{children:[e.jsx(Hg,{}),e.jsx(Bp,{ref:r,className:F("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...i})]}));ns.displayName=Bp.displayName;const is=({className:n,...i})=>e.jsx("div",{className:F("flex flex-col space-y-2 text-center sm:text-left",n),...i});is.displayName="AlertDialogHeader";const rs=({className:n,...i})=>e.jsx("div",{className:F("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...i});rs.displayName="AlertDialogFooter";const cs=u.forwardRef(({className:n,...i},r)=>e.jsx(Hp,{ref:r,className:F("text-lg font-semibold",n),...i}));cs.displayName=Hp.displayName;const os=u.forwardRef(({className:n,...i},r)=>e.jsx(qp,{ref:r,className:F("text-sm text-muted-foreground",n),...i}));os.displayName=qp.displayName;const ds=u.forwardRef(({className:n,...i},r)=>e.jsx(Gp,{ref:r,className:F(xr(),n),...i}));ds.displayName=Gp.displayName;const us=u.forwardRef(({className:n,...i},r)=>e.jsx(Fp,{ref:r,className:F(xr({variant:"outline"}),"mt-2 sm:mt-0",n),...i}));us.displayName=Fp.displayName;function V0(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),e.jsxs(ja,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(la,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(ss,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ty,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(ss,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ay,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(ss,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ai,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(ss,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(La,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(Je,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(ys,{value:"appearance",className:"mt-0",children:e.jsx($0,{})}),e.jsx(ys,{value:"security",className:"mt-0",children:e.jsx(Q0,{})}),e.jsx(ys,{value:"other",className:"mt-0",children:e.jsx(I0,{})}),e.jsx(ys,{value:"about",className:"mt-0",children:e.jsx(Y0,{})})]})]})]})}function up(n){const i=document.documentElement,d={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[n];if(d)i.style.setProperty("--primary",d.hsl),d.gradient?(i.style.setProperty("--primary-gradient",d.gradient),i.classList.add("has-gradient")):(i.style.removeProperty("--primary-gradient"),i.classList.remove("has-gradient"));else if(n.startsWith("#")){const m=x=>{x=x.replace("#","");const f=parseInt(x.substring(0,2),16)/255,p=parseInt(x.substring(2,4),16)/255,g=parseInt(x.substring(4,6),16)/255,b=Math.max(f,p,g),j=Math.min(f,p,g);let y=0,N=0;const k=(b+j)/2;if(b!==j){const w=b-j;switch(N=k>.5?w/(2-b-j):w/(b+j),b){case f:y=((p-g)/w+(plocalStorage.getItem("accent-color")||"blue");u.useEffect(()=>{const b=localStorage.getItem("accent-color")||"blue";up(b)},[]);const g=b=>{p(b),localStorage.setItem("accent-color",b),up(b)};return e.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[e.jsx(zu,{value:"light",current:n,onChange:i,label:"浅色",description:"始终使用浅色主题"}),e.jsx(zu,{value:"dark",current:n,onChange:i,label:"深色",description:"始终使用深色主题"}),e.jsx(zu,{value:"system",current:n,onChange:i,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(pa,{value:"blue",current:f,onChange:g,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(pa,{value:"purple",current:f,onChange:g,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(pa,{value:"green",current:f,onChange:g,label:"绿色",colorClass:"bg-green-500"}),e.jsx(pa,{value:"orange",current:f,onChange:g,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(pa,{value:"pink",current:f,onChange:g,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(pa,{value:"red",current:f,onChange:g,label:"红色",colorClass:"bg-red-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(pa,{value:"gradient-sunset",current:f,onChange:g,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(pa,{value:"gradient-ocean",current:f,onChange:g,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(pa,{value:"gradient-forest",current:f,onChange:g,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(pa,{value:"gradient-aurora",current:f,onChange:g,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(pa,{value:"gradient-fire",current:f,onChange:g,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(pa,{value:"gradient-twilight",current:f,onChange:g,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"color",value:f.startsWith("#")?f:"#3b82f6",onChange:b=>g(b.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),e.jsx("div",{className:"flex-1",children:e.jsx(re,{type:"text",value:f,onChange:b=>g(b.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),e.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[e.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(C,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx(Qe,{id:"animations",checked:r,onCheckedChange:d})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(C,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx(Qe,{id:"waves-background",checked:m,onCheckedChange:x})]})})]})]})]})}function Q0(){const n=ba(),[i,r]=u.useState(""),[d,m]=u.useState(""),[x,f]=u.useState(!1),[p,g]=u.useState(!1),[b,j]=u.useState(!1),[y,N]=u.useState(!1),[k,w]=u.useState(!1),[U,D]=u.useState(!1),[B,Y]=u.useState(""),[L,z]=u.useState(!1),{toast:X}=qs(),I=u.useMemo(()=>M0(d),[d]),T=async fe=>{if(!i){X({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(fe),w(!0),X({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>w(!1),2e3)}catch{X({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},M=async()=>{if(!d.trim()){X({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!I.isValid){const fe=I.rules.filter(be=>!be.passed).map(be=>be.label).join(", ");X({title:"格式错误",description:`Token 不符合要求: ${fe}`,variant:"destructive"});return}j(!0);try{const fe=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:d.trim()})}),be=await fe.json();fe.ok&&be.success?(m(""),r(d.trim()),X({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{n({to:"/auth"})},1500)):X({title:"更新失败",description:be.message||"无法更新 Token",variant:"destructive"})}catch(fe){console.error("更新 Token 错误:",fe),X({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{j(!1)}},ae=async()=>{N(!0);try{const fe=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),be=await fe.json();fe.ok&&be.success?(r(be.token),Y(be.token),D(!0),z(!1),X({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):X({title:"生成失败",description:be.message||"无法生成新 Token",variant:"destructive"})}catch(fe){console.error("生成 Token 错误:",fe),X({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{N(!1)}},he=async()=>{try{await navigator.clipboard.writeText(B),z(!0),X({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{X({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},je=()=>{D(!1),setTimeout(()=>{Y(""),z(!1)},300),setTimeout(()=>{n({to:"/auth"})},500)},ge=fe=>{fe||je()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Hs,{open:U,onOpenChange:ge,children:e.jsxs(Os,{className:"sm:max-w-md",children:[e.jsxs(Rs,{children:[e.jsxs(Ls,{className:"flex items-center gap-2",children:[e.jsx(ka,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(Js,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[e.jsx(C,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),e.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:B})]}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ka,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"重要提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),e.jsx("li",{children:"请立即复制并保存到安全的位置"}),e.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),e.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),e.jsxs(et,{className:"gap-2 sm:gap-0",children:[e.jsx(S,{variant:"outline",onClick:he,className:"gap-2",children:L?e.jsxs(e.Fragment,{children:[e.jsx($t,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(Yc,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(S,{onClick:je,children:"我已保存,关闭"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(re,{id:"current-token",type:x?"text":"password",value:i||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{i?f(!x):X({title:"无法查看",description:'Token 存储在安全 Cookie 中,如需新 Token 请点击"重新生成"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:x?"隐藏":"显示",children:x?e.jsx(dr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Rt,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(S,{variant:"outline",size:"icon",onClick:()=>T(i),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!i,children:k?e.jsx($t,{className:"h-4 w-4 text-green-500"}):e.jsx(Yc,{className:"h-4 w-4"})}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs(S,{variant:"outline",disabled:y,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(Et,{className:F("h-4 w-4",y&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重新生成 Token"}),e.jsx(os,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:ae,children:"确认生成"})]})]})]})]})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{id:"new-token",type:p?"text":"password",value:d,onChange:fe=>m(fe.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),e.jsx("button",{onClick:()=>g(!p),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:p?"隐藏":"显示",children:p?e.jsx(dr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Rt,{className:"h-4 w-4 text-muted-foreground"})})]}),d&&e.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),e.jsx("div",{className:"space-y-1.5",children:I.rules.map(fe=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[fe.passed?e.jsx(aa,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(pg,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:F(fe.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:fe.label})]},fe.id))}),I.isValid&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[e.jsx($t,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(S,{onClick:M,disabled:b||!I.isValid||!d,className:"w-full sm:w-auto",children:b?"更新中...":"更新自定义 Token"})]})]}),e.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[e.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),e.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),e.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),e.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),e.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),e.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),e.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function I0(){const n=ba(),{toast:i}=qs(),[r,d]=u.useState(!1),[m,x]=u.useState(!1),[f,p]=u.useState(()=>lt("logCacheSize")),[g,b]=u.useState(()=>lt("wsReconnectInterval")),[j,y]=u.useState(()=>lt("wsMaxReconnectAttempts")),[N,k]=u.useState(()=>lt("dataSyncInterval")),[w,U]=u.useState(()=>dp()),[D,B]=u.useState(!1),[Y,L]=u.useState(!1),z=u.useRef(null);if(m)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const X=()=>{U(dp())},I=O=>{const V=O[0];p(V),Pn("logCacheSize",V)},T=O=>{const V=O[0];b(V),Pn("wsReconnectInterval",V)},M=O=>{const V=O[0];y(V),Pn("wsMaxReconnectAttempts",V)},ae=O=>{const V=O[0];k(V),Pn("dataSyncInterval",V)},he=()=>{tn.clearLogs(),i({title:"日志已清除",description:"日志缓存已清空"})},je=()=>{const O=B0();X(),i({title:"缓存已清除",description:`已清除 ${O.clearedKeys.length} 项缓存数据`})},ge=()=>{B(!0);try{const O=R0(),V=JSON.stringify(O,null,2),q=new Blob([V],{type:"application/json"}),se=URL.createObjectURL(q),R=document.createElement("a");R.href=se,R.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(R),R.click(),document.body.removeChild(R),URL.revokeObjectURL(se),i({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(O){console.error("导出设置失败:",O),i({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{B(!1)}},fe=O=>{const V=O.target.files?.[0];if(!V)return;L(!0);const q=new FileReader;q.onload=se=>{try{const R=se.target?.result,ue=JSON.parse(R),xe=L0(ue);xe.success?(p(lt("logCacheSize")),b(lt("wsReconnectInterval")),y(lt("wsMaxReconnectAttempts")),k(lt("dataSyncInterval")),X(),i({title:"导入成功",description:`成功导入 ${xe.imported.length} 项设置${xe.skipped.length>0?`,跳过 ${xe.skipped.length} 项`:""}`}),(xe.imported.includes("theme")||xe.imported.includes("accentColor"))&&i({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):i({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(R){console.error("导入设置失败:",R),i({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{L(!1),z.current&&(z.current.value="")}},q.readAsText(V)},be=()=>{U0(),p(Oa.logCacheSize),b(Oa.wsReconnectInterval),y(Oa.wsMaxReconnectAttempts),k(Oa.dataSyncInterval),X(),i({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},Te=async()=>{d(!0);try{const O=localStorage.getItem("access-token"),V=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${O}`}}),q=await V.json();V.ok&&q.success?(i({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{n({to:"/setup"})},1e3)):i({title:"重置失败",description:q.message||"无法重置配置状态",variant:"destructive"})}catch(O){console.error("重置配置状态错误:",O),i({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{d(!1)}};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Ic,{className:"h-5 w-5"}),"性能与存储"]}),e.jsxs("div",{className:"space-y-4 sm:space-y-5",children:[e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ly,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(S,{variant:"ghost",size:"sm",onClick:X,className:"h-7 px-2",children:e.jsx(Et,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:H0(w.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[w.items," 个存储项"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[f," 条"]})]}),e.jsx(ga,{value:[f],onValueChange:I,min:100,max:5e3,step:100,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制日志查看器最多缓存的日志条数,较大的值会占用更多内存"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," 秒"]})]}),e.jsx(ga,{value:[N],onValueChange:ae,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制首页统计数据的自动刷新间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[g/1e3," 秒"]})]}),e.jsx(ga,{value:[g],onValueChange:T,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"日志 WebSocket 连接断开后的重连基础间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[j," 次"]})]}),e.jsx(ga,{value:[j],onValueChange:M,min:3,max:30,step:1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"连接失败后的最大重连尝试次数"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:he,className:"gap-2",children:[e.jsx(We,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(We,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认清除本地缓存"}),e.jsx(os,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:je,children:"确认清除"})]})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Ra,{className:"h-5 w-5"}),"导入/导出设置"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"导出当前的界面设置以便备份,或从之前导出的文件中恢复设置。"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(S,{variant:"outline",onClick:ge,disabled:D,className:"gap-2",children:[e.jsx(Ra,{className:"h-4 w-4"}),D?"导出中...":"导出设置"]}),e.jsx("input",{ref:z,type:"file",accept:".json",onChange:fe,className:"hidden"}),e.jsxs(S,{variant:"outline",onClick:()=>z.current?.click(),disabled:Y,className:"gap-2",children:[e.jsx(ur,{className:"h-4 w-4"}),Y?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(Qc,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重置所有设置"}),e.jsx(os,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:be,children:"确认重置"})]})]})]})})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs(S,{variant:"outline",disabled:r,className:"gap-2",children:[e.jsx(Qc,{className:F("h-4 w-4",r&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重新配置"}),e.jsx(os,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:Te,children:"确认重置"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(ka,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs(S,{variant:"destructive",className:"gap-2",children:[e.jsx(ka,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认触发错误"}),e.jsx(os,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>x(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function Y0(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:e.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),e.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:F("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",Pu]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",eo]}),e.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",e.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"React 19.2.0"}),e.jsx("li",{children:"TypeScript 5.7.2"}),e.jsx("li",{children:"Vite 6.0.7"}),e.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"shadcn/ui"}),e.jsx("li",{children:"Radix UI"}),e.jsx("li",{children:"Tailwind CSS 3.4.17"}),e.jsx("li",{children:"Lucide Icons"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"后端"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Python 3.12+"}),e.jsx("li",{children:"FastAPI"}),e.jsx("li",{children:"Uvicorn"}),e.jsx("li",{children:"WebSocket"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Bun / npm"}),e.jsx("li",{children:"ESLint 9.17.0"}),e.jsx("li",{children:"PostCSS"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),e.jsx(Je,{className:"h-[300px] sm:h-[400px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ps,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(Ps,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(Ps,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(Ps,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(Ps,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ps,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(Ps,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ps,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(Ps,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ps,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(Ps,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(Ps,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(Ps,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ps,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(Ps,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ps,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(Ps,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(Ps,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(Ps,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ps,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(Ps,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(Ps,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(Ps,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:e.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Ps({name:n,description:i,license:r}){return e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:n}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:i})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:r})]})}function zu({value:n,current:i,onChange:r,label:d,description:m}){const x=i===n;return e.jsxs("button",{onClick:()=>r(n),className:F("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:d}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:m})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[n==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),n==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),n==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function pa({value:n,current:i,onChange:r,label:d,colorClass:m}){const x=i===n;return e.jsxs("button",{onClick:()=>r(n),className:F("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:F("h-8 w-8 sm:h-10 sm:w-10 rounded-full",m)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:d})]})]})}class X0{grad3;p;perm;constructor(i=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let r=0;r<256;r++)this.p[r]=Math.floor(Math.random()*256);this.perm=[];for(let r=0;r<512;r++)this.perm[r]=this.p[r&255]}dot(i,r,d){return i[0]*r+i[1]*d}mix(i,r,d){return(1-d)*i+d*r}fade(i){return i*i*i*(i*(i*6-15)+10)}perlin2(i,r){const d=Math.floor(i)&255,m=Math.floor(r)&255;i-=Math.floor(i),r-=Math.floor(r);const x=this.fade(i),f=this.fade(r),p=this.perm[d]+m,g=this.perm[p],b=this.perm[p+1],j=this.perm[d+1]+m,y=this.perm[j],N=this.perm[j+1];return this.mix(this.mix(this.dot(this.grad3[g%12],i,r),this.dot(this.grad3[y%12],i-1,r),x),this.mix(this.dot(this.grad3[b%12],i,r-1),this.dot(this.grad3[N%12],i-1,r-1),x),f)}}function mp(){const n=u.useRef(null),i=u.useRef(null),r=u.useRef(void 0),d=u.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new X0(Math.random()),bounding:null});return u.useEffect(()=>{const m=i.current,x=n.current;if(!m||!x)return;const f=d.current,p=()=>{const U=m.getBoundingClientRect();f.bounding=U,x.style.width=`${U.width}px`,x.style.height=`${U.height}px`},g=()=>{if(!f.bounding)return;const{width:U,height:D}=f.bounding;f.lines=[],f.paths.forEach(ae=>ae.remove()),f.paths=[];const B=10,Y=32,L=U+200,z=D+30,X=Math.ceil(L/B),I=Math.ceil(z/Y),T=(U-B*X)/2,M=(D-Y*I)/2;for(let ae=0;ae<=X;ae++){const he=[];for(let ge=0;ge<=I;ge++){const fe={x:T+B*ae,y:M+Y*ge,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};he.push(fe)}const je=document.createElementNS("http://www.w3.org/2000/svg","path");x.appendChild(je),f.paths.push(je),f.lines.push(he)}},b=U=>{const{lines:D,mouse:B,noise:Y}=f;D.forEach(L=>{L.forEach(z=>{const X=Y.perlin2((z.x+U*.0125)*.002,(z.y+U*.005)*.0015)*12;z.wave.x=Math.cos(X)*32,z.wave.y=Math.sin(X)*16;const I=z.x-B.sx,T=z.y-B.sy,M=Math.hypot(I,T),ae=Math.max(175,B.vs);if(M{const B={x:U.x+U.wave.x+(D?U.cursor.x:0),y:U.y+U.wave.y+(D?U.cursor.y:0)};return B.x=Math.round(B.x*10)/10,B.y=Math.round(B.y*10)/10,B},y=()=>{const{lines:U,paths:D}=f;U.forEach((B,Y)=>{let L=j(B[0],!1),z=`M ${L.x} ${L.y}`;B.forEach((X,I)=>{const T=I===B.length-1;L=j(X,!T),z+=`L ${L.x} ${L.y}`}),D[Y].setAttribute("d",z)})},N=U=>{const{mouse:D}=f;D.sx+=(D.x-D.sx)*.1,D.sy+=(D.y-D.sy)*.1;const B=D.x-D.lx,Y=D.y-D.ly,L=Math.hypot(B,Y);D.v=L,D.vs+=(L-D.vs)*.1,D.vs=Math.min(100,D.vs),D.lx=D.x,D.ly=D.y,D.a=Math.atan2(Y,B),m&&(m.style.setProperty("--x",`${D.sx}px`),m.style.setProperty("--y",`${D.sy}px`)),b(U),y(),r.current=requestAnimationFrame(N)},k=U=>{if(!f.bounding)return;const{mouse:D}=f;D.x=U.pageX-f.bounding.left,D.y=U.pageY-f.bounding.top+window.scrollY,D.set||(D.sx=D.x,D.sy=D.y,D.lx=D.x,D.ly=D.y,D.set=!0)},w=()=>{p(),g()};return p(),g(),window.addEventListener("resize",w),window.addEventListener("mousemove",k),r.current=requestAnimationFrame(N),()=>{window.removeEventListener("resize",w),window.removeEventListener("mousemove",k),r.current&&cancelAnimationFrame(r.current)}},[]),e.jsxs("div",{ref:i,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:n,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` - path { - fill: none; - stroke: hsl(var(--primary) / 0.20); - stroke-width: 1px; - } - `})})]})}async function _e(n,i){const r={...i,credentials:"include",headers:{"Content-Type":"application/json",...i?.headers}},d=await fetch(n,r);if(d.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return d}function Ds(){return{"Content-Type":"application/json"}}async function K0(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(n){console.error("登出请求失败:",n)}window.location.href="/auth"}async function Wu(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}function J0(){const[n,i]=u.useState(""),[r,d]=u.useState(!1),[m,x]=u.useState(""),[f,p]=u.useState(!0),g=ba(),{enableWavesBackground:b,setEnableWavesBackground:j}=Lg(),{theme:y,setTheme:N}=Ju();u.useEffect(()=>{(async()=>{try{await Wu()&&g({to:"/"})}catch{}finally{p(!1)}})()},[g]);const w=y==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":y,U=()=>{N(w==="dark"?"light":"dark")},D=async B=>{if(B.preventDefault(),x(""),!n.trim()){x("请输入 Access Token");return}d(!0);try{const Y=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:n.trim()})}),L=await Y.json();Y.ok&&L.valid?L.is_first_setup?g({to:"/setup"}):g({to:"/"}):x(L.message||"Token 验证失败,请检查后重试")}catch(Y){console.error("Token 验证错误:",Y),x("连接服务器失败,请检查网络连接")}finally{d(!1)}};return f?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[b&&e.jsx(mp,{}),e.jsx("div",{className:"text-muted-foreground",children:"正在检查登录状态..."})]}):e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[b&&e.jsx(mp,{}),e.jsxs(Fe,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[e.jsx("button",{onClick:U,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(gg,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(jg,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(ts,{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(Wf,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(as,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(Zs,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(hs,{children:e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(vg,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(re,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:n,onChange:B=>i(B.target.value),className:F("pl-10",m&&"border-red-500 focus-visible:ring-red-500"),disabled:r,autoFocus:!0,autoComplete:"off"})]})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(Mt,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:m})]}),e.jsx(S,{type:"submit",className:"w-full",disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),e.jsxs(Hs,{children:[e.jsx(Zu,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(bg,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Os,{className:"sm:max-w-md",children:[e.jsxs(Rs,{children:[e.jsxs(Ls,{className:"flex items-center gap-2",children:[e.jsx(Wf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(Js,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ny,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),e.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),e.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ca,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),e.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:e.jsx("code",{className:"text-primary",children:"data/webui.json"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",e.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Mt,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"安全提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),e.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(an,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsxs(cs,{className:"flex items-center gap-2",children:[e.jsx(an,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(os,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>j(!1),children:"关闭动画"})]})]})]})]})})]}),e.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:e.jsx("p",{children:A0})})]})}const As=u.forwardRef(({className:n,...i},r)=>e.jsx("textarea",{className:F("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:r,...i}));As.displayName="Textarea";const hr=u.forwardRef(({className:n,orientation:i="horizontal",decorative:r=!0,...d},m)=>e.jsx(Vp,{ref:m,decorative:r,orientation:i,className:F("shrink-0 bg-border",i==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...d}));hr.displayName=Vp.displayName;function P0({config:n,onChange:i}){const r=m=>{m.trim()&&!n.alias_names.includes(m.trim())&&i({...n,alias_names:[...n.alias_names,m.trim()]})},d=m=>{i({...n,alias_names:n.alias_names.filter((x,f)=>f!==m)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(re,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:n.qq_account||"",onChange:m=>i({...n,qq_account:Number(m.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(re,{id:"nickname",placeholder:"请输入机器人的昵称",value:n.nickname,onChange:m=>i({...n,nickname:m.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:n.alias_names.map((m,x)=>e.jsxs($e,{variant:"secondary",className:"gap-1",children:[m,e.jsx("button",{type:"button",onClick:()=>d(x),className:"ml-1 hover:text-destructive",children:e.jsx(il,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:m=>{m.key==="Enter"&&(r(m.target.value),m.target.value="")}}),e.jsx(S,{type:"button",variant:"outline",onClick:()=>{const m=document.getElementById("alias_input");m&&(r(m.value),m.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function Z0({config:n,onChange:i}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(As,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:n.personality,onChange:r=>i({...n,personality:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(As,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:n.reply_style,onChange:r=>i({...n,reply_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(As,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:n.interest,onChange:r=>i({...n,interest:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(hr,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(As,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:n.plan_style,onChange:r=>i({...n,plan_style:r.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(As,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:n.private_plan_style,onChange:r=>i({...n,private_plan_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function W0({config:n,onChange:i}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(n.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(re,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:n.emoji_chance,onChange:r=>i({...n,emoji_chance:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(re,{id:"max_reg_num",type:"number",min:"1",max:"200",value:n.max_reg_num,onChange:r=>i({...n,max_reg_num:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx(Qe,{id:"do_replace",checked:n.do_replace,onCheckedChange:r=>i({...n,do_replace:r})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(re,{id:"check_interval",type:"number",min:"1",max:"120",value:n.check_interval,onChange:r=>i({...n,check_interval:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(hr,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx(Qe,{id:"steal_emoji",checked:n.steal_emoji,onCheckedChange:r=>i({...n,steal_emoji:r})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx(Qe,{id:"content_filtration",checked:n.content_filtration,onCheckedChange:r=>i({...n,content_filtration:r})})]}),n.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(re,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:n.filtration_prompt,onChange:r=>i({...n,filtration_prompt:r.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function ew({config:n,onChange:i}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx(Qe,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:r=>i({...n,enable_tool:r})})]}),e.jsx(hr,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"enable_mood",children:"启用情绪系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),e.jsx(Qe,{id:"enable_mood",checked:n.enable_mood,onCheckedChange:r=>i({...n,enable_mood:r})})]}),n.enable_mood&&e.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),e.jsx(re,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:n.mood_update_threshold||1,onChange:r=>i({...n,mood_update_threshold:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"emotion_style",children:"情感特征"}),e.jsx(As,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:n.emotion_style||"",onChange:r=>i({...n,emotion_style:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),e.jsx(hr,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx(Qe,{id:"all_global",checked:n.all_global,onCheckedChange:r=>i({...n,all_global:r})})]})]})}function sw({config:n,onChange:i}){const[r,d]=u.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx(Fc,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{id:"siliconflow_api_key",type:r?"text":"password",placeholder:"sk-...",value:n.api_key,onChange:m=>i({api_key:m.target.value}),className:"font-mono pr-10"}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>d(!r),children:r?e.jsx(dr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Rt,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[e.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[e.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),e.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),e.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),e.jsx("li",{children:"SenseVoice - 语音识别"}),e.jsx("li",{children:"BGE-M3 - 文本嵌入"}),e.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),e.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:e.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function tw(){const n=await _e("/api/webui/config/bot",{method:"GET",headers:Ds()});if(!n.ok)throw new Error("读取Bot配置失败");const r=(await n.json()).config.bot||{};return{qq_account:r.qq_account||0,nickname:r.nickname||"",alias_names:r.alias_names||[]}}async function aw(){const n=await _e("/api/webui/config/bot",{method:"GET",headers:Ds()});if(!n.ok)throw new Error("读取人格配置失败");const r=(await n.json()).config.personality||{};return{personality:r.personality||"",reply_style:r.reply_style||"",interest:r.interest||"",plan_style:r.plan_style||"",private_plan_style:r.private_plan_style||""}}async function lw(){const n=await _e("/api/webui/config/bot",{method:"GET",headers:Ds()});if(!n.ok)throw new Error("读取表情包配置失败");const r=(await n.json()).config.emoji||{};return{emoji_chance:r.emoji_chance??.4,max_reg_num:r.max_reg_num??40,do_replace:r.do_replace??!0,check_interval:r.check_interval??10,steal_emoji:r.steal_emoji??!0,content_filtration:r.content_filtration??!1,filtration_prompt:r.filtration_prompt||""}}async function nw(){const n=await _e("/api/webui/config/bot",{method:"GET",headers:Ds()});if(!n.ok)throw new Error("读取其他配置失败");const r=(await n.json()).config,d=r.tool||{},m=r.mood||{},x=r.jargon||{};return{enable_tool:d.enable_tool??!0,enable_mood:m.enable_mood??!1,mood_update_threshold:m.mood_update_threshold,emotion_style:m.emotion_style,all_global:x.all_global??!0}}async function iw(){const n=await _e("/api/webui/config/model",{method:"GET",headers:Ds()});if(!n.ok)throw new Error("读取模型配置失败");return{api_key:((await n.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function rw(n){const i=await _e("/api/webui/config/bot/section/bot",{method:"POST",headers:Ds(),body:JSON.stringify(n)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存Bot基础配置失败")}return await i.json()}async function cw(n){const i=await _e("/api/webui/config/bot/section/personality",{method:"POST",headers:Ds(),body:JSON.stringify(n)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存人格配置失败")}return await i.json()}async function ow(n){const i=await _e("/api/webui/config/bot/section/emoji",{method:"POST",headers:Ds(),body:JSON.stringify(n)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存表情包配置失败")}return await i.json()}async function dw(n){const i=[];i.push(_e("/api/webui/config/bot/section/tool",{method:"POST",headers:Ds(),body:JSON.stringify({enable_tool:n.enable_tool})})),i.push(_e("/api/webui/config/bot/section/jargon",{method:"POST",headers:Ds(),body:JSON.stringify({all_global:n.all_global})}));const r={enable_mood:n.enable_mood};n.enable_mood&&(r.mood_update_threshold=n.mood_update_threshold||1,r.emotion_style=n.emotion_style||""),i.push(_e("/api/webui/config/bot/section/mood",{method:"POST",headers:Ds(),body:JSON.stringify(r)}));const d=await Promise.all(i);for(const m of d)if(!m.ok){const x=await m.json();throw new Error(x.detail||"保存其他配置失败")}return{success:!0}}async function uw(n){const i=await _e("/api/webui/config/model",{method:"GET",headers:Ds()});if(!i.ok)throw new Error("读取模型配置失败");const d=(await i.json()).config,m=d.api_providers||[],x=m.findIndex(g=>g.name==="SiliconFlow");x>=0?m[x]={...m[x],api_key:n.api_key}:m.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:n.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const f={...d,api_providers:m},p=await _e("/api/webui/config/model",{method:"POST",headers:Ds(),body:JSON.stringify(f)});if(!p.ok){const g=await p.json();throw new Error(g.detail||"保存模型配置失败")}return await p.json()}async function xp(){const n=localStorage.getItem("access-token"),i=await _e("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${n}`}});if(!i.ok){const r=await i.json();throw new Error(r.message||"标记配置完成失败")}return await i.json()}async function so(){const n=await _e("/api/webui/system/restart",{method:"POST",headers:Ds()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"重启失败")}return await n.json()}async function qg(){const n=await _e("/api/webui/system/status",{method:"GET",headers:Ds()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取状态失败")}return await n.json()}function mw(){const n=ba(),{toast:i}=qs(),[r,d]=u.useState(0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),[g,b]=u.useState(!0),[j,y]=u.useState({qq_account:0,nickname:"",alias_names:[]}),[N,k]=u.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.请控制你的发言频率,不要太过频繁的发言 -4.如果有人对你感到厌烦,请减少回复 -5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[w,U]=u.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[D,B]=u.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遇遇特定事件的时候起伏较大",all_global:!0}),[Y,L]=u.useState({api_key:""}),[z,X]=u.useState(!1),[I,T]=u.useState(""),M=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:lr},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:Xc},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Yu},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:ai},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:vg}],ae=(r+1)/M.length*100;u.useEffect(()=>{(async()=>{try{b(!0);const[V,q,se,R,ue]=await Promise.all([tw(),aw(),lw(),nw(),iw()]);y(V),k(q),U(se),B(R),L(ue)}catch(V){i({title:"加载配置失败",description:V instanceof Error?V.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{b(!1)}})()},[i]);const he=async()=>{p(!0);try{switch(r){case 0:await rw(j);break;case 1:await cw(N);break;case 2:await ow(w);break;case 3:await dw(D);break;case 4:await uw(Y);break}return i({title:"保存成功",description:`${M[r].title}配置已保存`}),!0}catch(O){return i({title:"保存失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},je=async()=>{await he()&&r{r>0&&d(r-1)},fe=async()=>{x(!0),X(!0);try{if(T("正在保存API配置..."),!await he()){x(!1),X(!1);return}T("正在完成初始化..."),await xp(),T("正在重启麦麦..."),await so(),i({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),T("等待麦麦重启完成...");const V=60;let q=0,se=!1;for(;qsetTimeout(R,1e3));try{(await qg()).running&&(se=!0,T("重启成功!正在跳转..."))}catch{q++}}if(!se)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{n({to:"/"})},1e3)}catch(O){X(!1),i({title:"配置失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}finally{x(!1)}},be=async()=>{try{await xp(),n({to:"/"})}catch(O){i({title:"跳过失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}},Te=()=>{switch(r){case 0:return e.jsx(P0,{config:j,onChange:y});case 1:return e.jsx(Z0,{config:N,onChange:k});case 2:return e.jsx(W0,{config:w,onChange:U});case 3:return e.jsx(ew,{config:D,onChange:B});case 4:return e.jsx(sw,{config:Y,onChange:L});default:return null}};return e.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[z&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[e.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(Ws,{className:"h-10 w-10 animate-spin text-primary"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),e.jsx("p",{className:"text-muted-foreground",children:I})]}),e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),e.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),g?e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:e.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),e.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[e.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(iy,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),e.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",Pu," 的初始配置"]})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",r+1," / ",M.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(ae),"%"]})]}),e.jsx(ii,{value:ae,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:M.map((O,V)=>{const q=O.icon;return e.jsxs("div",{className:F("flex flex-1 flex-col items-center gap-1 md:gap-2",Vn({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Wc,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(S,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx(ei,{className:"h-4 w-4"}),"返回上一页"]})]}),e.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}const xw=gt.memo(function({config:i,onChange:r}){const d=()=>{r({...i,platforms:[...i.platforms,""]})},m=b=>{r({...i,platforms:i.platforms.filter((j,y)=>y!==b)})},x=(b,j)=>{const y=[...i.platforms];y[b]=j,r({...i,platforms:y})},f=()=>{r({...i,alias_names:[...i.alias_names,""]})},p=b=>{r({...i,alias_names:i.alias_names.filter((j,y)=>y!==b)})},g=(b,j)=>{const y=[...i.alias_names];y[b]=j,r({...i,alias_names:y})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"platform",children:"平台"}),e.jsx(re,{id:"platform",value:i.platform,onChange:b=>r({...i,platform:b.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(re,{id:"qq_account",value:i.qq_account,onChange:b=>r({...i,qq_account:b.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称"}),e.jsx(re,{id:"nickname",value:i.nickname,onChange:b=>r({...i,nickname:b.target.value}),placeholder:"麦麦"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"其他平台账号"}),e.jsxs(S,{onClick:d,size:"sm",variant:"outline",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[i.platforms.map((b,j)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:b,onChange:y=>x(j,y.target.value),placeholder:"wx:114514"}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除平台账号 "',b||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>m(j),children:"删除"})]})]})]})]},j)),i.platforms.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"别名"}),e.jsxs(S,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[i.alias_names.map((b,j)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:b,onChange:y=>g(j,y.target.value),placeholder:"小麦"}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除别名 "',b||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>p(j),children:"删除"})]})]})]})]},j)),i.alias_names.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}),hw=gt.memo(function({config:i,onChange:r}){const d=()=>{r({...i,states:[...i.states,""]})},m=f=>{r({...i,states:i.states.filter((p,g)=>g!==f)})},x=(f,p)=>{const g=[...i.states];g[f]=p,r({...i,states:g})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"personality",children:"人格特质"}),e.jsx(As,{id:"personality",value:i.personality,onChange:f=>r({...i,personality:f.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(As,{id:"reply_style",value:i.reply_style,onChange:f=>r({...i,reply_style:f.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"interest",children:"兴趣"}),e.jsx(As,{id:"interest",value:i.interest,onChange:f=>r({...i,interest:f.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(As,{id:"plan_style",value:i.plan_style,onChange:f=>r({...i,plan_style:f.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(As,{id:"visual_style",value:i.visual_style,onChange:f=>r({...i,visual_style:f.target.value}),placeholder:"识图时的处理规则",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"private_plan_style",children:"私聊规则"}),e.jsx(As,{id:"private_plan_style",value:i.private_plan_style,onChange:f=>r({...i,private_plan_style:f.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"状态列表(人格多样性)"}),e.jsxs(S,{onClick:d,size:"sm",variant:"outline",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),e.jsx("div",{className:"space-y-2",children:i.states.map((f,p)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(As,{value:f,onChange:g=>x(p,g.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsx(os,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>m(p),children:"删除"})]})]})]})]},p))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"state_probability",children:"状态替换概率"}),e.jsx(re,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:i.state_probability,onChange:f=>r({...i,state_probability:parseFloat(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}),Ue=BN,Be=HN,Oe=u.forwardRef(({className:n,children:i,...r},d)=>e.jsxs(eg,{ref:d,className:F("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...r,children:[i,e.jsx(DN,{asChild:!0,children:e.jsx(Ll,{className:"h-4 w-4 opacity-50"})})]}));Oe.displayName=eg.displayName;const Fg=u.forwardRef(({className:n,...i},r)=>e.jsx(sg,{ref:r,className:F("flex cursor-default items-center justify-center py-1",n),...i,children:e.jsx(mr,{className:"h-4 w-4"})}));Fg.displayName=sg.displayName;const Vg=u.forwardRef(({className:n,...i},r)=>e.jsx(tg,{ref:r,className:F("flex cursor-default items-center justify-center py-1",n),...i,children:e.jsx(Ll,{className:"h-4 w-4"})}));Vg.displayName=tg.displayName;const Re=u.forwardRef(({className:n,children:i,position:r="popper",...d},m)=>e.jsx(ON,{children:e.jsxs(ag,{ref:m,className:F("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg 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 origin-[--radix-select-content-transform-origin]",r==="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",n),position:r,...d,children:[e.jsx(Fg,{}),e.jsx(RN,{className:F("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:i}),e.jsx(Vg,{})]})}));Re.displayName=ag.displayName;const fw=u.forwardRef(({className:n,...i},r)=>e.jsx(lg,{ref:r,className:F("px-2 py-1.5 text-sm font-semibold",n),...i}));fw.displayName=lg.displayName;const le=u.forwardRef(({className:n,children:i,...r},d)=>e.jsxs(ng,{ref:d,className:F("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...r,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(LN,{children:e.jsx($t,{className:"h-4 w-4"})})}),e.jsx(UN,{children:i})]}));le.displayName=ng.displayName;const pw=u.forwardRef(({className:n,...i},r)=>e.jsx(ig,{ref:r,className:F("-mx-1 my-1 h-px bg-muted",n),...i}));pw.displayName=ig.displayName;const Ua=xN,Ba=hN,Ta=u.forwardRef(({className:n,align:i="center",sideOffset:r=4,...d},m)=>e.jsx(mN,{children:e.jsx($p,{ref:m,align:i,sideOffset:r,className:F("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 origin-[--radix-popover-content-transform-origin]",n),...d})}));Ta.displayName=$p.displayName;const gw=gt.memo(function({value:i,onChange:r}){const[d,m]=u.useState("00"),[x,f]=u.useState("00"),[p,g]=u.useState("23"),[b,j]=u.useState("59");u.useEffect(()=>{const N=i.split("-");if(N.length===2){const[k,w]=N,[U,D]=k.split(":"),[B,Y]=w.split(":");U&&m(U.padStart(2,"0")),D&&f(D.padStart(2,"0")),B&&g(B.padStart(2,"0")),Y&&j(Y.padStart(2,"0"))}},[i]);const y=(N,k,w,U)=>{const D=`${N}:${k}-${w}:${U}`;r(D)};return e.jsxs(Ua,{children:[e.jsx(Ba,{asChild:!0,children:e.jsxs(S,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(Zn,{className:"h-4 w-4 mr-2"}),i||"选择时间段"]})}),e.jsx(Ta,{className:"w-72 sm:w-80",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"小时"}),e.jsxs(Ue,{value:d,onValueChange:N=>{m(N),y(N,x,p,b)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:24},(N,k)=>k).map(N=>e.jsx(le,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"分钟"}),e.jsxs(Ue,{value:x,onValueChange:N=>{f(N),y(d,N,p,b)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:60},(N,k)=>k).map(N=>e.jsx(le,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"小时"}),e.jsxs(Ue,{value:p,onValueChange:N=>{g(N),y(d,x,N,b)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:24},(N,k)=>k).map(N=>e.jsx(le,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"分钟"}),e.jsxs(Ue,{value:b,onValueChange:N=>{j(N),y(d,x,p,N)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:60},(N,k)=>k).map(N=>e.jsx(le,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]})]})})]})}),jw=gt.memo(function({rule:i}){const r=`{ target = "${i.target}", time = "${i.time}", value = ${i.value.toFixed(1)} }`;return e.jsxs(Ua,{children:[e.jsx(Ba,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",children:[e.jsx(Rt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ta,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:r}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})}),vw=gt.memo(function({config:i,onChange:r}){const d=()=>{r({...i,talk_value_rules:[...i.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},m=f=>{r({...i,talk_value_rules:i.talk_value_rules.filter((p,g)=>g!==f)})},x=(f,p,g)=>{const b=[...i.talk_value_rules];b[f]={...b[f],[p]:g},r({...i,talk_value_rules:b})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(re,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:i.talk_value,onChange:f=>r({...i,talk_value:parseFloat(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"mentioned_bot_reply",checked:i.mentioned_bot_reply,onCheckedChange:f=>r({...i,mentioned_bot_reply:f})}),e.jsx(C,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(re,{id:"max_context_size",type:"number",min:"1",value:i.max_context_size,onChange:f=>r({...i,max_context_size:parseInt(f.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(re,{id:"planner_smooth",type:"number",step:"1",min:"0",value:i.planner_smooth,onChange:f=>r({...i,planner_smooth:parseFloat(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"enable_talk_value_rules",checked:i.enable_talk_value_rules,onCheckedChange:f=>r({...i,enable_talk_value_rules:f})}),e.jsx(C,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"include_planner_reasoning",checked:i.include_planner_reasoning,onCheckedChange:f=>r({...i,include_planner_reasoning:f})}),e.jsx(C,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),i.enable_talk_value_rules&&e.jsxs("div",{className:"border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),e.jsxs(S,{onClick:d,size:"sm",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),i.talk_value_rules&&i.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:i.talk_value_rules.map((f,p)=>e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",p+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(jw,{rule:f}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",children:e.jsx(We,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除规则 #",p+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>m(p),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Ue,{value:f.target===""?"global":"specific",onValueChange:g=>{g==="global"?x(p,"target",""):x(p,"target","qq::group")},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"global",children:"全局配置"}),e.jsx(le,{value:"specific",children:"详细配置"})]})]})]}),f.target!==""&&(()=>{const g=f.target.split(":"),b=g[0]||"qq",j=g[1]||"",y=g[2]||"group";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ue,{value:b,onValueChange:N=>{x(p,"target",`${N}:${j}:${y}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(re,{value:j,onChange:N=>{x(p,"target",`${b}:${N.target.value}:${y}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ue,{value:y,onValueChange:N=>{x(p,"target",`${b}:${j}:${N}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"group",children:"群组(group)"}),e.jsx(le,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",f.target||"(未设置)"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(gw,{value:f.time,onChange:g=>x(p,"time",g)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{htmlFor:`rule-value-${p}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(re,{id:`rule-value-${p}`,type:"number",step:"0.01",min:"0.01",max:"1",value:f.value,onChange:g=>{const b=parseFloat(g.target.value);isNaN(b)||x(p,"value",Math.max(.01,Math.min(1,b)))},className:"w-20 h-8 text-xs"})]}),e.jsx(ga,{value:[f.value],onValueChange:g=>x(p,"value",g[0]),min:.01,max:1,step:.01,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0.01 (极少发言)"}),e.jsx("span",{children:"0.5"}),e.jsx("span",{children:"1.0 (正常)"})]})]})]})]},p))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),e.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}),bw=gt.memo(function({config:i,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{checked:i.enable_mood,onCheckedChange:d=>r({...i,enable_mood:d})}),e.jsx(C,{className:"cursor-pointer",children:"启用情绪系统"})]}),i.enable_mood&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"情绪更新阈值"}),e.jsx(re,{type:"number",min:"1",value:i.mood_update_threshold,onChange:d=>r({...i,mood_update_threshold:parseInt(d.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"情感特征"}),e.jsx(As,{value:i.emotion_style,onChange:d=>r({...i,emotion_style:d.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}),Nw=gt.memo(function({config:i,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{checked:i.enable_asr,onCheckedChange:d=>r({...i,enable_asr:d})}),e.jsx(C,{className:"cursor-pointer",children:"启用语音识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}),yw=gt.memo(function({config:i,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{checked:i.enable,onCheckedChange:d=>r({...i,enable:d})}),e.jsx(C,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),i.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"LPMM 模式"}),e.jsxs(Ue,{value:i.lpmm_mode,onValueChange:d=>r({...i,lpmm_mode:d}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"classic",children:"经典模式"}),e.jsx(le,{value:"agent",children:"Agent 模式"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"同义词搜索 TopK"}),e.jsx(re,{type:"number",min:"1",value:i.rag_synonym_search_top_k,onChange:d=>r({...i,rag_synonym_search_top_k:parseInt(d.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"同义词阈值"}),e.jsx(re,{type:"number",step:"0.1",min:"0",max:"1",value:i.rag_synonym_threshold,onChange:d=>r({...i,rag_synonym_threshold:parseFloat(d.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"实体提取线程数"}),e.jsx(re,{type:"number",min:"1",value:i.info_extraction_workers,onChange:d=>r({...i,info_extraction_workers:parseInt(d.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"嵌入向量维度"}),e.jsx(re,{type:"number",min:"1",value:i.embedding_dimension,onChange:d=>r({...i,embedding_dimension:parseInt(d.target.value)})})]})]})]})]})]})}),ww=gt.memo(function({config:i,onChange:r}){const[d,m]=u.useState(""),[x,f]=u.useState("WARNING"),p=()=>{d&&!i.suppress_libraries.includes(d)&&(r({...i,suppress_libraries:[...i.suppress_libraries,d]}),m(""))},g=w=>{r({...i,suppress_libraries:i.suppress_libraries.filter(U=>U!==w)})},b=()=>{d&&!i.library_log_levels[d]&&(r({...i,library_log_levels:{...i.library_log_levels,[d]:x}}),m(""),f("WARNING"))},j=w=>{const U={...i.library_log_levels};delete U[w],r({...i,library_log_levels:U})},y=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],N=["FULL","compact","lite"],k=["none","title","full"];return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"日期格式"}),e.jsx(re,{value:i.date_style,onChange:w=>r({...i,date_style:w.target.value}),placeholder:"例如: m-d H:i:s"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"日志级别样式"}),e.jsxs(Ue,{value:i.log_level_style,onValueChange:w=>r({...i,log_level_style:w}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:N.map(w=>e.jsx(le,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"日志文本颜色"}),e.jsxs(Ue,{value:i.color_text,onValueChange:w=>r({...i,color_text:w}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:k.map(w=>e.jsx(le,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"全局日志级别"}),e.jsxs(Ue,{value:i.log_level,onValueChange:w=>r({...i,log_level:w}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:y.map(w=>e.jsx(le,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"控制台日志级别"}),e.jsxs(Ue,{value:i.console_log_level,onValueChange:w=>r({...i,console_log_level:w}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:y.map(w=>e.jsx(le,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"文件日志级别"}),e.jsxs(Ue,{value:i.file_log_level,onValueChange:w=>r({...i,file_log_level:w}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:y.map(w=>e.jsx(le,{value:w,children:w},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:d,onChange:w=>m(w.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),p())}}),e.jsx(S,{onClick:p,size:"sm",className:"flex-shrink-0",children:e.jsx(ct,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.suppress_libraries.map(w=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[e.jsx("span",{className:"text-sm",children:w}),e.jsx(S,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>g(w),children:e.jsx(We,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},w))})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:d,onChange:w=>m(w.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Ue,{value:x,onValueChange:f,children:[e.jsx(Oe,{className:"w-32",children:e.jsx(Be,{})}),e.jsx(Re,{children:y.map(w=>e.jsx(le,{value:w,children:w},w))})]}),e.jsx(S,{onClick:b,size:"sm",children:e.jsx(ct,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(i.library_log_levels).map(([w,U])=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-medium",children:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:U}),e.jsx(S,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>j(w),children:e.jsx(We,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},w))})]})]})}),_w=gt.memo(function({config:i,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx(Qe,{checked:i.show_prompt,onCheckedChange:d=>r({...i,show_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx(Qe,{checked:i.show_replyer_prompt,onCheckedChange:d=>r({...i,show_replyer_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx(Qe,{checked:i.show_replyer_reasoning,onCheckedChange:d=>r({...i,show_replyer_reasoning:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx(Qe,{checked:i.show_jargon_prompt,onCheckedChange:d=>r({...i,show_jargon_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx(Qe,{checked:i.show_memory_prompt,onCheckedChange:d=>r({...i,show_memory_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx(Qe,{checked:i.show_planner_prompt,onCheckedChange:d=>r({...i,show_planner_prompt:d})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx(Qe,{checked:i.show_lpmm_paragraph,onCheckedChange:d=>r({...i,show_lpmm_paragraph:d})})]})]})]})}),Sw=gt.memo(function({config:i,onChange:r}){const[d,m]=u.useState(""),x=()=>{d&&!i.auth_token.includes(d)&&(r({...i,auth_token:[...i.auth_token,d]}),m(""))},f=p=>{r({...i,auth_token:i.auth_token.filter((g,b)=>b!==p)})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"启用自定义服务器"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),e.jsx(Qe,{checked:i.use_custom,onCheckedChange:p=>r({...i,use_custom:p})})]}),i.use_custom&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"主机地址"}),e.jsx(re,{value:i.host,onChange:p=>r({...i,host:p.target.value}),placeholder:"127.0.0.1"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"端口号"}),e.jsx(re,{type:"number",value:i.port,onChange:p=>r({...i,port:parseInt(p.target.value)}),placeholder:"8090"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"连接模式"}),e.jsxs(Ue,{value:i.mode,onValueChange:p=>r({...i,mode:p}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"ws",children:"WebSocket (ws)"}),e.jsx(le,{value:"tcp",children:"TCP"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{checked:i.use_wss,onCheckedChange:p=>r({...i,use_wss:p}),disabled:i.mode!=="ws"}),e.jsx(C,{children:"使用 WSS 安全连接"})]})]}),i.use_wss&&i.mode==="ws"&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"SSL 证书文件路径"}),e.jsx(re,{value:i.cert_file,onChange:p=>r({...i,cert_file:p.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"SSL 密钥文件路径"}),e.jsx(re,{value:i.key_file,onChange:p=>r({...i,key_file:p.target.value}),placeholder:"key.pem"})]})]})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"认证令牌"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:d,onChange:p=>m(p.target.value),placeholder:"输入认证令牌",onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),x())}}),e.jsx(S,{onClick:x,size:"sm",children:e.jsx(ct,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:i.auth_token.map((p,g)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:p}),e.jsx(S,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>f(g),children:e.jsx(We,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},g))})]})]})}),Cw=gt.memo(function({config:i,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx(Qe,{checked:i.enable,onCheckedChange:d=>r({...i,enable:d})})]})]})}),kw=gt.memo(function({emojiConfig:i,memoryConfig:r,toolConfig:d,onEmojiChange:m,onMemoryChange:x,onToolChange:f}){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"enable_tool",checked:d.enable_tool,onCheckedChange:p=>f({...d,enable_tool:p})}),e.jsx(C,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(re,{id:"max_agent_iterations",type:"number",min:"1",value:r.max_agent_iterations,onChange:p=>x({...r,max_agent_iterations:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(re,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:i.emoji_chance,onChange:p=>m({...i,emoji_chance:parseFloat(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(re,{id:"max_reg_num",type:"number",min:"1",value:i.max_reg_num,onChange:p=>m({...i,max_reg_num:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(re,{id:"check_interval",type:"number",min:"1",value:i.check_interval,onChange:p=>m({...i,check_interval:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"do_replace",checked:i.do_replace,onCheckedChange:p=>m({...i,do_replace:p})}),e.jsx(C,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"steal_emoji",checked:i.steal_emoji,onCheckedChange:p=>m({...i,steal_emoji:p})}),e.jsx(C,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"content_filtration",checked:i.content_filtration,onCheckedChange:p=>m({...i,content_filtration:p})}),e.jsx(C,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),i.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(C,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(re,{id:"filtration_prompt",value:i.filtration_prompt,onChange:p=>m({...i,filtration_prompt:p.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),Tw=gt.memo(function({member:i,groupIndex:r,memberIndex:d,availableChatIds:m,onUpdate:x,onRemove:f}){const p=m.includes(i)||i==="*",[g,b]=u.useState(!p);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:g?e.jsxs(e.Fragment,{children:[e.jsx(re,{value:i,onChange:j=>x(r,d,j.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),m.length>0&&e.jsx(S,{size:"sm",variant:"outline",onClick:()=>b(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ue,{value:i,onValueChange:j=>x(r,d,j),children:[e.jsx(Oe,{className:"flex-1",children:e.jsx(Be,{placeholder:"选择聊天流"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"*",children:"* (全局共享)"}),m.map((j,y)=>e.jsx(le,{value:j,children:j},y))]})]}),e.jsx(S,{size:"sm",variant:"outline",onClick:()=>b(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除组成员 "',i||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>f(r,d),children:"删除"})]})]})]})]})}),Ew=gt.memo(function({config:i,onChange:r}){const d=()=>{r({...i,learning_list:[...i.learning_list,["","enable","enable","1.0"]]})},m=N=>{r({...i,learning_list:i.learning_list.filter((k,w)=>w!==N)})},x=(N,k,w)=>{const U=[...i.learning_list];U[N][k]=w,r({...i,learning_list:U})},f=({rule:N})=>{const k=`["${N[0]}", "${N[1]}", "${N[2]}", "${N[3]}"]`;return e.jsxs(Ua,{children:[e.jsx(Ba,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",children:[e.jsx(Rt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ta,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:k}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},p=()=>{r({...i,expression_groups:[...i.expression_groups,[]]})},g=N=>{r({...i,expression_groups:i.expression_groups.filter((k,w)=>w!==N)})},b=N=>{const k=[...i.expression_groups];k[N]=[...k[N],""],r({...i,expression_groups:k})},j=(N,k)=>{const w=[...i.expression_groups];w[N]=w[N].filter((U,D)=>D!==k),r({...i,expression_groups:w})},y=(N,k,w)=>{const U=[...i.expression_groups];U[N][k]=w,r({...i,expression_groups:U})};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),e.jsxs(S,{onClick:d,size:"sm",variant:"outline",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[i.learning_list.map((N,k)=>{const w=i.learning_list.some((z,X)=>X!==k&&z[0]===""),U=N[0]==="",D=N[0].split(":"),B=D[0]||"qq",Y=D[1]||"",L=D[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["规则 ",k+1," ",U&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{rule:N}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除学习规则 ",k+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>m(k),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Ue,{value:U?"global":"specific",onValueChange:z=>{z==="global"?x(k,0,""):x(k,0,"qq::group")},disabled:w&&!U,children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"global",children:"全局配置"}),e.jsx(le,{value:"specific",disabled:w&&!U,children:"详细配置"})]})]}),w&&!U&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!U&&e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ue,{value:B,onValueChange:z=>{x(k,0,`${z}:${Y}:${L}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(re,{value:Y,onChange:z=>{x(k,0,`${B}:${z.target.value}:${L}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ue,{value:L,onValueChange:z=>{x(k,0,`${B}:${Y}:${z}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"group",children:"群组(group)"}),e.jsx(le,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",N[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Qe,{checked:N[1]==="enable",onCheckedChange:z=>x(k,1,z?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx(Qe,{checked:N[2]==="enable",onCheckedChange:z=>x(k,2,z?"enable":"disable")})]})}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-xs font-medium",children:"学习强度"}),e.jsx(re,{type:"number",step:"0.1",min:"0",max:"5",value:N[3],onChange:z=>{const X=parseFloat(z.target.value);isNaN(X)||x(k,3,Math.max(0,Math.min(5,X)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),e.jsx(ga,{value:[parseFloat(N[3])||1],onValueChange:z=>x(k,3,z[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0 (不学习)"}),e.jsx("span",{children:"2.5"}),e.jsx("span",{children:"5.0 (快速学习)"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},k)}),i.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达反思配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦主动向管理员询问表达方式是否合适的功能"})]}),e.jsx(Qe,{checked:i.reflect,onCheckedChange:N=>r({...i,reflect:N})})]}),i.reflect&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"反思操作员"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const k=(i.reflect_operator_id||"").split(":"),w=k[0]||"qq",U=k[1]||"",D=k[2]||"private";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ue,{value:w,onValueChange:B=>{r({...i,reflect_operator_id:`${B}:${U}:${D}`})},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(re,{value:U,onChange:B=>{r({...i,reflect_operator_id:`${w}:${B.target.value}:${D}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ue,{value:D,onValueChange:B=>{r({...i,reflect_operator_id:`${w}:${U}:${B}`})},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"private",children:"私聊(private)"}),e.jsx(le,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",i.reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会向此操作员询问表达方式是否合适"})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"允许反思的聊天流"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思"})]}),e.jsxs(S,{onClick:()=>{r({...i,allow_reflect:[...i.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(i.allow_reflect||[]).map((N,k)=>{const w=N.split(":"),U=w[0]||"qq",D=w[1]||"",B=w[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Ue,{value:U,onValueChange:Y=>{const L=[...i.allow_reflect];L[k]=`${Y}:${D}:${B}`,r({...i,allow_reflect:L})},children:[e.jsx(Oe,{className:"w-24",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]}),e.jsx(re,{value:D,onChange:Y=>{const L=[...i.allow_reflect];L[k]=`${U}:${Y.target.value}:${B}`,r({...i,allow_reflect:L})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Ue,{value:B,onValueChange:Y=>{const L=[...i.allow_reflect];L[k]=`${U}:${D}:${Y}`,r({...i,allow_reflect:L})},children:[e.jsx(Oe,{className:"w-32",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"group",children:"群组"}),e.jsx(le,{value:"private",children:"私聊"})]})]}),e.jsx(S,{onClick:()=>{r({...i,allow_reflect:i.allow_reflect.filter((Y,L)=>L!==k)})},size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})]},k)}),(!i.allow_reflect||i.allow_reflect.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:"列表为空,所有聊天流都可以进行表达反思"})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),e.jsxs(S,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[i.expression_groups.map((N,k)=>{const w=i.learning_list.map(U=>U[0]).filter(U=>U!=="");return e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",k+1,N.length===1&&N[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{onClick:()=>b(k),size:"sm",variant:"outline",children:e.jsx(ct,{className:"h-4 w-4"})}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除共享组 ",k+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>g(k),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:N.map((U,D)=>e.jsx(Tw,{member:U,groupIndex:k,memberIndex:D,availableChatIds:w,onUpdate:y,onRemove:j},`${k}-${D}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},k)}),i.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})});function zw({regex:n,reaction:i,onRegexChange:r,onReactionChange:d}){const[m,x]=u.useState(!1),[f,p]=u.useState(""),[g,b]=u.useState(null),[j,y]=u.useState(""),[N,k]=u.useState({}),[w,U]=u.useState(""),D=u.useRef(null),[B,Y]=u.useState("build"),L=T=>T.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),z=(T,M=0)=>{const ae=D.current;if(!ae)return;const he=ae.selectionStart||0,je=ae.selectionEnd||0,ge=n.substring(0,he)+T+n.substring(je);r(ge),setTimeout(()=>{const fe=he+T.length+M;ae.setSelectionRange(fe,fe),ae.focus()},0)};u.useEffect(()=>{if(!n||!f){b(null),k({}),U(i),y("");return}try{const T=L(n),M=new RegExp(T,"g"),ae=f.match(M);b(ae),y("");const je=new RegExp(T).exec(f);if(je&&je.groups){k(je.groups);let ge=i;Object.entries(je.groups).forEach(([fe,be])=>{ge=ge.replace(new RegExp(`\\[${fe}\\]`,"g"),be||"")}),U(ge)}else k({}),U(i)}catch(T){y(T.message),b(null),k({}),U(i)}},[n,f,i]);const X=()=>{if(!f||!g||g.length===0)return e.jsx("span",{className:"text-muted-foreground",children:f||"请输入测试文本"});try{const T=L(n),M=new RegExp(T,"g");let ae=0;const he=[];let je;for(;(je=M.exec(f))!==null;)je.index>ae&&he.push(e.jsx("span",{children:f.substring(ae,je.index)},`text-${ae}`)),he.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:je[0]},`match-${je.index}`)),ae=je.index+je[0].length;return ae)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return e.jsxs(Hs,{open:m,onOpenChange:x,children:[e.jsx(Zu,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",children:[e.jsx(Xu,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Os,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"正则表达式编辑器"}),e.jsx(Js,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(Je,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(ja,{value:B,onValueChange:T=>Y(T),className:"w-full",children:[e.jsxs(la,{className:"grid w-full grid-cols-2",children:[e.jsx(ss,{value:"build",children:"🔧 构建器"}),e.jsx(ss,{value:"test",children:"🧪 测试器"})]}),e.jsxs(ys,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(re,{ref:D,value:n,onChange:T=>r(T.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(As,{value:i,onChange:T=>d(T.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[I.map(T=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:T.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:T.items.map(M=>e.jsx(S,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>z(M.pattern,M.moveCursor||0),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("span",{className:"text-xs font-medium",children:M.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:M.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:M.desc})]})},M.label))})]},T.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("^(?P\\S{1,20})是这样的$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),e.jsx(S,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),e.jsx(S,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?P.+?)(?:是|为什么|怎么)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),e.jsxs("li",{children:["命名捕获组格式:",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),e.jsxs("li",{children:["在 reaction 中使用 ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),e.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),e.jsxs(ys,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:n||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(As,{id:"test-text",value:f,onChange:T=>p(T.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),j&&e.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),e.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:j})]}),!j&&f&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:g&&g.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",g.length," 处)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(Je,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:X()})})]}),Object.keys(N).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(Je,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(N).map(([T,M])=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",T,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:M})]},T))})})]}),Object.keys(N).length>0&&i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(Je,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:w})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),e.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),e.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),e.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})}const Mw=gt.memo(function({keywordReactionConfig:i,responsePostProcessConfig:r,chineseTypoConfig:d,responseSplitterConfig:m,onKeywordReactionChange:x,onResponsePostProcessChange:f,onChineseTypoChange:p,onResponseSplitterChange:g}){const b=()=>{x({...i,regex_rules:[...i.regex_rules,{regex:[""],reaction:""}]})},j=z=>{x({...i,regex_rules:i.regex_rules.filter((X,I)=>I!==z)})},y=(z,X,I)=>{const T=[...i.regex_rules];X==="regex"&&typeof I=="string"?T[z]={...T[z],regex:[I]}:X==="reaction"&&typeof I=="string"&&(T[z]={...T[z],reaction:I}),x({...i,regex_rules:T})},N=()=>{x({...i,keyword_rules:[...i.keyword_rules,{keywords:[],reaction:""}]})},k=z=>{x({...i,keyword_rules:i.keyword_rules.filter((X,I)=>I!==z)})},w=(z,X,I)=>{const T=[...i.keyword_rules];typeof I=="string"&&(T[z]={...T[z],reaction:I}),x({...i,keyword_rules:T})},U=z=>{const X=[...i.keyword_rules];X[z]={...X[z],keywords:[...X[z].keywords||[],""]},x({...i,keyword_rules:X})},D=(z,X)=>{const I=[...i.keyword_rules];I[z]={...I[z],keywords:(I[z].keywords||[]).filter((T,M)=>M!==X)},x({...i,keyword_rules:I})},B=(z,X,I)=>{const T=[...i.keyword_rules],M=[...T[z].keywords||[]];M[X]=I,T[z]={...T[z],keywords:M},x({...i,keyword_rules:T})},Y=({rule:z})=>{const X=`{ regex = [${(z.regex||[]).map(I=>`"${I}"`).join(", ")}], reaction = "${z.reaction}" }`;return e.jsxs(Ua,{children:[e.jsx(Ba,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",children:[e.jsx(Rt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ta,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Je,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:X})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},L=({rule:z})=>{const X=`[[keyword_reaction.keyword_rules]] -keywords = [${(z.keywords||[]).map(I=>`"${I}"`).join(", ")}] -reaction = "${z.reaction}"`;return e.jsxs(Ua,{children:[e.jsx(Ba,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",children:[e.jsx(Rt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ta,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Je,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:X})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),e.jsxs(S,{onClick:b,size:"sm",variant:"outline",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[i.regex_rules.map((z,X)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",X+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(zw,{regex:z.regex&&z.regex[0]||"",reaction:z.reaction,onRegexChange:I=>y(X,"regex",I),onReactionChange:I=>y(X,"reaction",I)}),e.jsx(Y,{rule:z}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除正则规则 ",X+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>j(X),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(re,{value:z.regex&&z.regex[0]||"",onChange:I=>y(X,"regex",I.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(As,{value:z.reaction,onChange:I=>y(X,"reaction",I.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},X)),i.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),e.jsxs(S,{onClick:N,size:"sm",variant:"outline",children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[i.keyword_rules.map((z,X)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",X+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{rule:z}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除关键词规则 ",X+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>k(X),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(S,{onClick:()=>U(X),size:"sm",variant:"ghost",children:[e.jsx(ct,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(z.keywords||[]).map((I,T)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{value:I,onChange:M=>B(X,T,M.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(S,{onClick:()=>D(X,T),size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})]},T)),(!z.keywords||z.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(As,{value:z.reaction,onChange:I=>w(X,"reaction",I.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},X)),i.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"enable_response_post_process",checked:r.enable_response_post_process,onCheckedChange:z=>f({...r,enable_response_post_process:z})}),e.jsx(C,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),r.enable_response_post_process&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Qe,{id:"enable_chinese_typo",checked:d.enable,onCheckedChange:z=>p({...d,enable:z})}),e.jsx(C,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),d.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),e.jsx(re,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:d.error_rate,onChange:z=>p({...d,error_rate:parseFloat(z.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(re,{id:"min_freq",type:"number",min:"0",value:d.min_freq,onChange:z=>p({...d,min_freq:parseInt(z.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),e.jsx(re,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:d.tone_error_rate,onChange:z=>p({...d,tone_error_rate:parseFloat(z.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),e.jsx(re,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:d.word_replace_rate,onChange:z=>p({...d,word_replace_rate:parseFloat(z.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Qe,{id:"enable_response_splitter",checked:m.enable,onCheckedChange:z=>g({...m,enable:z})}),e.jsx(C,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),m.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(re,{id:"max_length",type:"number",min:"1",value:m.max_length,onChange:z=>g({...m,max_length:parseInt(z.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(re,{id:"max_sentence_num",type:"number",min:"1",value:m.max_sentence_num,onChange:z=>g({...m,max_sentence_num:parseInt(z.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"enable_kaomoji_protection",checked:m.enable_kaomoji_protection,onCheckedChange:z=>g({...m,enable_kaomoji_protection:z})}),e.jsx(C,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"enable_overflow_return_all",checked:m.enable_overflow_return_all,onCheckedChange:z=>g({...m,enable_overflow_return_all:z})}),e.jsx(C,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),Ul="/api/webui/config";async function hp(){const i=await(await _e(`${Ul}/bot`)).json();if(!i.success)throw new Error("获取配置数据失败");return i.config}async function Wn(){const i=await(await _e(`${Ul}/model`)).json();if(!i.success)throw new Error("获取模型配置数据失败");return i.config}async function fp(n){const r=await(await _e(`${Ul}/bot`,{method:"POST",body:JSON.stringify(n)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function Aw(){const i=await(await _e(`${Ul}/bot/raw`)).json();if(!i.success)throw new Error("获取配置源代码失败");return i.content}async function Dw(n){const r=await(await _e(`${Ul}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:n})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function Pc(n){const r=await(await _e(`${Ul}/model`,{method:"POST",body:JSON.stringify(n)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function Ow(n,i){const d=await(await _e(`${Ul}/bot/section/${n}`,{method:"POST",body:JSON.stringify(i)})).json();if(!d.success)throw new Error(d.message||`保存配置节 ${n} 失败`)}async function Fu(n,i){const d=await(await _e(`${Ul}/model/section/${n}`,{method:"POST",body:JSON.stringify(i)})).json();if(!d.success)throw new Error(d.message||`保存配置节 ${n} 失败`)}async function Rw(n,i="openai",r="/models"){const d=new URLSearchParams({provider_name:n,parser:i,endpoint:r}),m=await _e(`/api/webui/models/list?${d}`);if(!m.ok){const f=await m.json().catch(()=>({}));throw new Error(f.detail||`获取模型列表失败 (${m.status})`)}const x=await m.json();if(!x.success)throw new Error("获取模型列表失败");return x.models}async function Lw(n){const i=new URLSearchParams({provider_name:n}),r=await _e(`/api/webui/models/test-connection-by-name?${i}`,{method:"POST"});if(!r.ok){const d=await r.json().catch(()=>({}));throw new Error(d.detail||`测试连接失败 (${r.status})`)}return await r.json()}const Uw=ti("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Qt=u.forwardRef(({className:n,variant:i,...r},d)=>e.jsx("div",{ref:d,role:"alert",className:F(Uw({variant:i}),n),...r}));Qt.displayName="Alert";const Bw=u.forwardRef(({className:n,...i},r)=>e.jsx("h5",{ref:r,className:F("mb-1 font-medium leading-none tracking-tight",n),...i}));Bw.displayName="AlertTitle";const It=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{ref:r,className:F("text-sm [&_p]:leading-relaxed",n),...i}));It.displayName="AlertDescription";function em({onRestartComplete:n,onRestartFailed:i}){const[r,d]=u.useState(0),[m,x]=u.useState("restarting"),[f,p]=u.useState(0),[g,b]=u.useState(0);u.useEffect(()=>{const N=setInterval(()=>{d(U=>U>=90?U:U+1)},200),k=setInterval(()=>{p(U=>U+1)},1e3),w=setTimeout(()=>{x("checking"),j()},3e3);return()=>{clearInterval(N),clearInterval(k),clearTimeout(w)}},[]);const j=()=>{const k=async()=>{try{if(b(U=>U+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)d(100),x("success"),setTimeout(()=>{n?.()},1500);else throw new Error("Status check failed")}catch{g<60?setTimeout(k,2e3):(x("failed"),i?.())}};k()},y=N=>{const k=Math.floor(N/60),w=N%60;return`${k}:${w.toString().padStart(2,"0")}`};return e.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:e.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[m==="restarting"&&e.jsxs(e.Fragment,{children:[e.jsx(Ws,{className:"h-16 w-16 text-primary animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),m==="checking"&&e.jsxs(e.Fragment,{children:[e.jsx(Ws,{className:"h-16 w-16 text-primary animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),e.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",g,"/60)"]})]}),m==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(aa,{className:"h-16 w-16 text-green-500"}),e.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),m==="failed"&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{className:"h-16 w-16 text-destructive"}),e.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),m!=="failed"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(ii,{value:r,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[r,"%"]}),e.jsxs("span",{children:["已用时: ",y(f)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[m==="restarting"&&"🔄 配置已保存,正在重启主程序...",m==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",m==="success"&&"✅ 配置已生效,服务运行正常",m==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),m==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),e.jsx("button",{onClick:()=>{x("checking"),b(0),j()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}const Hw={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(n,i){let r;if(!i.inString&&(r=n.match(/^('''|"""|'|")/))&&(i.stringType=r[0],i.inString=!0),n.sol()&&!i.inString&&i.inArray===0&&(i.lhs=!0),i.inString){for(;i.inString;)if(n.match(i.stringType))i.inString=!1;else if(n.peek()==="\\")n.next(),n.next();else{if(n.eol())break;n.match(/^.[^\\\"\']*/)}return i.lhs?"property":"string"}else{if(i.inArray&&n.peek()==="]")return n.next(),i.inArray--,"bracket";if(i.lhs&&n.peek()==="["&&n.skipTo("]"))return n.next(),n.peek()==="]"&&n.next(),"atom";if(n.peek()==="#")return n.skipToEnd(),"comment";if(n.eatSpace())return null;if(i.lhs&&n.eatWhile(function(d){return d!="="&&d!=" "}))return"property";if(i.lhs&&n.peek()==="=")return n.next(),i.lhs=!1,null;if(!i.lhs&&n.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!i.lhs&&(n.match("true")||n.match("false")))return"atom";if(!i.lhs&&n.peek()==="[")return i.inArray++,n.next(),"bracket";if(!i.lhs&&n.match(/^\-?\d+(?:\.\d+)?/))return"number";n.eatSpace()||n.next()}return null},languageData:{commentTokens:{line:"#"}}},qw={python:[Ay()],json:[Dy(),Oy()],toml:[My.define(Hw)],text:[]};function Gw({value:n,onChange:i,language:r="text",readOnly:d=!1,height:m="400px",minHeight:x,maxHeight:f,placeholder:p,theme:g="dark",className:b=""}){const[j,y]=u.useState(!1);if(u.useEffect(()=>{y(!0)},[]),!j)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${b}`,style:{height:m,minHeight:x,maxHeight:f}});const N=[...qw[r]||[],ap.lineWrapping];return d&&N.push(ap.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${b}`,children:e.jsx(Ry,{value:n,height:m,minHeight:x,maxHeight:f,theme:g==="dark"?Ly:void 0,extensions:N,onChange:i,placeholder:p,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function Fw(n,i,r,d={}){const{debounceMs:m=2e3,onSaveSuccess:x,onSaveError:f}=d,p=u.useRef(null),g=u.useCallback(async(N,k)=>{try{i(!0),await Ow(N,k),r(!1),x?.()}catch(w){console.error(`自动保存 ${N} 失败:`,w),r(!0),f?.(w instanceof Error?w:new Error(String(w)))}finally{i(!1)}},[i,r,x,f]),b=u.useCallback((N,k)=>{n||(r(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{g(N,k)},m))},[n,r,g,m]),j=u.useCallback(async(N,k)=>{p.current&&(clearTimeout(p.current),p.current=null),await g(N,k)},[g]),y=u.useCallback(()=>{p.current&&(clearTimeout(p.current),p.current=null)},[]);return u.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),{triggerAutoSave:b,saveNow:j,cancelPendingAutoSave:y}}function wt(n,i,r,d){u.useEffect(()=>{n&&!r&&d(i,n)},[n])}const Vw=500;function $w(){const[n,i]=u.useState(!0),[r,d]=u.useState(!1),[m,x]=u.useState(!1),[f,p]=u.useState(!1),[g,b]=u.useState(!1),[j,y]=u.useState(!1),[N,k]=u.useState("visual"),[w,U]=u.useState(""),[D,B]=u.useState(!1),{toast:Y}=qs(),[L,z]=u.useState(null),[X,I]=u.useState(null),[T,M]=u.useState(null),[ae,he]=u.useState(null),[je,ge]=u.useState(null),[fe,be]=u.useState(null),[Te,O]=u.useState(null),[V,q]=u.useState(null),[se,R]=u.useState(null),[ue,xe]=u.useState(null),[ke,we]=u.useState(null),[Me,pe]=u.useState(null),[ee,ie]=u.useState(null),[$,Z]=u.useState(null),[Ee,qe]=u.useState(null),[E,me]=u.useState(null),[Ie,Se]=u.useState(null),[J,Ne]=u.useState(null),Ce=u.useRef(!0),Gs=u.useRef({}),ws=u.useCallback(ve=>{Gs.current=ve,z(ve.bot),I(ve.personality);const _s=ve.chat;_s.talk_value_rules||(_s.talk_value_rules=[]),M(_s),he(ve.expression),ge(ve.emoji),be(ve.memory),O(ve.tool),q(ve.mood),R(ve.voice),xe(ve.lpmm_knowledge),we(ve.keyword_reaction),pe(ve.response_post_process),ie(ve.chinese_typo),Z(ve.response_splitter),qe(ve.log),me(ve.debug),Se(ve.maim_message),Ne(ve.telemetry)},[]),bt=u.useCallback(()=>({...Gs.current,bot:L,personality:X,chat:T,expression:ae,emoji:je,memory:fe,tool:Te,mood:V,voice:se,lpmm_knowledge:ue,keyword_reaction:ke,response_post_process:Me,chinese_typo:ee,response_splitter:$,log:Ee,debug:E,maim_message:Ie,telemetry:J}),[L,X,T,ae,je,fe,Te,V,se,ue,ke,Me,ee,$,Ee,E,Ie,J]),ut=u.useCallback(async()=>{try{const ve=await Aw();U(ve),B(!1)}catch(ve){Y({variant:"destructive",title:"加载失败",description:ve instanceof Error?ve.message:"加载源代码失败"})}},[Y]),Us=u.useCallback(async()=>{try{i(!0);const ve=await hp();ws(ve),p(!1),Ce.current=!1,await ut()}catch(ve){console.error("加载配置失败:",ve),Y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{i(!1)}},[Y,ut,ws]);u.useEffect(()=>{Us()},[Us]);const{triggerAutoSave:ks,cancelPendingAutoSave:na}=Fw(Ce.current,x,p);wt(L,"bot",Ce.current,ks),wt(X,"personality",Ce.current,ks),wt(T,"chat",Ce.current,ks),wt(ae,"expression",Ce.current,ks),wt(je,"emoji",Ce.current,ks),wt(fe,"memory",Ce.current,ks),wt(Te,"tool",Ce.current,ks),wt(V,"mood",Ce.current,ks),wt(se,"voice",Ce.current,ks),wt(ue,"lpmm_knowledge",Ce.current,ks),wt(ke,"keyword_reaction",Ce.current,ks),wt(Me,"response_post_process",Ce.current,ks),wt(ee,"chinese_typo",Ce.current,ks),wt($,"response_splitter",Ce.current,ks),wt(Ee,"log",Ce.current,ks),wt(E,"debug",Ce.current,ks),wt(Ie,"maim_message",Ce.current,ks),wt(J,"telemetry",Ce.current,ks);const K=async()=>{try{d(!0),await Dw(w),p(!1),B(!1),Y({title:"保存成功",description:"配置已保存"}),await Us()}catch(ve){B(!0),Y({variant:"destructive",title:"保存失败",description:ve instanceof Error?ve.message:"保存配置失败"})}finally{d(!1)}},Ge=async ve=>{if(f){Y({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(k(ve),ve==="source")await ut();else try{const _s=await hp();ws(_s),p(!1)}catch(_s){console.error("加载配置失败:",_s),Y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},Ae=async()=>{try{d(!0),na(),await fp(bt()),p(!1),Y({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ve){console.error("保存配置失败:",ve),Y({title:"保存失败",description:ve.message,variant:"destructive"})}finally{d(!1)}},Xe=async()=>{try{b(!0),so().catch(()=>{}),y(!0)}catch(ve){console.error("重启失败:",ve),y(!1),Y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),b(!1)}},Vs=async()=>{try{d(!0),na(),await fp(bt()),p(!1),Y({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(ve=>setTimeout(ve,Vw)),await Xe()}catch(ve){console.error("保存失败:",ve),Y({title:"保存失败",description:ve.message,variant:"destructive"})}finally{d(!1)}},Pe=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},$s=()=>{y(!1),b(!1),Y({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return n?e.jsx(Je,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"麦麦主程序配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"管理麦麦的核心功能和行为设置"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(S,{onClick:N==="visual"?Ae:K,disabled:r||m||!f||g,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(jr,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:r?"保存中":m?"自动":f?"保存":"已保存"})]}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs(S,{disabled:r||m||g,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(gr,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:g?"重启中":f?"保存重启":"重启"})]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重启麦麦?"}),e.jsx(os,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:f?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:f?Vs:Xe,children:f?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(ja,{value:N,onValueChange:ve=>Ge(ve),className:"w-full",children:e.jsxs(la,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(ss,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(oy,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(ss,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(dy,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(Qt,{children:[e.jsx(La,{className:"h-4 w-4"}),e.jsxs(It,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),N==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Qt,{children:[e.jsx(La,{className:"h-4 w-4"}),e.jsxs(It,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",D&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(Gw,{value:w,onChange:ve=>{U(ve),p(!0),D&&B(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),N==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(ja,{defaultValue:"bot",className:"w-full",children:[e.jsxs(la,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(ss,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(ss,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(ss,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(ss,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(ss,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(ss,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(ss,{value:"mood",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"情绪"}),e.jsx(ss,{value:"voice",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"语音"}),e.jsx(ss,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(ss,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(ys,{value:"bot",className:"space-y-4",children:L&&e.jsx(xw,{config:L,onChange:z})}),e.jsx(ys,{value:"personality",className:"space-y-4",children:X&&e.jsx(hw,{config:X,onChange:I})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:T&&e.jsx(vw,{config:T,onChange:M})}),e.jsx(ys,{value:"expression",className:"space-y-4",children:ae&&e.jsx(Ew,{config:ae,onChange:he})}),e.jsx(ys,{value:"features",className:"space-y-4",children:je&&fe&&Te&&e.jsx(kw,{emojiConfig:je,memoryConfig:fe,toolConfig:Te,onEmojiChange:ge,onMemoryChange:be,onToolChange:O})}),e.jsx(ys,{value:"processing",className:"space-y-4",children:ke&&Me&&ee&&$&&e.jsx(Mw,{keywordReactionConfig:ke,responsePostProcessConfig:Me,chineseTypoConfig:ee,responseSplitterConfig:$,onKeywordReactionChange:we,onResponsePostProcessChange:pe,onChineseTypoChange:ie,onResponseSplitterChange:Z})}),e.jsx(ys,{value:"mood",className:"space-y-4",children:V&&e.jsx(bw,{config:V,onChange:q})}),e.jsx(ys,{value:"voice",className:"space-y-4",children:se&&e.jsx(Nw,{config:se,onChange:R})}),e.jsx(ys,{value:"lpmm",className:"space-y-4",children:ue&&e.jsx(yw,{config:ue,onChange:xe})}),e.jsxs(ys,{value:"other",className:"space-y-4",children:[Ee&&e.jsx(ww,{config:Ee,onChange:qe}),E&&e.jsx(_w,{config:E,onChange:me}),Ie&&e.jsx(Sw,{config:Ie,onChange:Se}),J&&e.jsx(Cw,{config:J,onChange:Ne})]})]})}),j&&e.jsx(em,{onRestartComplete:Pe,onRestartFailed:$s})]})})}const rn=u.forwardRef(({className:n,...i},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:F("w-full caption-bottom text-sm",n),...i})}));rn.displayName="Table";const cn=u.forwardRef(({className:n,...i},r)=>e.jsx("thead",{ref:r,className:F("[&_tr]:border-b",n),...i}));cn.displayName="TableHeader";const on=u.forwardRef(({className:n,...i},r)=>e.jsx("tbody",{ref:r,className:F("[&_tr:last-child]:border-0",n),...i}));on.displayName="TableBody";const Qw=u.forwardRef(({className:n,...i},r)=>e.jsx("tfoot",{ref:r,className:F("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n),...i}));Qw.displayName="TableFooter";const ot=u.forwardRef(({className:n,...i},r)=>e.jsx("tr",{ref:r,className:F("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n),...i}));ot.displayName="TableRow";const Ke=u.forwardRef(({className:n,...i},r)=>e.jsx("th",{ref:r,className:F("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...i}));Ke.displayName="TableHead";const Ve=u.forwardRef(({className:n,...i},r)=>e.jsx("td",{ref:r,className:F("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...i}));Ve.displayName="TableCell";const Iw=u.forwardRef(({className:n,...i},r)=>e.jsx("caption",{ref:r,className:F("mt-4 text-sm text-muted-foreground",n),...i}));Iw.displayName="TableCaption";const to=u.forwardRef(({className:n,...i},r)=>e.jsx(Yt,{ref:r,className:F("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",n),...i}));to.displayName=Yt.displayName;const ao=u.forwardRef(({className:n,...i},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(At,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Yt.Input,{ref:r,className:F("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",n),...i})]}));ao.displayName=Yt.Input.displayName;const lo=u.forwardRef(({className:n,...i},r)=>e.jsx(Yt.List,{ref:r,className:F("max-h-[300px] overflow-y-auto overflow-x-hidden",n),...i}));lo.displayName=Yt.List.displayName;const no=u.forwardRef((n,i)=>e.jsx(Yt.Empty,{ref:i,className:"py-6 text-center text-sm",...n}));no.displayName=Yt.Empty.displayName;const fr=u.forwardRef(({className:n,...i},r)=>e.jsx(Yt.Group,{ref:r,className:F("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",n),...i}));fr.displayName=Yt.Group.displayName;const Yw=u.forwardRef(({className:n,...i},r)=>e.jsx(Yt.Separator,{ref:r,className:F("-mx-1 h-px bg-border",n),...i}));Yw.displayName=Yt.Separator.displayName;const pr=u.forwardRef(({className:n,...i},r)=>e.jsx(Yt.Item,{ref:r,className:F("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n),...i}));pr.displayName=Yt.Item.displayName;const dt=u.forwardRef(({className:n,...i},r)=>e.jsx(rg,{ref:r,className:F("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...i,children:e.jsx(qN,{className:F("grid place-content-center text-current"),children:e.jsx($t,{className:"h-4 w-4"})})}));dt.displayName=rg.displayName;const $g=u.createContext(null),Qg="maibot-completed-tours";function Xw(){try{const n=localStorage.getItem(Qg);return n?new Set(JSON.parse(n)):new Set}catch{return new Set}}function pp(n){localStorage.setItem(Qg,JSON.stringify([...n]))}function Kw({children:n}){const[i,r]=u.useState({activeTourId:null,stepIndex:0,isRunning:!1}),d=u.useRef(new Map),[,m]=u.useState(0),[x,f]=u.useState(Xw),p=u.useCallback((L,z)=>{d.current.set(L,z),m(X=>X+1)},[]),g=u.useCallback(L=>{d.current.delete(L),r(z=>z.activeTourId===L?{...z,activeTourId:null,isRunning:!1,stepIndex:0}:z)},[]),b=u.useCallback((L,z=0)=>{d.current.has(L)&&r({activeTourId:L,stepIndex:z,isRunning:!0})},[]),j=u.useCallback(()=>{r(L=>({...L,isRunning:!1}))},[]),y=u.useCallback(L=>{r(z=>({...z,stepIndex:L}))},[]),N=u.useCallback(()=>{r(L=>({...L,stepIndex:L.stepIndex+1}))},[]),k=u.useCallback(()=>{r(L=>({...L,stepIndex:Math.max(0,L.stepIndex-1)}))},[]),w=u.useCallback(()=>i.activeTourId?d.current.get(i.activeTourId)||[]:[],[i.activeTourId]),U=u.useCallback(L=>{f(z=>{const X=new Set(z);return X.add(L),pp(X),X})},[]),D=u.useCallback(L=>{const{action:z,index:X,status:I,type:T}=L,M=["finished","skipped"];if(z==="close"){r(ae=>({...ae,isRunning:!1,stepIndex:0}));return}M.includes(I)?r(ae=>(I==="finished"&&ae.activeTourId&&setTimeout(()=>U(ae.activeTourId),0),{...ae,isRunning:!1,stepIndex:0})):T==="step:after"&&(z==="next"?r(ae=>({...ae,stepIndex:X+1})):z==="prev"&&r(ae=>({...ae,stepIndex:X-1})))},[U]),B=u.useCallback(L=>x.has(L),[x]),Y=u.useCallback(L=>{f(z=>{const X=new Set(z);return X.delete(L),pp(X),X})},[]);return e.jsx($g.Provider,{value:{state:i,tours:d.current,registerTour:p,unregisterTour:g,startTour:b,stopTour:j,goToStep:y,nextStep:N,prevStep:k,getCurrentSteps:w,handleJoyrideCallback:D,isTourCompleted:B,markTourCompleted:U,resetTourCompleted:Y},children:n})}function sm(){const n=u.useContext($g);if(!n)throw new Error("useTour must be used within a TourProvider");return n}const Jw={options:{zIndex:1e4,primaryColor:"hsl(var(--primary))",textColor:"hsl(var(--foreground))",backgroundColor:"hsl(var(--background))",arrowColor:"hsl(var(--background))",overlayColor:"rgba(0, 0, 0, 0.5)"},tooltip:{borderRadius:"var(--radius)",padding:"1rem"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"1rem",fontWeight:600,marginBottom:"0.5rem"},tooltipContent:{fontSize:"0.875rem",padding:"0.5rem 0"},buttonNext:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",borderRadius:"calc(var(--radius) - 2px)",fontSize:"0.875rem",padding:"0.5rem 1rem"},buttonBack:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem",marginRight:"0.5rem"},buttonSkip:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem"},buttonClose:{color:"hsl(var(--muted-foreground))"},spotlight:{borderRadius:"var(--radius)"}},Pw={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function Zw(){const{state:n,getCurrentSteps:i,handleJoyrideCallback:r}=sm(),d=i(),[m,x]=u.useState(!1),f=u.useRef(n.stepIndex),p=u.useRef(null);u.useEffect(()=>{f.current!==n.stepIndex&&(x(!1),f.current=n.stepIndex)},[n.stepIndex]),u.useEffect(()=>{if(!n.isRunning||d.length===0){x(!1);return}const j=d[n.stepIndex];if(!j){x(!1);return}const y=j.target;if(y==="body"){x(!0);return}x(!1);const N=setTimeout(()=>{const k=()=>{const B=document.querySelector(y);if(B){const Y=B.getBoundingClientRect();if(Y.width>0&&Y.height>0)return!0}return!1};if(k()){setTimeout(()=>x(!0),100);return}const w=setInterval(()=>{k()&&(clearInterval(w),setTimeout(()=>x(!0),100))},100),U=setTimeout(()=>{clearInterval(w),x(!0)},5e3),D=()=>{clearInterval(w),clearTimeout(U)};p.current=D},150);return()=>{clearTimeout(N),p.current&&(p.current(),p.current=null)}},[n.isRunning,n.stepIndex,d]);const g=u.useRef(null);if(u.useEffect(()=>{let j=document.getElementById("tour-portal-container");return j||(j=document.createElement("div"),j.id="tour-portal-container",j.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(j)),g.current=j,()=>{}},[]),!n.isRunning||d.length===0||!m)return null;const b=e.jsx(Uy,{steps:d,stepIndex:n.stepIndex,run:n.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:r,styles:Jw,locale:Pw,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${n.stepIndex}`);return g.current?qb.createPortal(b,g.current):b}const Da="model-assignment-tour",Ig=[{target:"body",content:"本引导旨在帮助你配置模型提供商和对应的模型,并为麦麦的各个组件分配合适的模型。",placement:"center",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="sidebar-model-provider"]',content:'第一步,你需要配置模型提供商。模型提供商决定了你要使用谁家的模型,无论是单一厂商(如 DeepSeek),还是模型平台(如 Siliconflow),都可以在这里进行配置。点击"下一步"进入配置页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-provider-button"]',content:'点击"添加提供商"按钮,开始配置你的模型提供商。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="provider-dialog"]',content:"在这里,你可以选择你想要配置的模型提供商,填写相关信息后保存即可。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-name-input"]',content:"这里的名称是你为这个模型提供商起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-apikey-input"]',content:"这里需要填写你从模型提供商那里获取的 API 密钥,用于验证和调用模型服务。对于不同的提供商,获取 API 密钥的方式可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-url-input"]',content:"这里需要填写模型提供商的 API 访问地址,确保填写正确以便系统能够连接到模型服务。对于不同的提供商,API 地址可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-template-select"]',content:"当然,如果你不知道如何填写这些信息,很多模型提供商在这里都提供了预设的模板供你选择,选择对应的模板后,相关信息会自动填充。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-save-button"]',content:"填写完所有信息后,点击保存按钮,模型提供商就配置完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-cancel-button"]',content:"因为这次咱们什么都没有填写,所以点击取消按钮退出吧。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="sidebar-model-management"]',content:'配置好模型提供商后,接下来我们需要为麦麦添加模型并分配功能。点击"下一步"进入模型管理页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-model-button"]',content:'在为麦麦的组件分配模型之前,首先需要添加你想要分配的模型,点击"添加模型"按钮开始添加。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="model-dialog"]',content:"在这里,你可以选择你之前配置好的模型提供商,然后选择对应的模型来添加。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-name-input"]',content:"这里的模型名称是你为这个模型起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-provider-select"]',content:"在这里选择你之前配置好的模型提供商,这样系统才能知道你要添加哪个提供商的模型。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-identifier-input"]',content:"这里需要填写你想要添加的模型的标识符,不同的模型提供商可能有不同的标识符格式,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-save-button"]',content:"填写完所有信息后,点击保存按钮,模型就添加完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-cancel-button"]',content:"当然,因为这次咱们什么都没有填写,所以直接点击取消按钮退出吧,等你准备好了再来添加模型。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="tasks-tab-trigger"]',content:'最后一步,添加好模型后,切换到"为模型分配功能"标签页,为麦麦的各个组件分配合适的模型。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="task-model-select"]',content:"在这里,你可以为每个组件选择一个或多个合适的模型,选择完成后配置会自动保存。恭喜你完成了模型配置的学习!",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1}],Yg={0:"/config/model",1:"/config/model",2:"/config/modelProvider",3:"/config/modelProvider",4:"/config/modelProvider",5:"/config/modelProvider",6:"/config/modelProvider",7:"/config/modelProvider",8:"/config/modelProvider",9:"/config/modelProvider",10:"/config/modelProvider",11:"/config/model",12:"/config/model",13:"/config/model",14:"/config/model",15:"/config/model",16:"/config/model",17:"/config/model",18:"/config/model",19:"/config/model"},nr=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini",modelFetcher:{endpoint:"/models",parser:"gemini"}},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function gp(n){return n?n.replace(/\/+$/,"").toLowerCase():""}function Ww(n){if(!n)return null;const i=gp(n);return nr.find(r=>r.id!=="custom"&&gp(r.base_url)===i)||null}function e1(){const[n,i]=u.useState([]),[r,d]=u.useState(!0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),[g,b]=u.useState(!1),[j,y]=u.useState(!1),[N,k]=u.useState(!1),[w,U]=u.useState(!1),[D,B]=u.useState(null),[Y,L]=u.useState(null),[z,X]=u.useState("custom"),[I,T]=u.useState(!1),[M,ae]=u.useState(!1),[he,je]=u.useState(null),[ge,fe]=u.useState(!1),[be,Te]=u.useState(""),[O,V]=u.useState(new Set),[q,se]=u.useState(!1),[R,ue]=u.useState(1),[xe,ke]=u.useState(20),[we,Me]=u.useState(""),[pe,ee]=u.useState({}),[ie,$]=u.useState(new Set),[Z,Ee]=u.useState(new Map),{toast:qe}=qs(),E=ba(),{state:me,goToStep:Ie,registerTour:Se}=sm(),J=u.useRef(null),Ne=u.useRef(!0);u.useEffect(()=>{Se(Da,Ig)},[Se]),u.useEffect(()=>{if(me.activeTourId===Da&&me.isRunning){const _=Yg[me.stepIndex];_&&!window.location.pathname.endsWith(_.replace("/config/",""))&&E({to:_})}},[me.stepIndex,me.activeTourId,me.isRunning,E]);const Ce=u.useRef(me.stepIndex);u.useEffect(()=>{if(me.activeTourId===Da&&me.isRunning){const _=Ce.current,G=me.stepIndex;_>=3&&_<=9&&G<3&&U(!1),_>=10&&G>=3&&G<=9&&(ee({}),X("custom"),B({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),L(null),fe(!1),U(!0)),Ce.current=G}},[me.stepIndex,me.activeTourId,me.isRunning]),u.useEffect(()=>{if(me.activeTourId!==Da||!me.isRunning)return;const _=G=>{const ye=G.target,Ts=me.stepIndex;Ts===2&&ye.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Ie(3),300):Ts===9&&ye.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>Ie(10),300)};return document.addEventListener("click",_,!0),()=>document.removeEventListener("click",_,!0)},[me,Ie]),u.useEffect(()=>{Gs()},[]);const Gs=async()=>{try{d(!0);const _=await Wn();i(_.api_providers||[]),b(!1),Ne.current=!1}catch(_){console.error("加载配置失败:",_)}finally{d(!1)}},ws=async()=>{try{y(!0),so().catch(()=>{}),k(!0)}catch(_){console.error("重启失败:",_),k(!1),qe({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),y(!1)}},bt=async()=>{try{x(!0),J.current&&clearTimeout(J.current);const _=await Wn();_.api_providers=n,await Pc(_),b(!1),qe({title:"保存成功",description:"正在重启麦麦..."}),await ws()}catch(_){console.error("保存配置失败:",_),qe({title:"保存失败",description:_.message,variant:"destructive"}),x(!1)}},ut=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Us=()=>{k(!1),y(!1),qe({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},ks=u.useCallback(async _=>{if(!Ne.current)try{p(!0),await Fu("api_providers",_),b(!1)}catch(G){console.error("自动保存失败:",G),b(!0)}finally{p(!1)}},[]);u.useEffect(()=>{if(!Ne.current)return b(!0),J.current&&clearTimeout(J.current),J.current=setTimeout(()=>{ks(n)},2e3),()=>{J.current&&clearTimeout(J.current)}},[n,ks]);const na=async()=>{try{x(!0),J.current&&clearTimeout(J.current);const _=await Wn();_.api_providers=n,await Pc(_),b(!1),qe({title:"保存成功",description:"模型提供商配置已保存"})}catch(_){console.error("保存配置失败:",_),qe({title:"保存失败",description:_.message,variant:"destructive"})}finally{x(!1)}},K=(_,G)=>{if(ee({}),_){const ye=nr.find(Ts=>Ts.base_url===_.base_url&&Ts.client_type===_.client_type);X(ye?.id||"custom"),B(_)}else X("custom"),B({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});L(G),fe(!1),U(!0)},Ge=_=>{X(_),T(!1);const G=nr.find(ye=>ye.id===_);G&&G.id!=="custom"?B(ye=>({...ye,name:G.name,base_url:G.base_url,client_type:G.client_type})):G?.id==="custom"&&B(ye=>({...ye,name:"",base_url:"",client_type:"openai"}))},Ae=u.useMemo(()=>z!=="custom",[z]),Xe=async()=>{if(D?.api_key)try{await navigator.clipboard.writeText(D.api_key),qe({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{qe({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},Vs=()=>{if(!D)return;const _={};if(D.name?.trim()||(_.name="请输入提供商名称"),D.base_url?.trim()||(_.base_url="请输入基础 URL"),D.api_key?.trim()||(_.api_key="请输入 API Key"),Object.keys(_).length>0){ee(_);return}ee({});const G={...D,max_retry:D.max_retry??2,timeout:D.timeout??30,retry_interval:D.retry_interval??10};if(Y!==null){const ye=[...n];ye[Y]=G,i(ye)}else i([...n,G]);U(!1),B(null),L(null)},Pe=_=>{if(!_&&D){const G={...D,max_retry:D.max_retry??2,timeout:D.timeout??30,retry_interval:D.retry_interval??10};B(G)}U(_)},$s=_=>{je(_),ae(!0)},ve=()=>{if(he!==null){const _=n.filter((G,ye)=>ye!==he);i(_),qe({title:"删除成功",description:"提供商已从列表中移除"})}ae(!1),je(null)},_s=_=>{const G=new Set(O);G.has(_)?G.delete(_):G.add(_),V(G)},Le=()=>{if(O.size===Fs.length)V(new Set);else{const _=Fs.map((G,ye)=>n.findIndex(Ts=>Ts===Fs[ye]));V(new Set(_))}},Qs=()=>{if(O.size===0){qe({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}se(!0)},mt=()=>{const _=n.filter((G,ye)=>!O.has(ye));i(_),V(new Set),se(!1),qe({title:"批量删除成功",description:`已删除 ${O.size} 个提供商`})},Fs=n.filter(_=>{if(!be)return!0;const G=be.toLowerCase();return _.name.toLowerCase().includes(G)||_.base_url.toLowerCase().includes(G)||_.client_type.toLowerCase().includes(G)}),ls=Math.ceil(Fs.length/xe),Is=Fs.slice((R-1)*xe,R*xe),Xt=()=>{const _=parseInt(we);_>=1&&_<=ls&&(ue(_),Me(""))},zt=async _=>{$(G=>new Set(G).add(_));try{const G=await Lw(_);Ee(ye=>new Map(ye).set(_,G)),G.network_ok?G.api_key_valid===!0?qe({title:"连接正常",description:`${_} 网络连接正常,API Key 有效 (${G.latency_ms}ms)`}):G.api_key_valid===!1?qe({title:"连接正常但 Key 无效",description:`${_} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):qe({title:"网络连接正常",description:`${_} 可以访问 (${G.latency_ms}ms)`}):qe({title:"连接失败",description:G.error||"无法连接到提供商",variant:"destructive"})}catch(G){qe({title:"测试失败",description:G.message,variant:"destructive"})}finally{$(G=>{const ye=new Set(G);return ye.delete(_),ye})}},ol=async()=>{for(const _ of n)await zt(_.name)},Na=_=>{const G=ie.has(_),ye=Z.get(_);return G?e.jsxs($e,{variant:"secondary",className:"gap-1",children:[e.jsx(Ws,{className:"h-3 w-3 animate-spin"}),"测试中"]}):ye?ye.network_ok?ye.api_key_valid===!0?e.jsxs($e,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(aa,{className:"h-3 w-3"}),"正常"]}):ye.api_key_valid===!1?e.jsxs($e,{variant:"destructive",className:"gap-1",children:[e.jsx(Mt,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs($e,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(aa,{className:"h-3 w-3"}),"可访问"]}):e.jsxs($e,{variant:"destructive",className:"gap-1",children:[e.jsx(pg,{className:"h-3 w-3"}),"离线"]}):null};return r?e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[O.size>0&&e.jsxs(S,{onClick:Qs,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(We,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",O.size,")"]}),e.jsxs(S,{onClick:ol,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:n.length===0||ie.size>0,children:[e.jsx(an,{className:"mr-2 h-4 w-4"}),ie.size>0?`测试中 (${ie.size})`:"测试全部"]}),e.jsxs(S,{onClick:()=>K(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(ct,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(S,{onClick:na,disabled:m||f||!g||j,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(jr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":f?"自动保存中...":g?"保存配置":"已保存"]}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs(S,{disabled:m||f||j,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(gr,{className:"mr-2 h-4 w-4"}),j?"重启中...":g?"保存并重启":"重启麦麦"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重启麦麦?"}),e.jsx(os,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:g?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:g?bt:ws,children:g?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(Qt,{children:[e.jsx(La,{className:"h-4 w-4"}),e.jsxs(It,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(Je,{className:"h-[calc(100vh-260px)]",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索提供商名称、URL 或类型...",value:be,onChange:_=>Te(_.target.value),className:"pl-9"})]}),be&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Fs.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:Fs.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:be?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):Is.map((_,G)=>{const ye=n.findIndex(Ts=>Ts===_);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:_.name}),Na(_.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:_.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>zt(_.name),disabled:ie.has(_.name),title:"测试连接",children:ie.has(_.name)?e.jsx(Ws,{className:"h-4 w-4 animate-spin"}):e.jsx(an,{className:"h-4 w-4"})}),e.jsx(S,{variant:"default",size:"sm",onClick:()=>K(_,ye),children:e.jsx(ln,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(S,{size:"sm",onClick:()=>$s(ye),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(We,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),e.jsx("p",{className:"font-medium",children:_.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:_.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:_.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:_.retry_interval})]})]})]},G)})}),e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ot,{children:[e.jsx(Ke,{className:"w-12",children:e.jsx(dt,{checked:O.size===Fs.length&&Fs.length>0,onCheckedChange:Le})}),e.jsx(Ke,{children:"状态"}),e.jsx(Ke,{children:"名称"}),e.jsx(Ke,{children:"基础URL"}),e.jsx(Ke,{children:"客户端类型"}),e.jsx(Ke,{className:"text-right",children:"最大重试"}),e.jsx(Ke,{className:"text-right",children:"超时(秒)"}),e.jsx(Ke,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(Ke,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:Is.length===0?e.jsx(ot,{children:e.jsx(Ve,{colSpan:9,className:"text-center text-muted-foreground py-8",children:be?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):Is.map((_,G)=>{const ye=n.findIndex(Ts=>Ts===_);return e.jsxs(ot,{children:[e.jsx(Ve,{children:e.jsx(dt,{checked:O.has(ye),onCheckedChange:()=>_s(ye)})}),e.jsx(Ve,{children:Na(_.name)||e.jsx($e,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Ve,{className:"font-medium",children:_.name}),e.jsx(Ve,{className:"max-w-xs truncate",title:_.base_url,children:_.base_url}),e.jsx(Ve,{children:_.client_type}),e.jsx(Ve,{className:"text-right",children:_.max_retry}),e.jsx(Ve,{className:"text-right",children:_.timeout}),e.jsx(Ve,{className:"text-right",children:_.retry_interval}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>zt(_.name),disabled:ie.has(_.name),title:"测试连接",children:ie.has(_.name)?e.jsx(Ws,{className:"h-4 w-4 animate-spin"}):e.jsx(an,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"default",size:"sm",onClick:()=>K(_,ye),children:[e.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(S,{size:"sm",onClick:()=>$s(ye),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},G)})})]})})}),Fs.length>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:xe.toString(),onValueChange:_=>{ke(parseInt(_)),ue(1),V(new Set)},children:[e.jsx(Oe,{id:"page-size-provider",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*xe+1," 到"," ",Math.min(R*xe,Fs.length)," 条,共 ",Fs.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>ue(1),disabled:R===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>ue(_=>Math.max(1,_-1)),disabled:R===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:we,onChange:_=>Me(_.target.value),onKeyDown:_=>_.key==="Enter"&&Xt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:ls}),e.jsx(S,{variant:"outline",size:"sm",onClick:Xt,disabled:!we,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>ue(_=>_+1),disabled:R>=ls,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>ue(ls),disabled:R>=ls,className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})]}),e.jsx(Hs,{open:w,onOpenChange:Pe,children:e.jsxs(Os,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:me.isRunning,children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:Y!==null?"编辑提供商":"添加提供商"}),e.jsx(Js,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:_=>{_.preventDefault(),Vs()},autoComplete:"off",children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[e.jsx(C,{htmlFor:"template",children:"提供商模板"}),e.jsxs(Ua,{open:I,onOpenChange:T,children:[e.jsx(Ba,{asChild:!0,children:e.jsxs(S,{variant:"outline",role:"combobox","aria-expanded":I,className:"w-full justify-between",children:[z?nr.find(_=>_.id===z)?.display_name:"选择提供商模板...",e.jsx(Ku,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ta,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(to,{children:[e.jsx(ao,{placeholder:"搜索提供商模板..."}),e.jsx(Je,{className:"h-[300px]",children:e.jsxs(lo,{className:"max-h-none overflow-visible",children:[e.jsx(no,{children:"未找到匹配的模板"}),e.jsx(fr,{children:nr.map(_=>e.jsxs(pr,{value:_.display_name,onSelect:()=>Ge(_.id),children:[e.jsx($t,{className:`mr-2 h-4 w-4 ${z===_.id?"opacity-100":"opacity-0"}`}),_.display_name]},_.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsx(C,{htmlFor:"name",className:pe.name?"text-destructive":"",children:"名称 *"}),e.jsx(re,{id:"name",value:D?.name||"",onChange:_=>{B(G=>G?{...G,name:_.target.value}:null),pe.name&&ee(G=>({...G,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:pe.name?"border-destructive focus-visible:ring-destructive":""}),pe.name&&e.jsx("p",{className:"text-xs text-destructive",children:pe.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(C,{htmlFor:"base_url",className:pe.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(re,{id:"base_url",value:D?.base_url||"",onChange:_=>{B(G=>G?{...G,base_url:_.target.value}:null),pe.base_url&&ee(G=>({...G,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:Ae,className:`${Ae?"bg-muted cursor-not-allowed":""} ${pe.base_url?"border-destructive focus-visible:ring-destructive":""}`}),pe.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:pe.base_url}),Ae&&!pe.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsx(C,{htmlFor:"api_key",className:pe.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{id:"api_key",type:ge?"text":"password",value:D?.api_key||"",onChange:_=>{B(G=>G?{...G,api_key:_.target.value}:null),pe.api_key&&ee(G=>({...G,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${pe.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(S,{type:"button",variant:"outline",size:"icon",onClick:()=>fe(!ge),title:ge?"隐藏密钥":"显示密钥",children:ge?e.jsx(dr,{className:"h-4 w-4"}):e.jsx(Rt,{className:"h-4 w-4"})}),e.jsx(S,{type:"button",variant:"outline",size:"icon",onClick:Xe,title:"复制密钥",children:e.jsx(Yc,{className:"h-4 w-4"})})]}),pe.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:pe.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Ue,{value:D?.client_type||"openai",onValueChange:_=>B(G=>G?{...G,client_type:_}:null),disabled:Ae,children:[e.jsx(Oe,{id:"client_type",className:Ae?"bg-muted cursor-not-allowed":"",children:e.jsx(Be,{placeholder:"选择客户端类型"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"openai",children:"OpenAI"}),e.jsx(le,{value:"gemini",children:"Gemini"})]})]}),Ae&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(re,{id:"max_retry",type:"number",min:"0",value:D?.max_retry??"",onChange:_=>{const G=_.target.value===""?null:parseInt(_.target.value);B(ye=>ye?{...ye,max_retry:G}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(re,{id:"timeout",type:"number",min:"1",value:D?.timeout??"",onChange:_=>{const G=_.target.value===""?null:parseInt(_.target.value);B(ye=>ye?{...ye,timeout:G}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(re,{id:"retry_interval",type:"number",min:"1",value:D?.retry_interval??"",onChange:_=>{const G=_.target.value===""?null:parseInt(_.target.value);B(ye=>ye?{...ye,retry_interval:G}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(et,{children:[e.jsx(S,{type:"button",variant:"outline",onClick:()=>U(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(S,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(fs,{open:M,onOpenChange:ae,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除提供商 "',he!==null?n[he]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:ve,children:"删除"})]})]})}),e.jsx(fs,{open:q,onOpenChange:se,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["确定要删除选中的 ",O.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:mt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),N&&e.jsx(em,{onRestartComplete:ut,onRestartFailed:Us})]})}function Xg(n){return typeof n=="boolean"?"boolean":typeof n=="number"?"number":"string"}function s1(n,i){switch(i){case"boolean":return n==="true";case"number":{const r=parseFloat(n);return isNaN(r)?0:r}default:return n}}function Mu(n){return Object.entries(n).map(([i,r])=>({id:crypto.randomUUID(),key:i,value:r,type:Xg(r)}))}function Au(n){const i={};for(const r of n)r.key.trim()&&(i[r.key.trim()]=r.value);return i}function Du(n){if(!n.trim())return{valid:!0,parsed:{}};try{const i=JSON.parse(n);if(typeof i!="object"||i===null||Array.isArray(i))return{valid:!1,error:"必须是一个 JSON 对象 {}"};for(const[r,d]of Object.entries(i))if(d!==null&&!["string","number","boolean"].includes(typeof d))return{valid:!1,error:`键 "${r}" 的值类型不支持(仅支持 string/number/boolean)`};return{valid:!0,parsed:i}}catch{return{valid:!1,error:"JSON 格式错误"}}}function t1(n){switch(n){case"boolean":return"布尔";case"number":return"数字";default:return"字符串"}}function a1(n){switch(n){case"boolean":return"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400";case"number":return"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"}}function l1({value:n,onChange:i,className:r,placeholder:d="添加额外参数..."}){const[m,x]=u.useState("list"),[f,p]=u.useState(()=>Mu(n||{})),[g,b]=u.useState(()=>Object.keys(n||{}).length>0?JSON.stringify(n,null,2):""),[j,y]=u.useState(null);u.useEffect(()=>{const Y=Mu(n||{});p(Y),b(Object.keys(n||{}).length>0?JSON.stringify(n,null,2):"")},[n]);const N=u.useMemo(()=>{const Y=Du(g);return Y.valid&&Y.parsed?{success:!0,data:Y.parsed}:{success:!1,data:{}}},[g]),k=u.useCallback(Y=>{const L=Y;if(L==="json"&&m==="list"){const z=Au(f);b(Object.keys(z).length>0?JSON.stringify(z,null,2):""),y(null)}else if(L==="list"&&m==="json"){const z=Du(g);z.valid&&z.parsed&&(p(Mu(z.parsed)),y(null))}x(L)},[m,f,g]),w=u.useCallback(()=>{const Y={id:crypto.randomUUID(),key:"",value:"",type:"string"},L=[...f,Y];p(L)},[f]),U=u.useCallback(Y=>{const L=f.filter(z=>z.id!==Y);p(L),i(Au(L))},[f,i]),D=u.useCallback((Y,L,z)=>{const X=f.map(I=>{if(I.id!==Y)return I;if(L==="type"){const T=z;let M;return T==="boolean"?M=I.value==="true"||I.value===!0:T==="number"?M=typeof I.value=="number"?I.value:parseFloat(String(I.value))||0:M=String(I.value),{...I,type:T,value:M}}else return L==="value"?{...I,value:s1(z,I.type)}:{...I,[L]:z}});p(X),i(Au(X))},[f,i]),B=u.useCallback(Y=>{b(Y);const L=Du(Y);L.valid&&L.parsed?(y(null),i(L.parsed)):y(L.error||"JSON 格式错误")},[i]);return e.jsxs("div",{className:F("space-y-3",r),children:[e.jsx(C,{className:"text-sm font-medium",children:"额外参数"}),e.jsxs(ja,{value:m,onValueChange:k,className:"w-full",children:[e.jsxs(la,{className:"h-8 p-0.5 bg-muted/60",children:[e.jsx(ss,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"键值对"}),e.jsx(ss,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON"})]}),e.jsxs(ys,{value:"list",className:"mt-3 space-y-2",children:[f.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:d}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 text-xs text-muted-foreground px-1",children:[e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),f.map(Y=>e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 items-center",children:[e.jsx(re,{value:Y.key,onChange:L=>D(Y.id,"key",L.target.value),placeholder:"key",className:"h-8 text-sm"}),Y.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Qe,{checked:Y.value===!0,onCheckedChange:L=>D(Y.id,"value",String(L))}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:Y.value?"true":"false"})]}):e.jsx(re,{type:Y.type==="number"?"number":"text",value:Y.value,onChange:L=>D(Y.id,"value",L.target.value),placeholder:"value",className:"h-8 text-sm",step:Y.type==="number"?"any":void 0}),e.jsxs(Ue,{value:Y.type,onValueChange:L=>D(Y.id,"type",L),children:[e.jsx(Oe,{className:"h-8 text-xs",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"string",children:"字符串"}),e.jsx(le,{value:"number",children:"数字"}),e.jsx(le,{value:"boolean",children:"布尔"})]})]}),e.jsx(S,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>U(Y.id),children:e.jsx(We,{className:"h-4 w-4"})})]},Y.id))]}),e.jsxs(S,{type:"button",variant:"outline",size:"sm",className:"w-full h-8",onClick:w,children:[e.jsx(ct,{className:"h-4 w-4 mr-1"}),"添加参数"]})]}),e.jsx(ys,{value:"json",className:"mt-3",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),j?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(Mt,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:j})]}):g.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx($t,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(As,{value:g,onChange:Y=>B(Y.target.value),placeholder:`{ - "key": "value" -}`,className:F("font-mono text-sm min-h-[140px] h-[140px] resize-y flex-1",j&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持 string、number、boolean 类型"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"预览"}),e.jsx("div",{className:"min-h-[140px] h-[140px] flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:N.success&&Object.keys(N.data).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(N.data).map(([Y,L])=>{const z=Xg(L);return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("code",{className:"px-1.5 py-0.5 bg-background rounded text-xs font-medium",children:Y}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:F("font-mono",z==="boolean"&&(L?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),z==="number"&&"text-blue-600 dark:text-blue-400",z==="string"&&"text-amber-600 dark:text-amber-400"),children:z==="string"?`"${L}"`:String(L)}),e.jsx($e,{variant:"secondary",className:F("h-5 text-[10px] px-1.5",a1(z)),children:t1(z)})]},Y)})}):N.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"暂无参数"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON 格式错误"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"实时预览解析结果"})]})]})})]})]})}function n1({value:n,label:i,onRemove:r}){const{attributes:d,listeners:m,setNodeRef:x,transform:f,transition:p,isDragging:g}=Xy({id:n}),b={transform:Ky.Transform.toString(f),transition:p,opacity:g?.5:1},j=N=>{N.preventDefault(),N.stopPropagation(),r(n)},y=N=>{N.stopPropagation()};return e.jsx("div",{ref:x,style:b,className:F("inline-flex items-center gap-1",g&&"shadow-lg"),children:e.jsxs($e,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...d,...m,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(uy,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:i}),e.jsx("button",{type:"button",className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive",onClick:j,onPointerDown:y,onMouseDown:N=>N.stopPropagation(),children:e.jsx(il,{className:"h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function i1({options:n,selected:i,onChange:r,placeholder:d="选择选项...",emptyText:m="未找到选项",className:x}){const[f,p]=u.useState(!1),g=Hy(lp(Yy,{activationConstraint:{distance:8}}),lp(Iy,{coordinateGetter:Qy})),b=N=>{i.includes(N)?r(i.filter(k=>k!==N)):r([...i,N])},j=N=>{r(i.filter(k=>k!==N))},y=N=>{const{active:k,over:w}=N;if(w&&k.id!==w.id){const U=i.indexOf(k.id),D=i.indexOf(w.id);r($y(i,U,D))}};return e.jsxs(Ua,{open:f,onOpenChange:p,children:[e.jsx(Ba,{asChild:!0,children:e.jsxs(S,{variant:"outline",role:"combobox","aria-expanded":f,className:F("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(qy,{sensors:g,collisionDetection:Gy,onDragEnd:y,children:e.jsx(Fy,{items:i,strategy:Vy,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:i.length===0?e.jsx("span",{className:"text-muted-foreground",children:d}):i.map(N=>{const k=n.find(w=>w.value===N);return e.jsx(n1,{value:N,label:k?.label||N,onRemove:j},N)})})})}),e.jsx(Ku,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(Ta,{className:"w-full p-0",align:"start",children:e.jsxs(to,{children:[e.jsx(ao,{placeholder:"搜索...",className:"h-9"}),e.jsxs(lo,{children:[e.jsx(no,{children:m}),e.jsx(fr,{children:n.map(N=>{const k=i.includes(N.value);return e.jsxs(pr,{value:N.value,onSelect:()=>b(N.value),children:[e.jsx("div",{className:F("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",k?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx($t,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:N.label})]},N.value)})})]})]})})]})}const Sa=gt.memo(function({title:i,description:r,taskConfig:d,modelNames:m,onChange:x,hideTemperature:f=!1,hideMaxTokens:p=!1,dataTour:g}){const b=j=>{x("model_list",j)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:i}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:r})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":g,children:[e.jsx(C,{children:"模型列表"}),e.jsx(i1,{options:m.map(j=>({label:j,value:j})),selected:d.model_list||[],onChange:b,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!f&&e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"温度"}),e.jsx(re,{type:"number",step:"0.1",min:"0",max:"1",value:d.temperature??.3,onChange:j=>{const y=parseFloat(j.target.value);!isNaN(y)&&y>=0&&y<=1&&x("temperature",y)},className:"w-20 h-8 text-sm"})]}),e.jsx(ga,{value:[d.temperature??.3],onValueChange:j=>x("temperature",j[0]),min:0,max:1,step:.1,className:"w-full"})]}),!p&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"最大 Token"}),e.jsx(re,{type:"number",step:"1",min:"1",value:d.max_tokens??1024,onChange:j=>x("max_tokens",parseInt(j.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(re,{type:"number",step:"1",min:"1",value:d.slow_threshold??15,onChange:j=>{const y=parseInt(j.target.value);!isNaN(y)&&y>=1&&x("slow_threshold",y)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"模型响应时间超过此阈值将输出警告日志"})]})]})]})}),r1=gt.memo(function({paginatedModels:i,allModels:r,onEdit:d,onDelete:m,isModelUsed:x,searchQuery:f}){return i.length===0?e.jsx("div",{className:"md:hidden text-center text-muted-foreground py-8 rounded-lg border bg-card",children:f?"未找到匹配的模型":"暂无模型配置"}):e.jsx("div",{className:"md:hidden space-y-3",children:i.map((p,g)=>{const b=r.findIndex(y=>y===p),j=x(p.name);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-base",children:p.name}),e.jsx($e,{variant:j?"default":"secondary",className:j?"bg-green-600 hover:bg-green-700":"",children:j?"已使用":"未使用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground break-all",title:p.model_identifier,children:p.model_identifier})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(S,{variant:"default",size:"sm",onClick:()=>d(p,b),children:[e.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(S,{size:"sm",onClick:()=>m(b),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),e.jsx("p",{className:"font-medium",children:p.api_provider})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"模型温度"}),e.jsx("p",{className:"font-medium",children:p.temperature!=null?p.temperature:e.jsx("span",{className:"text-muted-foreground",children:"默认"})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),e.jsxs("p",{className:"font-medium",children:["¥",p.price_in,"/M"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),e.jsxs("p",{className:"font-medium",children:["¥",p.price_out,"/M"]})]})]})]},g)})})}),c1=gt.memo(function({paginatedModels:i,allModels:r,filteredModels:d,selectedModels:m,onEdit:x,onDelete:f,onToggleSelection:p,onToggleSelectAll:g,isModelUsed:b,searchQuery:j}){return e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ot,{children:[e.jsx(Ke,{className:"w-12",children:e.jsx(dt,{checked:m.size===d.length&&d.length>0,onCheckedChange:g})}),e.jsx(Ke,{className:"w-24",children:"使用状态"}),e.jsx(Ke,{children:"模型名称"}),e.jsx(Ke,{children:"模型标识符"}),e.jsx(Ke,{children:"提供商"}),e.jsx(Ke,{className:"text-center",children:"温度"}),e.jsx(Ke,{className:"text-right",children:"输入价格"}),e.jsx(Ke,{className:"text-right",children:"输出价格"}),e.jsx(Ke,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:i.length===0?e.jsx(ot,{children:e.jsx(Ve,{colSpan:9,className:"text-center text-muted-foreground py-8",children:j?"未找到匹配的模型":"暂无模型配置"})}):i.map((y,N)=>{const k=r.findIndex(U=>U===y),w=b(y.name);return e.jsxs(ot,{children:[e.jsx(Ve,{children:e.jsx(dt,{checked:m.has(k),onCheckedChange:()=>p(k)})}),e.jsx(Ve,{children:e.jsx($e,{variant:w?"default":"secondary",className:w?"bg-green-600 hover:bg-green-700":"",children:w?"已使用":"未使用"})}),e.jsx(Ve,{className:"font-medium",children:y.name}),e.jsx(Ve,{className:"max-w-xs truncate",title:y.model_identifier,children:y.model_identifier}),e.jsx(Ve,{children:y.api_provider}),e.jsx(Ve,{className:"text-center",children:y.temperature!=null?y.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ve,{className:"text-right",children:["¥",y.price_in,"/M"]}),e.jsxs(Ve,{className:"text-right",children:["¥",y.price_out,"/M"]}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(S,{variant:"default",size:"sm",onClick:()=>x(y,k),children:[e.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(S,{size:"sm",onClick:()=>f(k),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},N)})})]})})})}),o1=300*1e3,jp=new Map,d1=[10,20,50,100],u1=gt.memo(function({page:i,pageSize:r,totalItems:d,jumpToPage:m,onPageChange:x,onPageSizeChange:f,onJumpToPageChange:p,onJumpToPage:g,onSelectionClear:b}){const j=Math.ceil(d/r),y=k=>{f(parseInt(k)),x(1),b?.()},N=k=>{k.key==="Enter"&&g()};return d===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:r.toString(),onValueChange:y,children:[e.jsx(Oe,{id:"page-size-model",className:"w-20",children:e.jsx(Be,{})}),e.jsx(Re,{children:d1.map(k=>e.jsx(le,{value:k.toString(),children:k},k))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(i-1)*r+1," 到"," ",Math.min(i*r,d)," 条,共 ",d," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:i===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,i-1)),disabled:i===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:m,onChange:k=>p(k.target.value),onKeyDown:N,placeholder:i.toString(),className:"w-16 h-8 text-center",min:1,max:j}),e.jsx(S,{variant:"outline",size:"sm",onClick:g,disabled:!m,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>x(i+1),disabled:i>=j,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>x(j),disabled:i>=j,className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})});function m1(n){const{models:i,taskConfig:r,debounceMs:d=2e3,onSavingChange:m,onUnsavedChange:x}=n,f=u.useRef(null),p=u.useRef(null),g=u.useRef(!0),b=u.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null),p.current&&(clearTimeout(p.current),p.current=null)},[]),j=u.useCallback(k=>{const w={model_identifier:k.model_identifier,name:k.name,api_provider:k.api_provider,price_in:k.price_in??0,price_out:k.price_out??0,force_stream_mode:k.force_stream_mode??!1,extra_params:k.extra_params??{}};return k.temperature!=null&&(w.temperature=k.temperature),k.max_tokens!=null&&(w.max_tokens=k.max_tokens),w},[]),y=u.useCallback(async k=>{try{m?.(!0);const w=k.map(j);await Fu("models",w),x?.(!1)}catch(w){console.error("自动保存模型列表失败:",w),x?.(!0)}finally{m?.(!1)}},[m,x,j]),N=u.useCallback(async k=>{try{m?.(!0),await Fu("model_task_config",k),x?.(!1)}catch(w){console.error("自动保存任务配置失败:",w),x?.(!0)}finally{m?.(!1)}},[m,x]);return u.useEffect(()=>{if(!g.current)return x?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{y(i)},d),()=>{f.current&&clearTimeout(f.current)}},[i,y,d,x]),u.useEffect(()=>{if(!(g.current||!r))return x?.(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{N(r)},d),()=>{p.current&&clearTimeout(p.current)}},[r,N,d,x]),u.useEffect(()=>()=>{b()},[b]),{clearTimers:b,initialLoadRef:g}}function x1(n={}){const{onCloseEditDialog:i}=n,r=ba(),{registerTour:d,startTour:m,state:x,goToStep:f}=sm(),p=u.useRef(x.stepIndex);return u.useEffect(()=>{d(Da,Ig)},[d]),u.useEffect(()=>{if(x.activeTourId===Da&&x.isRunning){const b=Yg[x.stepIndex];b&&!window.location.pathname.endsWith(b.replace("/config/",""))&&r({to:b})}},[x.stepIndex,x.activeTourId,x.isRunning,r]),u.useEffect(()=>{if(x.activeTourId===Da&&x.isRunning){const b=p.current,j=x.stepIndex;b>=12&&b<=17&&j<12&&i?.(),p.current=j}},[x.stepIndex,x.activeTourId,x.isRunning,i]),u.useEffect(()=>{if(x.activeTourId!==Da||!x.isRunning)return;const b=j=>{const y=j.target,N=x.stepIndex;N===2&&y.closest('[data-tour="add-provider-button"]')?setTimeout(()=>f(3),300):N===9&&y.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>f(10),300):N===11&&y.closest('[data-tour="add-model-button"]')?setTimeout(()=>f(12),300):N===17&&y.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>f(18),300):N===18&&y.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>f(19),300)};return document.addEventListener("click",b,!0),()=>document.removeEventListener("click",b,!0)},[x,f]),{startTour:u.useCallback(()=>{m(Da)},[m]),isRunning:x.isRunning&&x.activeTourId===Da,stepIndex:x.stepIndex}}function h1(n){const{getProviderConfig:i}=n,[r,d]=u.useState([]),[m,x]=u.useState(!1),[f,p]=u.useState(null),[g,b]=u.useState(null),j=u.useCallback(()=>{d([]),p(null),b(null)},[]),y=u.useCallback(async(N,k=!1)=>{const w=i(N);if(!w?.base_url){d([]),b(null),p('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!w.api_key){d([]),b(null),p('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const U=Ww(w.base_url);if(b(U),!U?.modelFetcher){d([]),p(null);return}const D=`${N}:${w.base_url}`,B=jp.get(D);if(!k&&B&&Date.now()-B.timestampT(!1)}),{clearTimers:Ie,initialLoadRef:Se}=m1({models:n,taskConfig:g,onSavingChange:U,onUnsavedChange:B}),J=u.useCallback(async()=>{try{y(!0);const _=await Wn(),G=_.models||[];i(G),p(G.map(Ts=>Ts.name));const ye=_.api_providers||[];d(ye.map(Ts=>Ts.name)),x(ye),b(_.model_task_config||null),B(!1),Se.current=!1}catch(_){console.error("加载配置失败:",_)}finally{y(!1)}},[Se]);u.useEffect(()=>{J()},[J]);const Ne=u.useCallback(_=>m.find(G=>G.name===_),[m]),{availableModels:Ce,fetchingModels:Gs,modelFetchError:ws,matchedTemplate:bt,fetchModelsForProvider:ut,clearModels:Us}=h1({getProviderConfig:Ne});u.useEffect(()=>{I&&M?.api_provider&&ut(M.api_provider)},[I,M?.api_provider,ut]);const ks=async()=>{try{L(!0),so().catch(()=>{}),X(!0)}catch(_){console.error("重启失败:",_),X(!1),qe({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),L(!1)}},na=_=>{const G={model_identifier:_.model_identifier,name:_.name,api_provider:_.api_provider,price_in:_.price_in??0,price_out:_.price_out??0,force_stream_mode:_.force_stream_mode??!1,extra_params:_.extra_params??{}};return _.temperature!=null&&(G.temperature=_.temperature),_.max_tokens!=null&&(G.max_tokens=_.max_tokens),G},K=async()=>{try{k(!0),Ie();const _=await Wn();_.models=n.map(na),_.model_task_config=g,await Pc(_),B(!1),qe({title:"保存成功",description:"正在重启麦麦..."}),await ks()}catch(_){console.error("保存配置失败:",_),qe({title:"保存失败",description:_.message,variant:"destructive"}),k(!1)}},Ge=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ae=()=>{X(!1),L(!1),qe({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Xe=async()=>{try{k(!0),Ie();const _=await Wn();_.models=n.map(na),_.model_task_config=g,await Pc(_),B(!1),qe({title:"保存成功",description:"模型配置已保存"}),await J()}catch(_){console.error("保存配置失败:",_),qe({title:"保存失败",description:_.message,variant:"destructive"})}finally{k(!1)}},Vs=(_,G)=>{Ee({}),ae(_||{model_identifier:"",name:"",api_provider:r[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),je(G),T(!0)},Pe=()=>{if(!M)return;const _={};if(M.name?.trim()||(_.name="请输入模型名称"),M.api_provider?.trim()||(_.api_provider="请选择 API 提供商"),M.model_identifier?.trim()||(_.model_identifier="请输入模型标识符"),Object.keys(_).length>0){Ee(_);return}Ee({});const G={model_identifier:M.model_identifier,name:M.name,api_provider:M.api_provider,price_in:M.price_in??0,price_out:M.price_out??0,force_stream_mode:M.force_stream_mode??!1,extra_params:M.extra_params??{}};M.temperature!=null&&(G.temperature=M.temperature),M.max_tokens!=null&&(G.max_tokens=M.max_tokens);let ye,Ts=null;if(he!==null?(Ts=n[he].name,ye=[...n],ye[he]=G):ye=[...n,G],i(ye),p(ye.map(Dt=>Dt.name)),Ts&&Ts!==G.name&&g){const Dt=Nr=>Nr.map(ci=>ci===Ts?G.name:ci);b({...g,utils:{...g.utils,model_list:Dt(g.utils?.model_list||[])},utils_small:{...g.utils_small,model_list:Dt(g.utils_small?.model_list||[])},tool_use:{...g.tool_use,model_list:Dt(g.tool_use?.model_list||[])},replyer:{...g.replyer,model_list:Dt(g.replyer?.model_list||[])},planner:{...g.planner,model_list:Dt(g.planner?.model_list||[])},vlm:{...g.vlm,model_list:Dt(g.vlm?.model_list||[])},voice:{...g.voice,model_list:Dt(g.voice?.model_list||[])},embedding:{...g.embedding,model_list:Dt(g.embedding?.model_list||[])},lpmm_entity_extract:{...g.lpmm_entity_extract,model_list:Dt(g.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...g.lpmm_rdf_build,model_list:Dt(g.lpmm_rdf_build?.model_list||[])},lpmm_qa:{...g.lpmm_qa,model_list:Dt(g.lpmm_qa?.model_list||[])}})}T(!1),ae(null),je(null)},$s=_=>{if(!_&&M){const G={...M,price_in:M.price_in??0,price_out:M.price_out??0};ae(G)}T(_)},ve=_=>{Te(_),fe(!0)},_s=()=>{if(be!==null){const _=n.filter((G,ye)=>ye!==be);i(_),p(_.map(G=>G.name)),qe({title:"删除成功",description:"模型已从列表中移除"})}fe(!1),Te(null)},Le=_=>{const G=new Set(q);G.has(_)?G.delete(_):G.add(_),se(G)},Qs=()=>{if(q.size===Is.length)se(new Set);else{const _=Is.map((G,ye)=>n.findIndex(Ts=>Ts===Is[ye]));se(new Set(_))}},mt=()=>{if(q.size===0){qe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},Fs=()=>{const _=n.filter((G,ye)=>!q.has(ye));i(_),p(_.map(G=>G.name)),se(new Set),ue(!1),qe({title:"批量删除成功",description:`已删除 ${q.size} 个模型`})},ls=(_,G,ye)=>{g&&b({...g,[_]:{...g[_],[G]:ye}})},Is=n.filter(_=>{if(!O)return!0;const G=O.toLowerCase();return _.name.toLowerCase().includes(G)||_.model_identifier.toLowerCase().includes(G)||_.api_provider.toLowerCase().includes(G)}),Xt=Math.ceil(Is.length/we),zt=Is.slice((xe-1)*we,xe*we),ol=()=>{const _=parseInt(pe);_>=1&&_<=Xt&&(ke(_),ee(""))},Na=_=>g?[g.utils?.model_list||[],g.utils_small?.model_list||[],g.tool_use?.model_list||[],g.replyer?.model_list||[],g.planner?.model_list||[],g.vlm?.model_list||[],g.voice?.model_list||[],g.embedding?.model_list||[],g.lpmm_entity_extract?.model_list||[],g.lpmm_rdf_build?.model_list||[],g.lpmm_qa?.model_list||[]].some(ye=>ye.includes(_)):!1;return j?e.jsx(Je,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsxs(S,{onClick:Xe,disabled:N||w||!D||Y,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(jr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),N?"保存中...":w?"自动保存中...":D?"保存配置":"已保存"]}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs(S,{disabled:N||w||Y,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(gr,{className:"mr-2 h-4 w-4"}),Y?"重启中...":D?"保存并重启":"重启麦麦"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重启麦麦?"}),e.jsx(os,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:D?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:D?K:ks,children:D?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(Qt,{children:[e.jsx(La,{className:"h-4 w-4"}),e.jsxs(It,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(Qt,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:E,children:[e.jsx(my,{className:"h-4 w-4 text-primary"}),e.jsxs(It,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),e.jsx(S,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),e.jsxs(ja,{defaultValue:"models",className:"w-full",children:[e.jsxs(la,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(ss,{value:"models",children:"添加模型"}),e.jsx(ss,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(ys,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[q.size>0&&e.jsxs(S,{onClick:mt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(We,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",q.size,")"]}),e.jsxs(S,{onClick:()=>Vs(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(ct,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索模型名称、标识符或提供商...",value:O,onChange:_=>V(_.target.value),className:"pl-9"})]}),O&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Is.length," 个结果"]})]}),e.jsx(r1,{paginatedModels:zt,allModels:n,onEdit:Vs,onDelete:ve,isModelUsed:Na,searchQuery:O}),e.jsx(c1,{paginatedModels:zt,allModels:n,filteredModels:Is,selectedModels:q,onEdit:Vs,onDelete:ve,onToggleSelection:Le,onToggleSelectAll:Qs,isModelUsed:Na,searchQuery:O}),e.jsx(u1,{page:xe,pageSize:we,totalItems:Is.length,jumpToPage:pe,onPageChange:ke,onPageSizeChange:Me,onJumpToPageChange:ee,onJumpToPage:ol,onSelectionClear:()=>se(new Set)})]}),e.jsxs(ys,{value:"tasks",className:"space-y-6 mt-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),g&&e.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[e.jsx(Sa,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:g.utils,modelNames:f,onChange:(_,G)=>ls("utils",_,G),dataTour:"task-model-select"}),e.jsx(Sa,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:g.utils_small,modelNames:f,onChange:(_,G)=>ls("utils_small",_,G)}),e.jsx(Sa,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:g.tool_use,modelNames:f,onChange:(_,G)=>ls("tool_use",_,G)}),e.jsx(Sa,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:g.replyer,modelNames:f,onChange:(_,G)=>ls("replyer",_,G)}),e.jsx(Sa,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:g.planner,modelNames:f,onChange:(_,G)=>ls("planner",_,G)}),e.jsx(Sa,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:g.vlm,modelNames:f,onChange:(_,G)=>ls("vlm",_,G),hideTemperature:!0}),e.jsx(Sa,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:g.voice,modelNames:f,onChange:(_,G)=>ls("voice",_,G),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Sa,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:g.embedding,modelNames:f,onChange:(_,G)=>ls("embedding",_,G),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(Sa,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:g.lpmm_entity_extract,modelNames:f,onChange:(_,G)=>ls("lpmm_entity_extract",_,G)}),e.jsx(Sa,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:g.lpmm_rdf_build,modelNames:f,onChange:(_,G)=>ls("lpmm_rdf_build",_,G)}),e.jsx(Sa,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:g.lpmm_qa,modelNames:f,onChange:(_,G)=>ls("lpmm_qa",_,G)})]})]})]})]}),e.jsx(Hs,{open:I,onOpenChange:$s,children:e.jsxs(Os,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:me,children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:he!==null?"编辑模型":"添加模型"}),e.jsx(Js,{children:"配置模型的基本信息和参数"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[e.jsx(C,{htmlFor:"model_name",className:Z.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(re,{id:"model_name",value:M?.name||"",onChange:_=>{ae(G=>G?{...G,name:_.target.value}:null),Z.name&&Ee(G=>({...G,name:void 0}))},placeholder:"例如: qwen3-30b",className:Z.name?"border-destructive focus-visible:ring-destructive":""}),Z.name?e.jsx("p",{className:"text-xs text-destructive",children:Z.name}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[e.jsx(C,{htmlFor:"api_provider",className:Z.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Ue,{value:M?.api_provider||"",onValueChange:_=>{ae(G=>G?{...G,api_provider:_}:null),Us(),Z.api_provider&&Ee(G=>({...G,api_provider:void 0}))},children:[e.jsx(Oe,{id:"api_provider",className:Z.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Be,{placeholder:"选择提供商"})}),e.jsx(Re,{children:r.map(_=>e.jsx(le,{value:_,children:_},_))})]}),Z.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:Z.api_provider})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{htmlFor:"model_identifier",className:Z.model_identifier?"text-destructive":"",children:"模型标识符 *"}),bt?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{variant:"secondary",className:"text-xs",children:bt.display_name}),e.jsx(S,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>M?.api_provider&&ut(M.api_provider,!0),disabled:Gs,children:Gs?e.jsx(Ws,{className:"h-3 w-3 animate-spin"}):e.jsx(Et,{className:"h-3 w-3"})})]})]}),bt?.modelFetcher?e.jsxs(Ua,{open:ie,onOpenChange:$,children:[e.jsx(Ba,{asChild:!0,children:e.jsxs(S,{variant:"outline",role:"combobox","aria-expanded":ie,className:"w-full justify-between font-normal",disabled:Gs||!!ws,children:[Gs?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Ws,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):ws?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):M?.model_identifier?e.jsx("span",{className:"truncate",children:M.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(Ku,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ta,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(to,{children:[e.jsx(ao,{placeholder:"搜索模型..."}),e.jsx(Je,{className:"h-[300px]",children:e.jsxs(lo,{className:"max-h-none overflow-visible",children:[e.jsx(no,{children:ws?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:ws}),!ws.includes("API Key")&&e.jsx(S,{variant:"link",size:"sm",onClick:()=>M?.api_provider&&ut(M.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(fr,{heading:"可用模型",children:Ce.map(_=>e.jsxs(pr,{value:_.id,onSelect:()=>{ae(G=>G?{...G,model_identifier:_.id}:null),$(!1)},children:[e.jsx($t,{className:`mr-2 h-4 w-4 ${M?.model_identifier===_.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:_.id}),_.name!==_.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:_.name})]})]},_.id))}),e.jsx(fr,{heading:"手动输入",children:e.jsxs(pr,{value:"__manual_input__",onSelect:()=>{$(!1)},children:[e.jsx(ln,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(re,{id:"model_identifier",value:M?.model_identifier||"",onChange:_=>{ae(G=>G?{...G,model_identifier:_.target.value}:null),Z.model_identifier&&Ee(G=>({...G,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:Z.model_identifier?"border-destructive focus-visible:ring-destructive":""}),Z.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:Z.model_identifier}),ws&&bt?.modelFetcher&&!Z.model_identifier&&e.jsxs(Qt,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(La,{className:"h-4 w-4"}),e.jsx(It,{className:"text-xs",children:ws})]}),bt?.modelFetcher&&e.jsx(re,{value:M?.model_identifier||"",onChange:_=>{ae(G=>G?{...G,model_identifier:_.target.value}:null),Z.model_identifier&&Ee(G=>({...G,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${Z.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!Z.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:ws?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':bt?.modelFetcher?`已识别为 ${bt.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(re,{id:"price_in",type:"number",step:"0.1",min:"0",value:M?.price_in??"",onChange:_=>{const G=_.target.value===""?null:parseFloat(_.target.value);ae(ye=>ye?{...ye,price_in:G}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(re,{id:"price_out",type:"number",step:"0.1",min:"0",value:M?.price_out??"",onChange:_=>{const G=_.target.value===""?null:parseFloat(_.target.value);ae(ye=>ye?{...ye,price_out:G}:null)},placeholder:"默认: 0"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx(Qe,{id:"enable_model_temperature",checked:M?.temperature!=null,onCheckedChange:_=>{ae(_?G=>G?{...G,temperature:.5}:null:G=>G?{...G,temperature:null}:null)}})]}),M?.temperature!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:M.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(ga,{value:[M.temperature],onValueChange:_=>ae(G=>G?{...G,temperature:_[0]}:null),min:0,max:1,step:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"较低的温度(0.1-0.3)产生更确定的输出,较高的温度(0.7-1.0)产生更多样化的输出"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx(Qe,{id:"enable_model_max_tokens",checked:M?.max_tokens!=null,onCheckedChange:_=>{ae(_?G=>G?{...G,max_tokens:2048}:null:G=>G?{...G,max_tokens:null}:null)}})]}),M?.max_tokens!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm",children:"最大 Token 数"}),e.jsx(re,{type:"number",min:"1",max:"128000",value:M.max_tokens,onChange:_=>{const G=parseInt(_.target.value);!isNaN(G)&&G>=1&&ae(ye=>ye?{...ye,max_tokens:G}:null)},className:"w-28 h-8 text-sm"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"限制模型单次输出的最大 token 数量,不同模型支持的上限不同"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"force_stream_mode",checked:M?.force_stream_mode||!1,onCheckedChange:_=>ae(G=>G?{...G,force_stream_mode:_}:null)}),e.jsx(C,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsx(l1,{value:M?.extra_params||{},onChange:_=>ae(G=>G?{...G,extra_params:_}:null),placeholder:"添加额外参数(如 enable_thinking、top_p 等)..."})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>T(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(S,{onClick:Pe,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(fs,{open:ge,onOpenChange:fe,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除模型 "',be!==null?n[be]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:_s,children:"删除"})]})]})}),e.jsx(fs,{open:R,onOpenChange:ue,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["确定要删除选中的 ",q.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:Fs,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),z&&e.jsx(em,{onRestartComplete:Ge,onRestartFailed:Ae})]})})}const io="/api/webui/config";async function p1(){const i=await(await _e(`${io}/adapter-config/path`)).json();return!i.success||!i.path?null:{path:i.path,lastModified:i.lastModified}}async function vp(n){const r=await(await _e(`${io}/adapter-config/path`,{method:"POST",headers:Ds(),body:JSON.stringify({path:n})})).json();if(!r.success)throw new Error(r.message||"保存路径失败")}async function bp(n){const r=await(await _e(`${io}/adapter-config?path=${encodeURIComponent(n)}`)).json();if(!r.success)throw new Error("读取配置文件失败");return r.content}async function Np(n,i){const d=await(await _e(`${io}/adapter-config`,{method:"POST",headers:Ds(),body:JSON.stringify({path:n,content:i})})).json();if(!d.success)throw new Error(d.message||"保存配置失败")}const ta={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},Ou={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:Ol},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:xy}};function g1(){const[n,i]=u.useState("upload"),[r,d]=u.useState(null),[m,x]=u.useState(""),[f,p]=u.useState(""),[g,b]=u.useState("oneclick"),[j,y]=u.useState(""),[N,k]=u.useState(!1),[w,U]=u.useState(!1),[D,B]=u.useState(!1),[Y,L]=u.useState(!1),[z,X]=u.useState(null),I=u.useRef(null),{toast:T}=qs(),M=u.useRef(null),ae=ee=>{if(!ee.trim())return{valid:!1,error:"路径不能为空"};if(!ee.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const ie=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,$=/^(\/|~\/).+\.toml$/i,Z=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,Ee=ie.test(ee),qe=$.test(ee),E=Z.test(ee);return!Ee&&!qe&&!E?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(ee)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},he=ee=>{if(p(ee),ee.trim()){const ie=ae(ee);y(ie.error)}else y("")},je=u.useCallback(async ee=>{const ie=Ou[ee];U(!0);try{const $=await bp(ie.path),Z=xe($);d(Z),b(ee),p(ie.path),await vp(ie.path),T({title:"加载成功",description:`已从${ie.name}预设加载配置`})}catch($){console.error("加载预设配置失败:",$),T({title:"加载失败",description:$ instanceof Error?$.message:"无法读取预设配置文件",variant:"destructive"})}finally{U(!1)}},[T]),ge=u.useCallback(async ee=>{const ie=ae(ee);if(!ie.valid){y(ie.error),T({title:"路径无效",description:ie.error,variant:"destructive"});return}y(""),U(!0);try{const $=await bp(ee),Z=xe($);d(Z),p(ee),await vp(ee),T({title:"加载成功",description:"已从配置文件加载"})}catch($){console.error("加载配置失败:",$),T({title:"加载失败",description:$ instanceof Error?$.message:"无法读取配置文件",variant:"destructive"})}finally{U(!1)}},[T]);u.useEffect(()=>{(async()=>{try{const ie=await p1();if(ie&&ie.path){p(ie.path);const $=Object.entries(Ou).find(([,Z])=>Z.path===ie.path);$?(i("preset"),b($[0]),await je($[0])):(i("path"),await ge(ie.path))}}catch(ie){console.error("加载保存的路径失败:",ie)}})()},[ge,je]);const fe=u.useCallback(ee=>{n!=="path"&&n!=="preset"||!f||(M.current&&clearTimeout(M.current),M.current=setTimeout(async()=>{k(!0);try{const ie=ke(ee);await Np(f,ie),T({title:"自动保存成功",description:"配置已保存到文件"})}catch(ie){console.error("自动保存失败:",ie),T({title:"自动保存失败",description:ie instanceof Error?ie.message:"保存配置失败",variant:"destructive"})}finally{k(!1)}},1e3))},[n,f,T]),be=async()=>{if(!r||!f)return;const ee=ae(f);if(!ee.valid){T({title:"保存失败",description:ee.error,variant:"destructive"});return}k(!0);try{const ie=ke(r);await Np(f,ie),T({title:"保存成功",description:"配置已保存到文件"})}catch(ie){console.error("保存失败:",ie),T({title:"保存失败",description:ie instanceof Error?ie.message:"保存配置失败",variant:"destructive"})}finally{k(!1)}},Te=async()=>{f&&await ge(f)},O=ee=>{if(ee!==n){if(r){X(ee),B(!0);return}V(ee)}},V=ee=>{d(null),x(""),y(""),i(ee),ee==="preset"&&je("oneclick"),T({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[ee]})},q=()=>{z&&(V(z),X(null)),B(!1)},se=()=>{if(r){L(!0);return}R()},R=()=>{p(""),d(null),y(""),T({title:"已清空",description:"路径和配置已清空"})},ue=()=>{R(),L(!1)},xe=ee=>{const ie=JSON.parse(JSON.stringify(ta)),$=ee.split(` -`);let Z="";for(const Ee of $){const qe=Ee.trim();if(!qe||qe.startsWith("#"))continue;const E=qe.match(/^\[(\w+)\]/);if(E){Z=E[1];continue}const me=qe.match(/^(\w+)\s*=\s*(.+)$/);if(me&&Z){const[,Ie,Se]=me;let J=Se.trim();const Ne=J.match(/^("[^"]*")/);if(Ne)J=Ne[1];else{const Gs=J.indexOf("#");Gs!==-1&&(J=J.substring(0,Gs).trim())}let Ce;if(J==="true")Ce=!0;else if(J==="false")Ce=!1;else if(J.startsWith("[")&&J.endsWith("]")){const Gs=J.slice(1,-1).trim();if(Gs){const ws=Gs.split(",").map(ut=>{const Us=ut.trim();return isNaN(Number(Us))?Us.replace(/"/g,""):Number(Us)}),bt=typeof ws[0];Ce=ws.every(ut=>typeof ut===bt)?ws:ws.filter(ut=>typeof ut=="number")}else Ce=[]}else J.startsWith('"')&&J.endsWith('"')?Ce=J.slice(1,-1):isNaN(Number(J))?Ce=J.replace(/"/g,""):Ce=Number(J);if(Z in ie){const Gs=ie[Z];Gs[Ie]=Ce}}}return ie},ke=ee=>{const ie=[],$=(Z,Ee)=>Z===""||Z===null||Z===void 0?Ee:Z;return ie.push("[inner]"),ie.push(`version = "${$(ee.inner.version,ta.inner.version)}" # 版本号`),ie.push("# 请勿修改版本号,除非你知道自己在做什么"),ie.push(""),ie.push("[nickname] # 现在没用"),ie.push(`nickname = "${$(ee.nickname.nickname,ta.nickname.nickname)}"`),ie.push(""),ie.push("[napcat_server] # Napcat连接的ws服务设置"),ie.push(`host = "${$(ee.napcat_server.host,ta.napcat_server.host)}" # Napcat设定的主机地址`),ie.push(`port = ${$(ee.napcat_server.port||0,ta.napcat_server.port)} # Napcat设定的端口`),ie.push(`token = "${$(ee.napcat_server.token,ta.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),ie.push(`heartbeat_interval = ${$(ee.napcat_server.heartbeat_interval||0,ta.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),ie.push(""),ie.push("[maibot_server] # 连接麦麦的ws服务设置"),ie.push(`host = "${$(ee.maibot_server.host,ta.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),ie.push(`port = ${$(ee.maibot_server.port||0,ta.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),ie.push(""),ie.push("[chat] # 黑白名单功能"),ie.push(`group_list_type = "${$(ee.chat.group_list_type,ta.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),ie.push(`group_list = [${ee.chat.group_list.join(", ")}] # 群组名单`),ie.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),ie.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),ie.push(`private_list_type = "${$(ee.chat.private_list_type,ta.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),ie.push(`private_list = [${ee.chat.private_list.join(", ")}] # 私聊名单`),ie.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),ie.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),ie.push(`ban_user_id = [${ee.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),ie.push(`ban_qq_bot = ${ee.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),ie.push(`enable_poke = ${ee.chat.enable_poke} # 是否启用戳一戳功能`),ie.push(""),ie.push("[voice] # 发送语音设置"),ie.push(`use_tts = ${ee.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),ie.push(""),ie.push("[debug]"),ie.push(`level = "${$(ee.debug.level,ta.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),ie.join(` -`)},we=ee=>{const ie=ee.target.files?.[0];if(!ie)return;const $=new FileReader;$.onload=Z=>{try{const Ee=Z.target?.result,qe=xe(Ee);d(qe),x(ie.name),T({title:"上传成功",description:`已加载配置文件:${ie.name}`})}catch(Ee){console.error("解析配置文件失败:",Ee),T({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},$.readAsText(ie)},Me=()=>{if(!r)return;const ee=ke(r),ie=new Blob([ee],{type:"text/plain;charset=utf-8"}),$=URL.createObjectURL(ie),Z=document.createElement("a");Z.href=$,Z.download=m||"config.toml",document.body.appendChild(Z),Z.click(),document.body.removeChild(Z),URL.revokeObjectURL($),T({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},pe=()=>{d(JSON.parse(JSON.stringify(ta))),x("config.toml"),T({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[e.jsx(Mt,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"工作模式"}),e.jsx(Zs,{children:"选择配置文件的管理方式"})]}),e.jsxs(hs,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${n==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>O("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(Ol,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${n==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>O("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(ur,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${n==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>O("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(hy,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),n==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(C,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Ou).map(([ee,ie])=>{const $=ie.icon,Z=g===ee;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${Z?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{b(ee),je(ee)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx($,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:ie.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ie.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:ie.path})]})]})},ee)})})]}),n==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(re,{id:"config-path",value:f,onChange:ee=>he(ee.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${j?"border-destructive":""}`}),j&&e.jsx("p",{className:"text-xs text-destructive",children:j})]}),e.jsx(S,{onClick:()=>ge(f),disabled:w||!f||!!j,className:"w-full sm:w-auto",children:w?e.jsxs(e.Fragment,{children:[e.jsx(Et,{className:"h-4 w-4 animate-spin mr-2"}),e.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:"加载配置"}),e.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),e.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[e.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[e.jsx("span",{children:"路径格式说明"}),e.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),e.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"C:\\Adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"/opt/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),e.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),e.jsxs(Qt,{children:[e.jsx(La,{className:"h-4 w-4"}),e.jsx(It,{children:n==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",N&&" (正在保存...)"]}):n==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",N&&" (正在保存...)"]})})]}),n==="upload"&&!r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:I,type:"file",accept:".toml",className:"hidden",onChange:we}),e.jsxs(S,{onClick:()=>I.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(ur,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(S,{onClick:pe,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),n==="upload"&&r&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(S,{onClick:Me,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ra,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(n==="preset"||n==="path")&&r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(S,{onClick:be,size:"sm",disabled:N||!!j,className:"w-full sm:w-auto",children:[e.jsx(jr,{className:"mr-2 h-4 w-4"}),N?"保存中...":"立即保存"]}),e.jsxs(S,{onClick:Te,size:"sm",variant:"outline",disabled:w,className:"w-full sm:w-auto",children:[e.jsx(Et,{className:`mr-2 h-4 w-4 ${w?"animate-spin":""}`}),"刷新"]}),n==="path"&&e.jsxs(S,{onClick:se,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(We,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),r?e.jsxs(ja,{defaultValue:"napcat",className:"w-full",children:[e.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:e.jsxs(la,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(ss,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),e.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),e.jsxs(ss,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),e.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),e.jsxs(ss,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),e.jsx("span",{className:"sm:hidden",children:"聊天"})]}),e.jsxs(ss,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),e.jsx("span",{className:"sm:hidden",children:"语音"})]}),e.jsx(ss,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(ys,{value:"napcat",className:"space-y-4",children:e.jsx(j1,{config:r,onChange:ee=>{d(ee),fe(ee)}})}),e.jsx(ys,{value:"maibot",className:"space-y-4",children:e.jsx(v1,{config:r,onChange:ee=>{d(ee),fe(ee)}})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:e.jsx(b1,{config:r,onChange:ee=>{d(ee),fe(ee)}})}),e.jsx(ys,{value:"voice",className:"space-y-4",children:e.jsx(N1,{config:r,onChange:ee=>{d(ee),fe(ee)}})}),e.jsx(ys,{value:"debug",className:"space-y-4",children:e.jsx(y1,{config:r,onChange:ee=>{d(ee),fe(ee)}})})]}):e.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:e.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[e.jsx(Ca,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:n==="preset"?"请选择预设的部署方式":n==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),e.jsx(fs,{open:D,onOpenChange:B,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认切换模式"}),e.jsxs(os,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:()=>{B(!1),X(null)},children:"取消"}),e.jsx(ds,{onClick:q,children:"确认切换"})]})]})}),e.jsx(fs,{open:Y,onOpenChange:L,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认清空路径"}),e.jsxs(os,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:()=>L(!1),children:"取消"}),e.jsx(ds,{onClick:ue,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function j1({config:n,onChange:i}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(re,{id:"napcat-host",value:n.napcat_server.host,onChange:r=>i({...n,napcat_server:{...n.napcat_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(re,{id:"napcat-port",type:"number",value:n.napcat_server.port||"",onChange:r=>i({...n,napcat_server:{...n.napcat_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(re,{id:"napcat-token",type:"password",value:n.napcat_server.token,onChange:r=>i({...n,napcat_server:{...n.napcat_server,token:r.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(re,{id:"napcat-heartbeat",type:"number",value:n.napcat_server.heartbeat_interval||"",onChange:r=>i({...n,napcat_server:{...n.napcat_server,heartbeat_interval:r.target.value?parseInt(r.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function v1({config:n,onChange:i}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(re,{id:"maibot-host",value:n.maibot_server.host,onChange:r=>i({...n,maibot_server:{...n.maibot_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(re,{id:"maibot-port",type:"number",value:n.maibot_server.port||"",onChange:r=>i({...n,maibot_server:{...n.maibot_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function b1({config:n,onChange:i}){const r=x=>{const f={...n};x==="group"?f.chat.group_list=[...f.chat.group_list,0]:x==="private"?f.chat.private_list=[...f.chat.private_list,0]:f.chat.ban_user_id=[...f.chat.ban_user_id,0],i(f)},d=(x,f)=>{const p={...n};x==="group"?p.chat.group_list=p.chat.group_list.filter((g,b)=>b!==f):x==="private"?p.chat.private_list=p.chat.private_list.filter((g,b)=>b!==f):p.chat.ban_user_id=p.chat.ban_user_id.filter((g,b)=>b!==f),i(p)},m=(x,f,p)=>{const g={...n};x==="group"?g.chat.group_list[f]=p:x==="private"?g.chat.private_list[f]=p:g.chat.ban_user_id[f]=p,i(g)};return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),e.jsxs("div",{className:"grid gap-4 md:gap-6",children:[e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Ue,{value:n.chat.group_list_type,onValueChange:x=>i({...n,chat:{...n.chat,group_list_type:x}}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(le,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(C,{className:"text-sm md:text-base",children:"群组列表"}),e.jsxs(S,{onClick:()=>r("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),n.chat.group_list.map((x,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:p=>m("group",f,parseInt(p.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除群号 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>d("group",f),children:"删除"})]})]})]})]},f)),n.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Ue,{value:n.chat.private_list_type,onValueChange:x=>i({...n,chat:{...n.chat,private_list_type:x}}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(le,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(C,{className:"text-sm md:text-base",children:"私聊列表"}),e.jsxs(S,{onClick:()=>r("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),n.chat.private_list.map((x,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:p=>m("private",f,parseInt(p.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>d("private",f),children:"删除"})]})]})]})]},f)),n.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"全局禁止名单"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),e.jsxs(S,{onClick:()=>r("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),n.chat.ban_user_id.map((x,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:p=>m("ban",f,parseInt(p.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(fs,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(S,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要从全局禁止名单中删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>d("ban",f),children:"删除"})]})]})]})]},f)),n.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx(Qe,{checked:n.chat.ban_qq_bot,onCheckedChange:x=>i({...n,chat:{...n.chat,ban_qq_bot:x}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx(Qe,{checked:n.chat.enable_poke,onCheckedChange:x=>i({...n,chat:{...n.chat,enable_poke:x}})})]})]})]})})}function N1({config:n,onChange:i}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx(Qe,{checked:n.voice.use_tts,onCheckedChange:r=>i({...n,voice:{use_tts:r}})})]})]})})}function y1({config:n,onChange:i}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),e.jsx("div",{className:"grid gap-3 md:gap-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Ue,{value:n.debug.level,onValueChange:r=>i({...n,debug:{level:r}}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(le,{value:"INFO",children:"INFO(信息)"}),e.jsx(le,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(le,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(le,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const w1=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spellCheck","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],_1=/^(aria-|data-)/,Kg=n=>Object.fromEntries(Object.entries(n).filter(([i])=>_1.test(i)||w1.includes(i)));function S1(n,i){const r=Kg(n);return Object.keys(n).some(d=>!Object.hasOwn(r,d)&&n[d]!==i[d])}class C1 extends u.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(i){if(i.uppy!==this.props.uppy)this.uninstallPlugin(i),this.installPlugin();else if(S1(this.props,i)){const{uppy:r,...d}={...this.props,target:this.container};this.plugin.setOptions(d)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:i,...r}={id:"Dashboard",...this.props,inline:!0,target:this.container};i.use(Jy,r),this.plugin=i.getPlugin(r.id)}uninstallPlugin(i=this.props){const{uppy:r}=i;r.removePlugin(this.plugin)}render(){return u.createElement("div",{className:"uppy-Container",ref:i=>{this.container=i},...Kg(this.props)})}}function k1({src:n,alt:i="表情包",className:r,maxRetries:d=5,retryInterval:m=1500}){const[x,f]=u.useState("loading"),[p,g]=u.useState(0),[b,j]=u.useState(null),y=u.useCallback(async()=>{try{const N=await fetch(n,{credentials:"include"});if(N.status===202){f("generating"),p{g(U=>U+1)},m):f("error");return}if(!N.ok){f("error");return}const k=await N.blob(),w=URL.createObjectURL(k);j(w),f("loaded")}catch(N){console.error("加载缩略图失败:",N),f("error")}},[n,p,d,m]);return u.useEffect(()=>{f("loading"),g(0),j(null)},[n]),u.useEffect(()=>{y()},[y]),u.useEffect(()=>()=>{b&&URL.revokeObjectURL(b)},[b]),x==="loading"||x==="generating"?e.jsx(zg,{className:F("w-full h-full",r)}):x==="error"||!b?e.jsx("div",{className:F("w-full h-full flex items-center justify-center bg-muted",r),children:e.jsx(Ng,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:b,alt:i,className:F("w-full h-full object-contain",r)})}function Jg({content:n,className:i=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${i}`,children:e.jsx(Zy,{remarkPlugins:[e0,s0],rehypePlugins:[Wy],components:{code({inline:r,className:d,children:m,...x}){return r?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...x,children:m}):e.jsx("code",{className:`${d} block bg-muted p-4 rounded-lg overflow-x-auto`,...x,children:m})},table({children:r,...d}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...d,children:r})})},th({children:r,...d}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...d,children:r})},td({children:r,...d}){return e.jsx("td",{className:"border border-border px-4 py-2",...d,children:r})},a({children:r,...d}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...d,children:r})},blockquote({children:r,...d}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...d,children:r})},h1({children:r,...d}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...d,children:r})},h2({children:r,...d}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...d,children:r})},h3({children:r,...d}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...d,children:r})},h4({children:r,...d}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...d,children:r})},ul({children:r,...d}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...d,children:r})},ol({children:r,...d}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...d,children:r})},p({children:r,...d}){return e.jsx("p",{className:"my-2 leading-relaxed",...d,children:r})},hr({...r}){return e.jsx("hr",{className:"my-4 border-border",...r})}},children:n})})}function T1({children:n,className:i}){return e.jsx(Jg,{content:n,className:i})}const va="/api/webui/emoji";async function E1(n){const i=new URLSearchParams;n.page&&i.append("page",n.page.toString()),n.page_size&&i.append("page_size",n.page_size.toString()),n.search&&i.append("search",n.search),n.is_registered!==void 0&&i.append("is_registered",n.is_registered.toString()),n.is_banned!==void 0&&i.append("is_banned",n.is_banned.toString()),n.format&&i.append("format",n.format),n.sort_by&&i.append("sort_by",n.sort_by),n.sort_order&&i.append("sort_order",n.sort_order);const r=await _e(`${va}/list?${i}`,{});if(!r.ok)throw new Error(`获取表情包列表失败: ${r.statusText}`);return r.json()}async function z1(n){const i=await _e(`${va}/${n}`,{});if(!i.ok)throw new Error(`获取表情包详情失败: ${i.statusText}`);return i.json()}async function M1(n,i){const r=await _e(`${va}/${n}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok)throw new Error(`更新表情包失败: ${r.statusText}`);return r.json()}async function A1(n){const i=await _e(`${va}/${n}`,{method:"DELETE"});if(!i.ok)throw new Error(`删除表情包失败: ${i.statusText}`);return i.json()}async function D1(){const n=await _e(`${va}/stats/summary`,{});if(!n.ok)throw new Error(`获取统计数据失败: ${n.statusText}`);return n.json()}async function O1(n){const i=await _e(`${va}/${n}/register`,{method:"POST"});if(!i.ok)throw new Error(`注册表情包失败: ${i.statusText}`);return i.json()}async function R1(n){const i=await _e(`${va}/${n}/ban`,{method:"POST"});if(!i.ok)throw new Error(`封禁表情包失败: ${i.statusText}`);return i.json()}function L1(n,i=!1){return i?`${va}/${n}/thumbnail?original=true`:`${va}/${n}/thumbnail`}function U1(n){return`${va}/${n}/thumbnail?original=true`}async function B1(n){const i=await _e(`${va}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:n})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除失败")}return i.json()}function H1(){return`${va}/upload`}function q1(){const[n,i]=u.useState([]),[r,d]=u.useState(null),[m,x]=u.useState(!1),[f,p]=u.useState(1),[g,b]=u.useState(0),[j,y]=u.useState(20),[N,k]=u.useState("all"),[w,U]=u.useState("all"),[D,B]=u.useState("all"),[Y,L]=u.useState("usage_count"),[z,X]=u.useState("desc"),[I,T]=u.useState(null),[M,ae]=u.useState(!1),[he,je]=u.useState(!1),[ge,fe]=u.useState(!1),[be,Te]=u.useState(new Set),[O,V]=u.useState(!1),[q,se]=u.useState(""),[R,ue]=u.useState("medium"),[xe,ke]=u.useState(!1),{toast:we}=qs(),Me=u.useCallback(async()=>{try{x(!0);const J=await E1({page:f,page_size:j,is_registered:N==="all"?void 0:N==="registered",is_banned:w==="all"?void 0:w==="banned",format:D==="all"?void 0:D,sort_by:Y,sort_order:z});i(J.data),b(J.total)}catch(J){const Ne=J instanceof Error?J.message:"加载表情包列表失败";we({title:"错误",description:Ne,variant:"destructive"})}finally{x(!1)}},[f,j,N,w,D,Y,z,we]),pe=async()=>{try{const J=await D1();d(J.data)}catch(J){console.error("加载统计数据失败:",J)}};u.useEffect(()=>{Me()},[Me]),u.useEffect(()=>{pe()},[]);const ee=async J=>{try{const Ne=await z1(J.id);T(Ne.data),ae(!0)}catch(Ne){const Ce=Ne instanceof Error?Ne.message:"加载详情失败";we({title:"错误",description:Ce,variant:"destructive"})}},ie=J=>{T(J),je(!0)},$=J=>{T(J),fe(!0)},Z=async()=>{if(I)try{await A1(I.id),we({title:"成功",description:"表情包已删除"}),fe(!1),T(null),Me(),pe()}catch(J){const Ne=J instanceof Error?J.message:"删除失败";we({title:"错误",description:Ne,variant:"destructive"})}},Ee=async J=>{try{await O1(J.id),we({title:"成功",description:"表情包已注册"}),Me(),pe()}catch(Ne){const Ce=Ne instanceof Error?Ne.message:"注册失败";we({title:"错误",description:Ce,variant:"destructive"})}},qe=async J=>{try{await R1(J.id),we({title:"成功",description:"表情包已封禁"}),Me(),pe()}catch(Ne){const Ce=Ne instanceof Error?Ne.message:"封禁失败";we({title:"错误",description:Ce,variant:"destructive"})}},E=J=>{const Ne=new Set(be);Ne.has(J)?Ne.delete(J):Ne.add(J),Te(Ne)},me=async()=>{try{const J=await B1(Array.from(be));we({title:"批量删除完成",description:J.message}),Te(new Set),V(!1),Me(),pe()}catch(J){we({title:"批量删除失败",description:J instanceof Error?J.message:"批量删除失败",variant:"destructive"})}},Ie=()=>{const J=parseInt(q),Ne=Math.ceil(g/j);J>=1&&J<=Ne?(p(J),se("")):we({title:"无效的页码",description:`请输入1-${Ne}之间的页码`,variant:"destructive"})},Se=r?.formats?Object.keys(r.formats):[];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),e.jsxs(S,{onClick:()=>ke(!0),className:"gap-2",children:[e.jsx(ur,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(Fe,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(Zs,{children:"总数"}),e.jsx(as,{className:"text-2xl",children:r.total})]})}),e.jsx(Fe,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(Zs,{children:"已注册"}),e.jsx(as,{className:"text-2xl text-green-600",children:r.registered})]})}),e.jsx(Fe,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(Zs,{children:"已封禁"}),e.jsx(as,{className:"text-2xl text-red-600",children:r.banned})]})}),e.jsx(Fe,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(Zs,{children:"未注册"}),e.jsx(as,{className:"text-2xl text-gray-600",children:r.unregistered})]})})]}),e.jsxs(Fe,{children:[e.jsx(ts,{children:e.jsxs(as,{className:"flex items-center gap-2",children:[e.jsx(Uu,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(hs,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"排序方式"}),e.jsxs(Ue,{value:`${Y}-${z}`,onValueChange:J=>{const[Ne,Ce]=J.split("-");L(Ne),X(Ce),p(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(le,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(le,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(le,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(le,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(le,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(le,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(le,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"注册状态"}),e.jsxs(Ue,{value:N,onValueChange:J=>{k(J),p(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),e.jsx(le,{value:"registered",children:"已注册"}),e.jsx(le,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"封禁状态"}),e.jsxs(Ue,{value:w,onValueChange:J=>{U(J),p(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),e.jsx(le,{value:"banned",children:"已封禁"}),e.jsx(le,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"格式"}),e.jsxs(Ue,{value:D,onValueChange:J=>{B(J),p(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),Se.map(J=>e.jsxs(le,{value:J,children:[J.toUpperCase()," (",r?.formats[J],")"]},J))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[be.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",be.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Ue,{value:R,onValueChange:J=>ue(J),children:[e.jsx(Oe,{className:"w-24",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"small",children:"小"}),e.jsx(le,{value:"medium",children:"中"}),e.jsx(le,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:j.toString(),onValueChange:J=>{y(parseInt(J)),p(1),Te(new Set)},children:[e.jsx(Oe,{id:"emoji-page-size",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"40",children:"40"}),e.jsx(le,{value:"60",children:"60"}),e.jsx(le,{value:"100",children:"100"})]})]}),be.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>Te(new Set),children:"取消选择"}),e.jsxs(S,{variant:"destructive",size:"sm",onClick:()=>V(!0),children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(S,{variant:"outline",size:"sm",onClick:Me,disabled:m,children:[e.jsx(Et,{className:`h-4 w-4 mr-2 ${m?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"表情包列表"}),e.jsxs(Zs,{children:["共 ",g," 个表情包,当前第 ",f," 页"]})]}),e.jsxs(hs,{children:[n.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${R==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":R==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:n.map(J=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${be.has(J.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>E(J.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${be.has(J.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${be.has(J.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:be.has(J.id)&&e.jsx(aa,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[J.is_registered&&e.jsx($e,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),J.is_banned&&e.jsx($e,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${R==="small"?"p-1":R==="medium"?"p-2":"p-3"}`,children:e.jsx(k1,{src:L1(J.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${R==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx($e,{variant:"outline",className:"text-[10px] px-1 py-0",children:J.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[J.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${R==="small"?"flex-wrap":""}`,children:[e.jsx(S,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ne=>{Ne.stopPropagation(),ie(J)},title:"编辑",children:e.jsx(nn,{className:"h-3 w-3"})}),e.jsx(S,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ne=>{Ne.stopPropagation(),ee(J)},title:"详情",children:e.jsx(La,{className:"h-3 w-3"})}),!J.is_registered&&e.jsx(S,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Ne=>{Ne.stopPropagation(),Ee(J)},title:"注册",children:e.jsx(aa,{className:"h-3 w-3"})}),!J.is_banned&&e.jsx(S,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Ne=>{Ne.stopPropagation(),qe(J)},title:"封禁",children:e.jsx(fy,{className:"h-3 w-3"})}),e.jsx(S,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Ne=>{Ne.stopPropagation(),$(J)},title:"删除",children:e.jsx(We,{className:"h-3 w-3"})})]})]})]},J.id))}),g>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(f-1)*j+1," 到"," ",Math.min(f*j,g)," 条,共 ",g," 条"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(J=>Math.max(1,J-1)),disabled:f===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:q,onChange:J=>se(J.target.value),onKeyDown:J=>J.key==="Enter"&&Ie(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(g/j)}),e.jsx(S,{variant:"outline",size:"sm",onClick:Ie,disabled:!q,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(J=>J+1),disabled:f>=Math.ceil(g/j),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(g/j)),disabled:f>=Math.ceil(g/j),className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(G1,{emoji:I,open:M,onOpenChange:ae}),e.jsx(F1,{emoji:I,open:he,onOpenChange:je,onSuccess:()=>{Me(),pe()}}),e.jsx(V1,{open:xe,onOpenChange:ke,onSuccess:()=>{Me(),pe()}})]})}),e.jsx(fs,{open:O,onOpenChange:V,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["你确定要删除选中的 ",be.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:me,children:"确认删除"})]})]})}),e.jsx(Hs,{open:ge,onOpenChange:fe,children:e.jsxs(Os,{children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"确认删除"}),e.jsx(Js,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>fe(!1),children:"取消"}),e.jsx(S,{variant:"destructive",onClick:Z,children:"删除"})]})]})})]})}function G1({emoji:n,open:i,onOpenChange:r}){if(!n)return null;const d=m=>m?new Date(m*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(Os,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Rs,{children:e.jsx(Ls,{children:"表情包详情"})}),e.jsx(Je,{className:"max-h-[calc(90vh-8rem)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:U1(n.id),alt:n.description||"表情包",className:"w-full h-full object-cover",onError:m=>{const x=m.target;x.style.display="none";const f=x.parentElement;f&&(f.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:n.id})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx($e,{variant:"outline",children:n.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:n.full_path})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:n.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"描述"}),n.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(T1,{className:"prose-sm",children:n.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:n.emotion?e.jsx("span",{className:"text-sm",children:n.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[n.is_registered&&e.jsx($e,{variant:"default",className:"bg-green-600",children:"已注册"}),n.is_banned&&e.jsx($e,{variant:"destructive",children:"已封禁"}),!n.is_registered&&!n.is_banned&&e.jsx($e,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:n.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:d(n.record_time)})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:d(n.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:d(n.last_used_time)})]})]})})]})})}function F1({emoji:n,open:i,onOpenChange:r,onSuccess:d}){const[m,x]=u.useState(""),[f,p]=u.useState(!1),[g,b]=u.useState(!1),[j,y]=u.useState(!1),{toast:N}=qs();u.useEffect(()=>{n&&(x(n.emotion||""),p(n.is_registered),b(n.is_banned))},[n]);const k=async()=>{if(n)try{y(!0);const w=m.split(/[,,]/).map(U=>U.trim()).filter(Boolean).join(",");await M1(n.id,{emotion:w||void 0,is_registered:f,is_banned:g}),N({title:"成功",description:"表情包信息已更新"}),r(!1),d()}catch(w){const U=w instanceof Error?w.message:"保存失败";N({title:"错误",description:U,variant:"destructive"})}finally{y(!1)}};return n?e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(Os,{className:"max-w-2xl",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"编辑表情包"}),e.jsx(Js,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(C,{children:"情绪"}),e.jsx(As,{value:m,onChange:w=>x(w.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(dt,{id:"is_registered",checked:f,onCheckedChange:w=>{w===!0?(p(!0),b(!1)):p(!1)}}),e.jsx(C,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(dt,{id:"is_banned",checked:g,onCheckedChange:w=>{w===!0?(b(!0),p(!1)):b(!1)}}),e.jsx(C,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(S,{onClick:k,disabled:j,children:j?"保存中...":"保存"})]})]})}):null}function V1({open:n,onOpenChange:i,onSuccess:r}){const[d,m]=u.useState("select"),[x,f]=u.useState([]),[p,g]=u.useState(null),[b,j]=u.useState(!1),{toast:y}=qs(),N=u.useMemo(()=>new Py({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);u.useEffect(()=>{const I=()=>{const T=N.getFiles();if(T.length===0)return;const M=T.map(ae=>({id:ae.id,name:ae.name,previewUrl:ae.preview||URL.createObjectURL(ae.data),emotion:"",description:"",isRegistered:!0,file:ae.data}));f(M),T.length===1?(g(M[0].id),m("edit-single")):m("edit-multiple")};return N.on("upload",I),()=>{N.off("upload",I)}},[N]),u.useEffect(()=>{n||(N.cancelAll(),m("select"),f([]),g(null),j(!1))},[n,N]);const k=u.useCallback((I,T)=>{f(M=>M.map(ae=>ae.id===I?{...ae,...T}:ae))},[]),w=u.useCallback(I=>I.emotion.trim().length>0,[]),U=u.useMemo(()=>x.length>0&&x.every(w),[x,w]),D=u.useMemo(()=>x.find(I=>I.id===p)||null,[x,p]),B=u.useCallback(()=>{(d==="edit-single"||d==="edit-multiple")&&(m("select"),f([]),g(null))},[d]),Y=u.useCallback(async()=>{if(!U){y({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}j(!0);const I=localStorage.getItem("access-token")||"";let T=0,M=0;try{for(const ae of x){const he=new FormData;he.append("file",ae.file),he.append("emotion",ae.emotion),he.append("description",ae.description),he.append("is_registered",ae.isRegistered.toString());try{(await fetch(H1(),{method:"POST",headers:{Authorization:`Bearer ${I}`},body:he})).ok?T++:M++}catch{M++}}M===0?(y({title:"上传成功",description:`成功上传 ${T} 个表情包`}),i(!1),r()):(y({title:"部分上传失败",description:`成功 ${T} 个,失败 ${M} 个`,variant:"destructive"}),r())}finally{j(!1)}},[U,x,y,i,r]),L=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(C1,{uppy:N,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),z=()=>{const I=x[0];return I?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(S,{variant:"ghost",size:"sm",onClick:B,children:[e.jsx(ei,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"编辑表情包信息"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("div",{className:"w-32 h-32 rounded-lg border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:I.previewUrl,alt:I.name,className:"max-w-full max-h-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate max-w-32",children:I.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"single-emotion",value:I.emotion,onChange:T=>k(I.id,{emotion:T.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:I.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"single-description",children:"描述"}),e.jsx(re,{id:"single-description",value:I.description,onChange:T=>k(I.id,{description:T.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(dt,{id:"single-is-registered",checked:I.isRegistered,onCheckedChange:T=>k(I.id,{isRegistered:T===!0})}),e.jsx(C,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(et,{children:e.jsx(S,{onClick:Y,disabled:!U||b,children:b?"上传中...":"上传"})})]}):null},X=()=>{const I=x.filter(w).length,T=x.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(S,{variant:"ghost",size:"sm",onClick:B,children:[e.jsx(ei,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",I,"/",T," 已完成)"]})]}),e.jsx($e,{variant:U?"default":"secondary",children:U?e.jsxs(e.Fragment,{children:[e.jsx($t,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(il,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Je,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:x.map(M=>{const ae=w(M),he=p===M.id;return e.jsxs("div",{onClick:()=>g(M.id),className:` - flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all - ${he?"ring-2 ring-primary":""} - ${ae?"border-green-500 bg-green-50 dark:bg-green-950/20":"border-border hover:border-muted-foreground/50"} - `,children:[e.jsx("div",{className:"w-12 h-12 rounded border overflow-hidden bg-muted flex-shrink-0 flex items-center justify-center",children:e.jsx("img",{src:M.previewUrl,alt:M.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:M.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:M.emotion||"未填写情感标签"})]}),ae?e.jsx(aa,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):e.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-muted-foreground/30 flex-shrink-0"})]},M.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:D?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-16 h-16 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:D.previewUrl,alt:D.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:D.name}),w(D)&&e.jsxs($e,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx($t,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"multi-emotion",value:D.emotion,onChange:M=>k(D.id,{emotion:M.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:D.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"multi-description",children:"描述"}),e.jsx(re,{id:"multi-description",value:D.description,onChange:M=>k(D.id,{description:M.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(dt,{id:"multi-is-registered",checked:D.isRegistered,onCheckedChange:M=>k(D.id,{isRegistered:M===!0})}),e.jsx(C,{htmlFor:"multi-is-registered",className:"cursor-pointer text-sm",children:"上传后立即注册"})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Ng,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(et,{children:e.jsx(S,{onClick:Y,disabled:!U||b,children:b?"上传中...":`上传全部 (${T})`})})]})};return e.jsx(Hs,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Rs,{children:[e.jsxs(Ls,{className:"flex items-center gap-2",children:[e.jsx(ur,{className:"h-5 w-5"}),d==="select"&&"上传表情包 - 选择文件",d==="edit-single"&&"上传表情包 - 填写信息",d==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(Js,{children:[d==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",d==="edit-single"&&"请填写表情包的情感标签(必填)和描述",d==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[d==="select"&&L(),d==="edit-single"&&z(),d==="edit-multiple"&&X()]})]})})}const Bl="/api/webui/expression";async function $1(){const n=await _e(`${Bl}/chats`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取聊天列表失败")}return n.json()}async function Q1(n){const i=new URLSearchParams;n.page&&i.append("page",n.page.toString()),n.page_size&&i.append("page_size",n.page_size.toString()),n.search&&i.append("search",n.search),n.chat_id&&i.append("chat_id",n.chat_id);const r=await _e(`${Bl}/list?${i}`,{});if(!r.ok){const d=await r.json();throw new Error(d.detail||"获取表达方式列表失败")}return r.json()}async function I1(n){const i=await _e(`${Bl}/${n}`,{});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取表达方式详情失败")}return i.json()}async function Y1(n){const i=await _e(`${Bl}/`,{method:"POST",body:JSON.stringify(n)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"创建表达方式失败")}return i.json()}async function X1(n,i){const r=await _e(`${Bl}/${n}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok){const d=await r.json();throw new Error(d.detail||"更新表达方式失败")}return r.json()}async function K1(n){const i=await _e(`${Bl}/${n}`,{method:"DELETE"});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除表达方式失败")}return i.json()}async function J1(n){const i=await _e(`${Bl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:n})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除表达方式失败")}return i.json()}async function P1(){const n=await _e(`${Bl}/stats/summary`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取统计数据失败")}return n.json()}function Z1(){const[n,i]=u.useState([]),[r,d]=u.useState(!0),[m,x]=u.useState(0),[f,p]=u.useState(1),[g,b]=u.useState(20),[j,y]=u.useState(""),[N,k]=u.useState(null),[w,U]=u.useState(!1),[D,B]=u.useState(!1),[Y,L]=u.useState(!1),[z,X]=u.useState(null),[I,T]=u.useState(new Set),[M,ae]=u.useState(!1),[he,je]=u.useState(""),[ge,fe]=u.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[be,Te]=u.useState([]),[O,V]=u.useState(new Map),{toast:q}=qs(),se=async()=>{try{d(!0);const Z=await Q1({page:f,page_size:g,search:j||void 0});i(Z.data),x(Z.total)}catch(Z){q({title:"加载失败",description:Z instanceof Error?Z.message:"无法加载表达方式",variant:"destructive"})}finally{d(!1)}},R=async()=>{try{const Z=await P1();Z?.data&&fe(Z.data)}catch(Z){console.error("加载统计数据失败:",Z)}},ue=async()=>{try{const Z=await $1();if(Z?.data){Te(Z.data);const Ee=new Map;Z.data.forEach(qe=>{Ee.set(qe.chat_id,qe.chat_name)}),V(Ee)}}catch(Z){console.error("加载聊天列表失败:",Z)}},xe=Z=>O.get(Z)||Z;u.useEffect(()=>{se(),R(),ue()},[f,g,j]);const ke=async Z=>{try{const Ee=await I1(Z.id);k(Ee.data),U(!0)}catch(Ee){q({title:"加载详情失败",description:Ee instanceof Error?Ee.message:"无法加载表达方式详情",variant:"destructive"})}},we=Z=>{k(Z),B(!0)},Me=async Z=>{try{await K1(Z.id),q({title:"删除成功",description:`已删除表达方式: ${Z.situation}`}),X(null),se(),R()}catch(Ee){q({title:"删除失败",description:Ee instanceof Error?Ee.message:"无法删除表达方式",variant:"destructive"})}},pe=Z=>{const Ee=new Set(I);Ee.has(Z)?Ee.delete(Z):Ee.add(Z),T(Ee)},ee=()=>{I.size===n.length&&n.length>0?T(new Set):T(new Set(n.map(Z=>Z.id)))},ie=async()=>{try{await J1(Array.from(I)),q({title:"批量删除成功",description:`已删除 ${I.size} 个表达方式`}),T(new Set),ae(!1),se(),R()}catch(Z){q({title:"批量删除失败",description:Z instanceof Error?Z.message:"无法批量删除表达方式",variant:"destructive"})}},$=()=>{const Z=parseInt(he),Ee=Math.ceil(m/g);Z>=1&&Z<=Ee?(p(Z),je("")):q({title:"无效的页码",description:`请输入1-${Ee}之间的页码`,variant:"destructive"})};return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Rl,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs(S,{onClick:()=>L(!0),className:"gap-2",children:[e.jsx(ct,{className:"h-4 w-4"}),"新增表达方式"]})]})}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:ge.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:ge.recent_7days})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:ge.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(C,{htmlFor:"search",children:"搜索"}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(At,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索情境、风格或上下文...",value:j,onChange:Z=>y(Z.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:I.size>0&&e.jsxs("span",{children:["已选择 ",I.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:g.toString(),onValueChange:Z=>{b(parseInt(Z)),p(1),T(new Set)},children:[e.jsx(Oe,{id:"page-size",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]}),I.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>T(new Set),children:"取消选择"}),e.jsxs(S,{variant:"destructive",size:"sm",onClick:()=>ae(!0),children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ot,{children:[e.jsx(Ke,{className:"w-12",children:e.jsx(dt,{checked:I.size===n.length&&n.length>0,onCheckedChange:ee})}),e.jsx(Ke,{children:"情境"}),e.jsx(Ke,{children:"风格"}),e.jsx(Ke,{children:"聊天"}),e.jsx(Ke,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:r?e.jsx(ot,{children:e.jsx(Ve,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):n.length===0?e.jsx(ot,{children:e.jsx(Ve,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):n.map(Z=>e.jsxs(ot,{children:[e.jsx(Ve,{children:e.jsx(dt,{checked:I.has(Z.id),onCheckedChange:()=>pe(Z.id)})}),e.jsx(Ve,{className:"font-medium max-w-xs truncate",children:Z.situation}),e.jsx(Ve,{className:"max-w-xs truncate",children:Z.style}),e.jsx(Ve,{className:"max-w-[200px] truncate",title:xe(Z.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:xe(Z.chat_id)})}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(S,{variant:"default",size:"sm",onClick:()=>we(Z),children:[e.jsx(nn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(S,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ke(Z),title:"查看详情",children:e.jsx(Rt,{className:"h-4 w-4"})}),e.jsxs(S,{size:"sm",onClick:()=>X(Z),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Z.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):n.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):n.map(Z=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(dt,{checked:I.has(Z.id),onCheckedChange:()=>pe(Z.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:Z.situation,children:Z.situation})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),e.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:Z.style,children:Z.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("p",{className:"text-sm truncate",title:xe(Z.chat_id),style:{wordBreak:"keep-all"},children:xe(Z.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>we(Z),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(nn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>ke(Z),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(Rt,{className:"h-3 w-3"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>X(Z),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(We,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Z.id))}),m>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",m," 条记录,第 ",f," / ",Math.ceil(m/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f-1),disabled:f===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:he,onChange:Z=>je(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&$(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/g)}),e.jsx(S,{variant:"outline",size:"sm",onClick:$,disabled:!he,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f+1),disabled:f>=Math.ceil(m/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(m/g)),disabled:f>=Math.ceil(m/g),className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(W1,{expression:N,open:w,onOpenChange:U,chatNameMap:O}),e.jsx(e2,{open:Y,onOpenChange:L,chatList:be,onSuccess:()=>{se(),R(),L(!1)}}),e.jsx(s2,{expression:N,open:D,onOpenChange:B,chatList:be,onSuccess:()=>{se(),R(),B(!1)}}),e.jsx(fs,{open:!!z,onOpenChange:()=>X(null),children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除表达方式 "',z?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>z&&Me(z),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(t2,{open:M,onOpenChange:ae,onConfirm:ie,count:I.size})]})}function W1({expression:n,open:i,onOpenChange:r,chatNameMap:d}){if(!n)return null;const m=f=>f?new Date(f*1e3).toLocaleString("zh-CN"):"-",x=f=>d.get(f)||f;return e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"表达方式详情"}),e.jsx(Js,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ar,{label:"情境",value:n.situation}),e.jsx(ar,{label:"风格",value:n.style}),e.jsx(ar,{label:"聊天",value:x(n.chat_id)}),e.jsx(ar,{icon:si,label:"记录ID",value:n.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(ar,{icon:Zn,label:"创建时间",value:m(n.create_date)})})]}),e.jsx(et,{children:e.jsx(S,{onClick:()=>r(!1),children:"关闭"})})]})})}function ar({icon:n,label:i,value:r,mono:d=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n&&e.jsx(n,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:F("text-sm",d&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function e2({open:n,onOpenChange:i,chatList:r,onSuccess:d}){const[m,x]=u.useState({situation:"",style:"",chat_id:""}),[f,p]=u.useState(!1),{toast:g}=qs(),b=async()=>{if(!m.situation||!m.style||!m.chat_id){g({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{p(!0),await Y1(m),g({title:"创建成功",description:"表达方式已创建"}),x({situation:"",style:"",chat_id:""}),d()}catch(j){g({title:"创建失败",description:j instanceof Error?j.message:"无法创建表达方式",variant:"destructive"})}finally{p(!1)}};return e.jsx(Hs,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"新增表达方式"}),e.jsx(Js,{children:"创建新的表达方式记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"situation",value:m.situation,onChange:j=>x({...m,situation:j.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"style",value:m.style,onChange:j=>x({...m,style:j.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Ue,{value:m.chat_id,onValueChange:j=>x({...m,chat_id:j}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:r.map(j=>e.jsx(le,{value:j.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[j.chat_name,j.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},j.chat_id))})]})]})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(S,{onClick:b,disabled:f,children:f?"创建中...":"创建"})]})]})})}function s2({expression:n,open:i,onOpenChange:r,chatList:d,onSuccess:m}){const[x,f]=u.useState({}),[p,g]=u.useState(!1),{toast:b}=qs();u.useEffect(()=>{n&&f({situation:n.situation,style:n.style,chat_id:n.chat_id})},[n]);const j=async()=>{if(n)try{g(!0),await X1(n.id,x),b({title:"保存成功",description:"表达方式已更新"}),m()}catch(y){b({title:"保存失败",description:y instanceof Error?y.message:"无法更新表达方式",variant:"destructive"})}finally{g(!1)}};return n?e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"编辑表达方式"}),e.jsx(Js,{children:"修改表达方式的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_situation",children:"情境"}),e.jsx(re,{id:"edit_situation",value:x.situation||"",onChange:y=>f({...x,situation:y.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_style",children:"风格"}),e.jsx(re,{id:"edit_style",value:x.style||"",onChange:y=>f({...x,style:y.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Ue,{value:x.chat_id||"",onValueChange:y=>f({...x,chat_id:y}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:d.map(y=>e.jsx(le,{value:y.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[y.chat_name,y.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},y.chat_id))})]})]})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(S,{onClick:j,disabled:p,children:p?"保存中...":"保存"})]})]})}):null}function t2({open:n,onOpenChange:i,onConfirm:r,count:d}){return e.jsx(fs,{open:n,onOpenChange:i,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["您即将删除 ",d," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const cl="/api/webui/jargon";async function a2(){const n=await _e(`${cl}/chats`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取聊天列表失败")}return n.json()}async function l2(n){const i=new URLSearchParams;n.page&&i.append("page",n.page.toString()),n.page_size&&i.append("page_size",n.page_size.toString()),n.search&&i.append("search",n.search),n.chat_id&&i.append("chat_id",n.chat_id),n.is_jargon!==void 0&&n.is_jargon!==null&&i.append("is_jargon",n.is_jargon.toString()),n.is_global!==void 0&&i.append("is_global",n.is_global.toString());const r=await _e(`${cl}/list?${i}`,{});if(!r.ok){const d=await r.json();throw new Error(d.detail||"获取黑话列表失败")}return r.json()}async function n2(n){const i=await _e(`${cl}/${n}`,{});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取黑话详情失败")}return i.json()}async function i2(n){const i=await _e(`${cl}/`,{method:"POST",body:JSON.stringify(n)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"创建黑话失败")}return i.json()}async function r2(n,i){const r=await _e(`${cl}/${n}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok){const d=await r.json();throw new Error(d.detail||"更新黑话失败")}return r.json()}async function c2(n){const i=await _e(`${cl}/${n}`,{method:"DELETE"});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除黑话失败")}return i.json()}async function o2(n){const i=await _e(`${cl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:n})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除黑话失败")}return i.json()}async function d2(){const n=await _e(`${cl}/stats/summary`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取黑话统计失败")}return n.json()}async function u2(n,i){const r=new URLSearchParams;n.forEach(m=>r.append("ids",m.toString())),r.append("is_jargon",i.toString());const d=await _e(`${cl}/batch/set-jargon?${r}`,{method:"POST"});if(!d.ok){const m=await d.json();throw new Error(m.detail||"批量设置黑话状态失败")}return d.json()}function m2(){const[n,i]=u.useState([]),[r,d]=u.useState(!0),[m,x]=u.useState(0),[f,p]=u.useState(1),[g,b]=u.useState(20),[j,y]=u.useState(""),[N,k]=u.useState("all"),[w,U]=u.useState("all"),[D,B]=u.useState(null),[Y,L]=u.useState(!1),[z,X]=u.useState(!1),[I,T]=u.useState(!1),[M,ae]=u.useState(null),[he,je]=u.useState(new Set),[ge,fe]=u.useState(!1),[be,Te]=u.useState(""),[O,V]=u.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[q,se]=u.useState([]),{toast:R}=qs(),ue=async()=>{try{d(!0);const E=await l2({page:f,page_size:g,search:j||void 0,chat_id:N==="all"?void 0:N,is_jargon:w==="all"?void 0:w==="true"?!0:w==="false"?!1:void 0});i(E.data),x(E.total)}catch(E){R({title:"加载失败",description:E instanceof Error?E.message:"无法加载黑话列表",variant:"destructive"})}finally{d(!1)}},xe=async()=>{try{const E=await d2();E?.data&&V(E.data)}catch(E){console.error("加载统计数据失败:",E)}},ke=async()=>{try{const E=await a2();E?.data&&se(E.data)}catch(E){console.error("加载聊天列表失败:",E)}};u.useEffect(()=>{ue(),xe(),ke()},[f,g,j,N,w]);const we=async E=>{try{const me=await n2(E.id);B(me.data),L(!0)}catch(me){R({title:"加载详情失败",description:me instanceof Error?me.message:"无法加载黑话详情",variant:"destructive"})}},Me=E=>{B(E),X(!0)},pe=async E=>{try{await c2(E.id),R({title:"删除成功",description:`已删除黑话: ${E.content}`}),ae(null),ue(),xe()}catch(me){R({title:"删除失败",description:me instanceof Error?me.message:"无法删除黑话",variant:"destructive"})}},ee=E=>{const me=new Set(he);me.has(E)?me.delete(E):me.add(E),je(me)},ie=()=>{he.size===n.length&&n.length>0?je(new Set):je(new Set(n.map(E=>E.id)))},$=async()=>{try{await o2(Array.from(he)),R({title:"批量删除成功",description:`已删除 ${he.size} 个黑话`}),je(new Set),fe(!1),ue(),xe()}catch(E){R({title:"批量删除失败",description:E instanceof Error?E.message:"无法批量删除黑话",variant:"destructive"})}},Z=async E=>{try{await u2(Array.from(he),E),R({title:"操作成功",description:`已将 ${he.size} 个词条设为${E?"黑话":"非黑话"}`}),je(new Set),ue(),xe()}catch(me){R({title:"操作失败",description:me instanceof Error?me.message:"批量设置失败",variant:"destructive"})}},Ee=()=>{const E=parseInt(be),me=Math.ceil(m/g);E>=1&&E<=me?(p(E),Te("")):R({title:"无效的页码",description:`请输入1-${me}之间的页码`,variant:"destructive"})},qe=E=>E===!0?e.jsxs($e,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx($t,{className:"h-3 w-3 mr-1"}),"是黑话"]}):E===!1?e.jsxs($e,{variant:"secondary",children:[e.jsx(il,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs($e,{variant:"outline",children:[e.jsx(bg,{className:"h-3 w-3 mr-1"}),"未判定"]});return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(py,{className:"h-8 w-8",strokeWidth:2}),"黑话管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦学习到的黑话和俚语"})]}),e.jsxs(S,{onClick:()=>T(!0),className:"gap-2",children:[e.jsx(ct,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:O.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"已确认黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-green-600",children:O.confirmed_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"确认非黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-gray-500",children:O.confirmed_not_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"待判定"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-yellow-600",children:O.pending})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"全局黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-blue-600",children:O.global_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"推断完成"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-purple-600",children:O.complete_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:O.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(At,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索内容、含义...",value:j,onChange:E=>y(E.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"聊天筛选"}),e.jsxs(Ue,{value:N,onValueChange:k,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"全部聊天"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部聊天"}),q.map(E=>e.jsx(le,{value:E.chat_id,children:E.chat_name},E.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"状态筛选"}),e.jsxs(Ue,{value:w,onValueChange:U,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"全部状态"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部状态"}),e.jsx(le,{value:"true",children:"是黑话"}),e.jsx(le,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Ue,{value:g.toString(),onValueChange:E=>{b(parseInt(E)),p(1),je(new Set)},children:[e.jsx(Oe,{id:"page-size",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]})]})]}),he.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4 pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",he.size," 个"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>Z(!0),children:[e.jsx($t,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>Z(!1),children:[e.jsx(il,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>je(new Set),children:"取消选择"}),e.jsxs(S,{variant:"destructive",size:"sm",onClick:()=>fe(!0),children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ot,{children:[e.jsx(Ke,{className:"w-12",children:e.jsx(dt,{checked:he.size===n.length&&n.length>0,onCheckedChange:ie})}),e.jsx(Ke,{children:"内容"}),e.jsx(Ke,{children:"含义"}),e.jsx(Ke,{children:"聊天"}),e.jsx(Ke,{children:"状态"}),e.jsx(Ke,{className:"text-center",children:"次数"}),e.jsx(Ke,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:r?e.jsx(ot,{children:e.jsx(Ve,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):n.length===0?e.jsx(ot,{children:e.jsx(Ve,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):n.map(E=>e.jsxs(ot,{children:[e.jsx(Ve,{children:e.jsx(dt,{checked:he.has(E.id),onCheckedChange:()=>ee(E.id)})}),e.jsx(Ve,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[E.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(Bu,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:E.content,children:E.content})]})}),e.jsx(Ve,{className:"max-w-[200px] truncate",title:E.meaning||"",children:E.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ve,{className:"max-w-[150px] truncate",title:E.chat_name||E.chat_id,children:E.chat_name||E.chat_id}),e.jsx(Ve,{children:qe(E.is_jargon)}),e.jsx(Ve,{className:"text-center",children:E.count}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(S,{variant:"default",size:"sm",onClick:()=>Me(E),children:[e.jsx(nn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(S,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>we(E),title:"查看详情",children:e.jsx(Rt,{className:"h-4 w-4"})}),e.jsxs(S,{size:"sm",onClick:()=>ae(E),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},E.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):n.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):n.map(E=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(dt,{checked:he.has(E.id),onCheckedChange:()=>ee(E.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[E.is_global&&e.jsx(Bu,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:E.content})]}),E.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:E.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[qe(E.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",E.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",E.chat_name||E.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>Me(E),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(nn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>we(E),className:"text-xs px-2 py-1 h-auto",children:e.jsx(Rt,{className:"h-3 w-3"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>ae(E),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(We,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},E.id))}),m>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",m," 条记录,第 ",f," / ",Math.ceil(m/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f-1),disabled:f===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:be,onChange:E=>Te(E.target.value),onKeyDown:E=>E.key==="Enter"&&Ee(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/g)}),e.jsx(S,{variant:"outline",size:"sm",onClick:Ee,disabled:!be,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f+1),disabled:f>=Math.ceil(m/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(m/g)),disabled:f>=Math.ceil(m/g),className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(x2,{jargon:D,open:Y,onOpenChange:L}),e.jsx(h2,{open:I,onOpenChange:T,chatList:q,onSuccess:()=>{ue(),xe(),T(!1)}}),e.jsx(f2,{jargon:D,open:z,onOpenChange:X,chatList:q,onSuccess:()=>{ue(),xe(),X(!1)}}),e.jsx(fs,{open:!!M,onOpenChange:()=>ae(null),children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除黑话 "',M?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>M&&pe(M),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(fs,{open:ge,onOpenChange:fe,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["您即将删除 ",he.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:$,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function x2({jargon:n,open:i,onOpenChange:r}){return n?e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"黑话详情"}),e.jsx(Js,{children:"查看黑话的完整信息"})]}),e.jsx(Je,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ru,{icon:si,label:"记录ID",value:n.id.toString(),mono:!0}),e.jsx(Ru,{label:"使用次数",value:n.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:n.content})]}),n.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"原始内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const d=JSON.parse(n.raw_content);return Array.isArray(d)?d.map((m,x)=>e.jsxs("div",{children:[x>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:m})]},x)):e.jsx("div",{className:"whitespace-pre-wrap",children:n.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:n.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:n.meaning?e.jsx(Jg,{content:n.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ru,{label:"聊天",value:n.chat_name||n.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[n.is_jargon===!0&&e.jsx($e,{variant:"default",className:"bg-green-600",children:"是黑话"}),n.is_jargon===!1&&e.jsx($e,{variant:"secondary",children:"非黑话"}),n.is_jargon===null&&e.jsx($e,{variant:"outline",children:"未判定"}),n.is_global&&e.jsx($e,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),n.is_complete&&e.jsx($e,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),n.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"上下文推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:n.inference_with_context})]}),n.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"纯词条推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:n.inference_content_only})]})]})}),e.jsx(et,{className:"flex-shrink-0",children:e.jsx(S,{onClick:()=>r(!1),children:"关闭"})})]})}):null}function Ru({icon:n,label:i,value:r,mono:d=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n&&e.jsx(n,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:F("text-sm",d&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function h2({open:n,onOpenChange:i,chatList:r,onSuccess:d}){const[m,x]=u.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[f,p]=u.useState(!1),{toast:g}=qs(),b=async()=>{if(!m.content||!m.chat_id){g({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{p(!0),await i2(m),g({title:"创建成功",description:"黑话已创建"}),x({content:"",meaning:"",chat_id:"",is_global:!1}),d()}catch(j){g({title:"创建失败",description:j instanceof Error?j.message:"无法创建黑话",variant:"destructive"})}finally{p(!1)}};return e.jsx(Hs,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"新增黑话"}),e.jsx(Js,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"content",value:m.content,onChange:j=>x({...m,content:j.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"meaning",children:"含义"}),e.jsx(As,{id:"meaning",value:m.meaning||"",onChange:j=>x({...m,meaning:j.target.value}),placeholder:"输入黑话含义(可选)",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Ue,{value:m.chat_id,onValueChange:j=>x({...m,chat_id:j}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:r.map(j=>e.jsx(le,{value:j.chat_id,children:j.chat_name},j.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"is_global",checked:m.is_global,onCheckedChange:j=>x({...m,is_global:j})}),e.jsx(C,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(S,{onClick:b,disabled:f,children:f?"创建中...":"创建"})]})]})})}function f2({jargon:n,open:i,onOpenChange:r,chatList:d,onSuccess:m}){const[x,f]=u.useState({}),[p,g]=u.useState(!1),{toast:b}=qs();u.useEffect(()=>{n&&f({content:n.content,meaning:n.meaning||"",chat_id:n.stream_id||n.chat_id,is_global:n.is_global,is_jargon:n.is_jargon})},[n]);const j=async()=>{if(n)try{g(!0),await r2(n.id,x),b({title:"保存成功",description:"黑话已更新"}),m()}catch(y){b({title:"保存失败",description:y instanceof Error?y.message:"无法更新黑话",variant:"destructive"})}finally{g(!1)}};return n?e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"编辑黑话"}),e.jsx(Js,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_content",children:"内容"}),e.jsx(re,{id:"edit_content",value:x.content||"",onChange:y=>f({...x,content:y.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(As,{id:"edit_meaning",value:x.meaning||"",onChange:y=>f({...x,meaning:y.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Ue,{value:x.chat_id||"",onValueChange:y=>f({...x,chat_id:y}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:d.map(y=>e.jsx(le,{value:y.chat_id,children:y.chat_name},y.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"黑话状态"}),e.jsxs(Ue,{value:x.is_jargon===null?"null":x.is_jargon?.toString()||"null",onValueChange:y=>f({...x,is_jargon:y==="null"?null:y==="true"}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"null",children:"未判定"}),e.jsx(le,{value:"true",children:"是黑话"}),e.jsx(le,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"edit_is_global",checked:x.is_global,onCheckedChange:y=>f({...x,is_global:y})}),e.jsx(C,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(S,{onClick:j,disabled:p,children:p?"保存中...":"保存"})]})]})}):null}const ri="/api/webui/person";async function p2(n){const i=new URLSearchParams;n.page&&i.append("page",n.page.toString()),n.page_size&&i.append("page_size",n.page_size.toString()),n.search&&i.append("search",n.search),n.is_known!==void 0&&i.append("is_known",n.is_known.toString()),n.platform&&i.append("platform",n.platform);const r=await _e(`${ri}/list?${i}`,{headers:Ds()});if(!r.ok){const d=await r.json();throw new Error(d.detail||"获取人物列表失败")}return r.json()}async function g2(n){const i=await _e(`${ri}/${n}`,{headers:Ds()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取人物详情失败")}return i.json()}async function j2(n,i){const r=await _e(`${ri}/${n}`,{method:"PATCH",headers:Ds(),body:JSON.stringify(i)});if(!r.ok){const d=await r.json();throw new Error(d.detail||"更新人物信息失败")}return r.json()}async function v2(n){const i=await _e(`${ri}/${n}`,{method:"DELETE",headers:Ds()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除人物信息失败")}return i.json()}async function b2(){const n=await _e(`${ri}/stats/summary`,{headers:Ds()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取统计数据失败")}return n.json()}async function N2(n){const i=await _e(`${ri}/batch/delete`,{method:"POST",headers:Ds(),body:JSON.stringify({person_ids:n})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除失败")}return i.json()}function y2(){const[n,i]=u.useState([]),[r,d]=u.useState(!0),[m,x]=u.useState(0),[f,p]=u.useState(1),[g,b]=u.useState(20),[j,y]=u.useState(""),[N,k]=u.useState(void 0),[w,U]=u.useState(void 0),[D,B]=u.useState(null),[Y,L]=u.useState(!1),[z,X]=u.useState(!1),[I,T]=u.useState(null),[M,ae]=u.useState({total:0,known:0,unknown:0,platforms:{}}),[he,je]=u.useState(new Set),[ge,fe]=u.useState(!1),[be,Te]=u.useState(""),{toast:O}=qs(),V=async()=>{try{d(!0);const $=await p2({page:f,page_size:g,search:j||void 0,is_known:N,platform:w});i($.data),x($.total)}catch($){O({title:"加载失败",description:$ instanceof Error?$.message:"无法加载人物信息",variant:"destructive"})}finally{d(!1)}},q=async()=>{try{const $=await b2();$?.data&&ae($.data)}catch($){console.error("加载统计数据失败:",$)}};u.useEffect(()=>{V(),q()},[f,g,j,N,w]);const se=async $=>{try{const Z=await g2($.person_id);B(Z.data),L(!0)}catch(Z){O({title:"加载详情失败",description:Z instanceof Error?Z.message:"无法加载人物详情",variant:"destructive"})}},R=$=>{B($),X(!0)},ue=async $=>{try{await v2($.person_id),O({title:"删除成功",description:`已删除人物信息: ${$.person_name||$.nickname||$.user_id}`}),T(null),V(),q()}catch(Z){O({title:"删除失败",description:Z instanceof Error?Z.message:"无法删除人物信息",variant:"destructive"})}},xe=u.useMemo(()=>Object.keys(M.platforms),[M.platforms]),ke=$=>{const Z=new Set(he);Z.has($)?Z.delete($):Z.add($),je(Z)},we=()=>{he.size===n.length&&n.length>0?je(new Set):je(new Set(n.map($=>$.person_id)))},Me=()=>{if(he.size===0){O({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}fe(!0)},pe=async()=>{try{const $=await N2(Array.from(he));O({title:"批量删除完成",description:$.message}),je(new Set),fe(!1),V(),q()}catch($){O({title:"批量删除失败",description:$ instanceof Error?$.message:"批量删除失败",variant:"destructive"})}},ee=()=>{const $=parseInt(be),Z=Math.ceil(m/g);$>=1&&$<=Z?(p($),Te("")):O({title:"无效的页码",description:`请输入1-${Z}之间的页码`,variant:"destructive"})},ie=$=>$?new Date($*1e3).toLocaleString("zh-CN"):"-";return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Hu,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:M.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:M.known})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:M.unknown})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(C,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(At,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:j,onChange:$=>y($.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(C,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Ue,{value:N===void 0?"all":N.toString(),onValueChange:$=>{k($==="all"?void 0:$==="true"),p(1)},children:[e.jsx(Oe,{id:"filter-known",className:"mt-1.5",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),e.jsx(le,{value:"true",children:"已认识"}),e.jsx(le,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Ue,{value:w||"all",onValueChange:$=>{U($==="all"?void 0:$),p(1)},children:[e.jsx(Oe,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部平台"}),xe.map($=>e.jsxs(le,{value:$,children:[$," (",M.platforms[$],")"]},$))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:he.size>0&&e.jsxs("span",{children:["已选择 ",he.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:g.toString(),onValueChange:$=>{b(parseInt($)),p(1),je(new Set)},children:[e.jsx(Oe,{id:"page-size",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]}),he.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>je(new Set),children:"取消选择"}),e.jsxs(S,{variant:"destructive",size:"sm",onClick:Me,children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ot,{children:[e.jsx(Ke,{className:"w-12",children:e.jsx(dt,{checked:n.length>0&&he.size===n.length,onCheckedChange:we,"aria-label":"全选"})}),e.jsx(Ke,{children:"状态"}),e.jsx(Ke,{children:"名称"}),e.jsx(Ke,{children:"昵称"}),e.jsx(Ke,{children:"平台"}),e.jsx(Ke,{children:"用户ID"}),e.jsx(Ke,{children:"最后更新"}),e.jsx(Ke,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:r?e.jsx(ot,{children:e.jsx(Ve,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):n.length===0?e.jsx(ot,{children:e.jsx(Ve,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):n.map($=>e.jsxs(ot,{children:[e.jsx(Ve,{children:e.jsx(dt,{checked:he.has($.person_id),onCheckedChange:()=>ke($.person_id),"aria-label":`选择 ${$.person_name||$.nickname||$.user_id}`})}),e.jsx(Ve,{children:e.jsx("div",{className:F("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",$.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:$.is_known?"已认识":"未认识"})}),e.jsx(Ve,{className:"font-medium",children:$.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ve,{children:$.nickname||"-"}),e.jsx(Ve,{children:$.platform}),e.jsx(Ve,{className:"font-mono text-sm",children:$.user_id}),e.jsx(Ve,{className:"text-sm text-muted-foreground",children:ie($.last_know)}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(S,{variant:"default",size:"sm",onClick:()=>se($),children:[e.jsx(Rt,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(S,{variant:"default",size:"sm",onClick:()=>R($),children:[e.jsx(nn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(S,{size:"sm",onClick:()=>T($),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},$.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):n.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):n.map($=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(dt,{checked:he.has($.person_id),onCheckedChange:()=>ke($.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:F("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",$.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:$.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:$.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),$.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",$.nickname]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),e.jsx("p",{className:"font-medium text-xs",children:$.platform})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),e.jsx("p",{className:"font-mono text-xs truncate",title:$.user_id,children:$.user_id})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),e.jsx("p",{className:"text-xs",children:ie($.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>se($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Rt,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>R($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(nn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>T($),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(We,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},$.id))}),m>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",m," 条记录,第 ",f," / ",Math.ceil(m/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:f===1,className:"hidden sm:flex",children:e.jsx(li,{className:"h-4 w-4"})}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f-1),disabled:f===1,children:[e.jsx(rl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:be,onChange:$=>Te($.target.value),onKeyDown:$=>$.key==="Enter"&&ee(),placeholder:f.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/g)}),e.jsx(S,{variant:"outline",size:"sm",onClick:ee,disabled:!be,className:"h-8",children:"跳转"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>p(f+1),disabled:f>=Math.ceil(m/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(m/g)),disabled:f>=Math.ceil(m/g),className:"hidden sm:flex",children:e.jsx(ni,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(w2,{person:D,open:Y,onOpenChange:L}),e.jsx(_2,{person:D,open:z,onOpenChange:X,onSuccess:()=>{V(),q(),X(!1)}}),e.jsx(fs,{open:!!I,onOpenChange:()=>T(null),children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除人物信息 "',I?.person_name||I?.nickname||I?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>I&&ue(I),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(fs,{open:ge,onOpenChange:fe,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["确定要删除选中的 ",he.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:pe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function w2({person:n,open:i,onOpenChange:r}){if(!n)return null;const d=m=>m?new Date(m*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"人物详情"}),e.jsxs(Js,{children:["查看 ",n.person_name||n.nickname||n.user_id," 的完整信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ll,{icon:Xc,label:"人物名称",value:n.person_name}),e.jsx(ll,{icon:Rl,label:"昵称",value:n.nickname}),e.jsx(ll,{icon:si,label:"用户ID",value:n.user_id,mono:!0}),e.jsx(ll,{icon:si,label:"人物ID",value:n.person_id,mono:!0}),e.jsx(ll,{label:"平台",value:n.platform}),e.jsx(ll,{label:"状态",value:n.is_known?"已认识":"未认识"})]}),n.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:n.name_reason})]}),n.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:n.memory_points})]}),n.group_nick_name&&n.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:n.group_nick_name.map((m,x)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:m.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:m.group_nick_name})]},x))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(ll,{icon:Zn,label:"认识时间",value:d(n.know_times)}),e.jsx(ll,{icon:Zn,label:"首次记录",value:d(n.know_since)}),e.jsx(ll,{icon:Zn,label:"最后更新",value:d(n.last_know)})]})]}),e.jsx(et,{children:e.jsx(S,{onClick:()=>r(!1),children:"关闭"})})]})})}function ll({icon:n,label:i,value:r,mono:d=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n&&e.jsx(n,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:F("text-sm",d&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function _2({person:n,open:i,onOpenChange:r,onSuccess:d}){const[m,x]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=qs();u.useEffect(()=>{n&&x({person_name:n.person_name||"",name_reason:n.name_reason||"",nickname:n.nickname||"",memory_points:n.memory_points||"",is_known:n.is_known})},[n]);const b=async()=>{if(n)try{p(!0),await j2(n.person_id,m),g({title:"保存成功",description:"人物信息已更新"}),d()}catch(j){g({title:"保存失败",description:j instanceof Error?j.message:"无法更新人物信息",variant:"destructive"})}finally{p(!1)}};return n?e.jsx(Hs,{open:i,onOpenChange:r,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"编辑人物信息"}),e.jsxs(Js,{children:["修改 ",n.person_name||n.nickname||n.user_id," 的信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"person_name",children:"人物名称"}),e.jsx(re,{id:"person_name",value:m.person_name||"",onChange:j=>x({...m,person_name:j.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称"}),e.jsx(re,{id:"nickname",value:m.nickname||"",onChange:j=>x({...m,nickname:j.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(As,{id:"name_reason",value:m.name_reason||"",onChange:j=>x({...m,name_reason:j.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"memory_points",children:"个人印象"}),e.jsx(As,{id:"memory_points",value:m.memory_points||"",onChange:j=>x({...m,memory_points:j.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx(Qe,{id:"is_known",checked:m.is_known,onCheckedChange:j=>x({...m,is_known:j})})]})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(S,{onClick:b,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}var S2=t0();const yp=Kb(S2),tm="/api/webui";async function C2(n=100,i="all"){const r=`${tm}/knowledge/graph?limit=${n}&node_type=${i}`,d=await fetch(r);if(!d.ok)throw new Error(`获取知识图谱失败: ${d.status}`);return d.json()}async function k2(){const n=await fetch(`${tm}/knowledge/stats`);if(!n.ok)throw new Error("获取知识图谱统计信息失败");return n.json()}async function T2(n){const i=await fetch(`${tm}/knowledge/search?query=${encodeURIComponent(n)}`);if(!i.ok)throw new Error("搜索知识节点失败");return i.json()}const Pg=u.memo(({data:n})=>e.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[e.jsx(Kc,{type:"target",position:Jc.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:n.content,children:n.label}),e.jsx(Kc,{type:"source",position:Jc.Bottom})]}));Pg.displayName="EntityNode";const Zg=u.memo(({data:n})=>e.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[e.jsx(Kc,{type:"target",position:Jc.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:n.content,children:n.label}),e.jsx(Kc,{type:"source",position:Jc.Bottom})]}));Zg.displayName="ParagraphNode";const E2={entity:Pg,paragraph:Zg};function z2(n,i){const r=new yp.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const d=[],m=[];return n.forEach(x=>{r.setNode(x.id,{width:150,height:50})}),i.forEach(x=>{r.setEdge(x.source,x.target)}),yp.layout(r),n.forEach(x=>{const f=r.node(x.id);d.push({id:x.id,type:x.type,position:{x:f.x-75,y:f.y-25},data:{label:x.content.slice(0,20)+(x.content.length>20?"...":""),content:x.content}})}),i.forEach((x,f)=>{const p={id:`edge-${f}`,source:x.source,target:x.target,animated:n.length<=200&&x.weight>5,style:{strokeWidth:Math.min(x.weight/2,5),opacity:.6}};x.weight>10&&n.length<100&&(p.label=`${x.weight.toFixed(0)}`),m.push(p)}),{nodes:d,edges:m}}function M2(){const n=ba(),[i,r]=u.useState(!1),[d,m]=u.useState(null),[x,f]=u.useState(""),[p,g]=u.useState("all"),[b,j]=u.useState(50),[y,N]=u.useState("50"),[k,w]=u.useState(!1),[U,D]=u.useState(!0),[B,Y]=u.useState(!1),[L,z]=u.useState(!1),[X,I,T]=a0([]),[M,ae,he]=l0([]),[je,ge]=u.useState(0),[fe,be]=u.useState(null),[Te,O]=u.useState(null),{toast:V}=qs(),q=u.useCallback(pe=>pe.type==="entity"?"#6366f1":pe.type==="paragraph"?"#10b981":"#6b7280",[]),se=u.useCallback(async(pe=!1)=>{try{if(!pe&&b>200){z(!0);return}r(!0);const[ee,ie]=await Promise.all([C2(b,p),k2()]);if(m(ie),ee.nodes.length===0){V({title:"提示",description:"知识库为空,请先导入知识数据"}),I([]),ae([]);return}const{nodes:$,edges:Z}=z2(ee.nodes,ee.edges);I($),ae(Z),ge($.length),ie&&ie.total_nodes>b&&V({title:"提示",description:`知识图谱包含 ${ie.total_nodes} 个节点,当前显示 ${$.length} 个`}),V({title:"加载成功",description:`已加载 ${$.length} 个节点,${Z.length} 条边`})}catch(ee){console.error("加载知识图谱失败:",ee),V({title:"加载失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}finally{r(!1)}},[b,p,V]),R=u.useCallback(async()=>{if(!x.trim()){V({title:"提示",description:"请输入搜索关键词"});return}try{const pe=await T2(x);if(pe.length===0){V({title:"未找到",description:"没有找到匹配的节点"});return}const ee=new Set(pe.map(ie=>ie.id));I(ie=>ie.map($=>({...$,style:{...$.style,opacity:ee.has($.id)?1:.3,filter:ee.has($.id)?"brightness(1.2)":"brightness(0.8)"}}))),V({title:"搜索完成",description:`找到 ${pe.length} 个匹配节点`})}catch(pe){console.error("搜索失败:",pe),V({title:"搜索失败",description:pe instanceof Error?pe.message:"未知错误",variant:"destructive"})}},[x,V]),ue=u.useCallback(()=>{I(pe=>pe.map(ee=>({...ee,style:{...ee.style,opacity:1,filter:"brightness(1)"}})))},[]),xe=u.useCallback(()=>{D(!1),Y(!0),se()},[se]),ke=u.useCallback(()=>{z(!1),setTimeout(()=>{se(!0)},0)},[se]),we=u.useCallback((pe,ee)=>{X.find($=>$.id===ee.id)&&be({id:ee.id,type:ee.type,content:ee.data.content})},[X]);u.useEffect(()=>{U||B&&se()},[b,p,U,B]);const Me=u.useCallback((pe,ee)=>{const ie=X.find(Ee=>Ee.id===ee.source),$=X.find(Ee=>Ee.id===ee.target),Z=M.find(Ee=>Ee.id===ee.id);ie&&$&&Z&&O({source:{id:ie.id,type:ie.type,content:ie.data.content},target:{id:$.id,type:$.type,content:$.data.content},edge:{source:ee.source,target:ee.target,weight:parseFloat(ee.label||"0")}})},[X,M]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),d&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs($e,{variant:"outline",className:"gap-1",children:[e.jsx(Ic,{className:"h-3 w-3"}),"节点: ",d.total_nodes]}),e.jsxs($e,{variant:"outline",className:"gap-1",children:[e.jsx(yg,{className:"h-3 w-3"}),"边: ",d.total_edges]}),e.jsxs($e,{variant:"outline",className:"gap-1",children:[e.jsx(La,{className:"h-3 w-3"}),"实体: ",d.entity_nodes]}),e.jsxs($e,{variant:"outline",className:"gap-1",children:[e.jsx(Ca,{className:"h-3 w-3"}),"段落: ",d.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(re,{placeholder:"搜索节点内容...",value:x,onChange:pe=>f(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&R(),className:"flex-1"}),e.jsx(S,{onClick:R,size:"sm",children:e.jsx(At,{className:"h-4 w-4"})}),e.jsx(S,{onClick:ue,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Ue,{value:p,onValueChange:pe=>g(pe),children:[e.jsx(Oe,{className:"w-[120px]",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部节点"}),e.jsx(le,{value:"entity",children:"仅实体"}),e.jsx(le,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Ue,{value:b===1e4?"all":k?"custom":b.toString(),onValueChange:pe=>{pe==="custom"?(w(!0),N(b.toString())):pe==="all"?(w(!1),j(1e4)):(w(!1),j(Number(pe)))},children:[e.jsx(Oe,{className:"w-[120px]",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"50",children:"50 节点"}),e.jsx(le,{value:"100",children:"100 节点"}),e.jsx(le,{value:"200",children:"200 节点"}),e.jsx(le,{value:"500",children:"500 节点"}),e.jsx(le,{value:"1000",children:"1000 节点"}),e.jsx(le,{value:"all",children:"全部 (最多10000)"}),e.jsx(le,{value:"custom",children:"自定义..."})]})]}),k&&e.jsx(re,{type:"number",min:"50",value:y,onChange:pe=>N(pe.target.value),onBlur:()=>{const pe=parseInt(y);!isNaN(pe)&&pe>=50?j(pe):(N("50"),j(50))},onKeyDown:pe=>{if(pe.key==="Enter"){const ee=parseInt(y);!isNaN(ee)&&ee>=50?j(ee):(N("50"),j(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(S,{onClick:()=>se(),variant:"outline",size:"sm",disabled:i,children:e.jsx(Et,{className:F("h-4 w-4",i&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:i?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Et,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):X.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Ic,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),e.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):e.jsxs(n0,{nodes:X,edges:M,onNodesChange:T,onEdgesChange:he,onNodeClick:we,onEdgeClick:Me,nodeTypes:E2,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:je<=500,nodesDraggable:je<=1e3,attributionPosition:"bottom-left",children:[e.jsx(i0,{variant:r0.Dots,gap:12,size:1}),e.jsx(c0,{}),je<=500&&e.jsx(o0,{nodeColor:q,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(d0,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[e.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),e.jsx("span",{children:"实体节点"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),e.jsx("span",{children:"段落节点"})]}),je>200&&e.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[e.jsx("div",{className:"font-semibold",children:"性能模式"}),e.jsx("div",{children:"已禁用动画"}),je>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Hs,{open:!!fe,onOpenChange:pe=>!pe&&be(null),children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Rs,{children:e.jsx(Ls,{children:"节点详情"})}),fe&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),e.jsx("div",{className:"mt-1",children:e.jsx($e,{variant:fe.type==="entity"?"default":"secondary",children:fe.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),e.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:fe.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(Je,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:fe.content})})]})]})]})}),e.jsx(Hs,{open:!!Te,onOpenChange:pe=>!pe&&O(null),children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Rs,{children:e.jsx(Ls,{children:"边详情"})}),Te&&e.jsx(Je,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:Te.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Te.source.id.slice(0,40),"..."]})]}),e.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:Te.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Te.target.id.slice(0,40),"..."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),e.jsx("div",{className:"mt-1",children:e.jsx($e,{variant:"outline",className:"text-base font-mono",children:Te.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(fs,{open:U,onOpenChange:D,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"加载知识图谱"}),e.jsxs(os,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:()=>n({to:"/"}),children:"取消 (返回首页)"}),e.jsx(ds,{onClick:xe,children:"确认加载"})]})]})}),e.jsx(fs,{open:L,onOpenChange:z,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"⚠️ 节点数量较多"}),e.jsx(os,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["您正在尝试加载 ",e.jsx("strong",{className:"text-orange-600",children:b>=1e4?"全部 (最多10000个)":b})," 个节点。"]}),e.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),e.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[e.jsx("li",{children:"页面加载时间较长"}),e.jsx("li",{children:"浏览器卡顿或崩溃"}),e.jsx("li",{children:"系统资源占用过高"})]}),e.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:()=>{z(!1),b>200&&(j(50),w(!1))},children:"取消"}),e.jsx(ds,{onClick:ke,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function wp({className:n,classNames:i,showOutsideDays:r=!0,captionLayout:d="label",buttonVariant:m="ghost",formatters:x,components:f,...p}){const g=Tg();return e.jsx(By,{showOutsideDays:r,className:F("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,n),captionLayout:d,formatters:{formatMonthDropdown:b=>b.toLocaleString("default",{month:"short"}),...x},classNames:{root:F("w-fit",g.root),months:F("relative flex flex-col gap-4 md:flex-row",g.months),month:F("flex w-full flex-col gap-4",g.month),nav:F("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",g.nav),button_previous:F(xr({variant:m}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",g.button_previous),button_next:F(xr({variant:m}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",g.button_next),month_caption:F("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",g.month_caption),dropdowns:F("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",g.dropdowns),dropdown_root:F("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",g.dropdown_root),dropdown:F("bg-popover absolute inset-0 opacity-0",g.dropdown),caption_label:F("select-none font-medium",d==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",g.caption_label),table:"w-full border-collapse",weekdays:F("flex",g.weekdays),weekday:F("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",g.weekday),week:F("mt-2 flex w-full",g.week),week_number_header:F("w-[--cell-size] select-none",g.week_number_header),week_number:F("text-muted-foreground select-none text-[0.8rem]",g.week_number),day:F("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",g.day),range_start:F("bg-accent rounded-l-md",g.range_start),range_middle:F("rounded-none",g.range_middle),range_end:F("bg-accent rounded-r-md",g.range_end),today:F("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",g.today),outside:F("text-muted-foreground aria-selected:text-muted-foreground",g.outside),disabled:F("text-muted-foreground opacity-50",g.disabled),hidden:F("invisible",g.hidden),...i},components:{Root:({className:b,rootRef:j,...y})=>e.jsx("div",{"data-slot":"calendar",ref:j,className:F(b),...y}),Chevron:({className:b,orientation:j,...y})=>j==="left"?e.jsx(rl,{className:F("size-4",b),...y}):j==="right"?e.jsx(Ha,{className:F("size-4",b),...y}):e.jsx(Ll,{className:F("size-4",b),...y}),DayButton:A2,WeekNumber:({children:b,...j})=>e.jsx("td",{...j,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:b})}),...f},...p})}function A2({className:n,day:i,modifiers:r,...d}){const m=Tg(),x=u.useRef(null);return u.useEffect(()=>{r.focused&&x.current?.focus()},[r.focused]),e.jsx(S,{ref:x,variant:"ghost",size:"icon","data-day":i.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:F("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",m.day,n),...d})}const D2={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},O2=(n,i,r)=>{let d;const m=D2[n];return typeof m=="string"?d=m:i===1?d=m.one:d=m.other.replace("{{count}}",String(i)),r?.addSuffix?r.comparison&&r.comparison>0?d+"内":d+"前":d},R2={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},L2={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},U2={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},B2={date:bu({formats:R2,defaultWidth:"full"}),time:bu({formats:L2,defaultWidth:"full"}),dateTime:bu({formats:U2,defaultWidth:"full"})};function _p(n,i,r){const d="eeee p";return Zb(n,i,r)?d:n.getTime()>i.getTime()?"'下个'"+d:"'上个'"+d}const H2={lastWeek:_p,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:_p,other:"PP p"},q2=(n,i,r,d)=>{const m=H2[n];return typeof m=="function"?m(i,r,d):m},G2={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},F2={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},V2={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},$2={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},Q2={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},I2={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},Y2=(n,i)=>{const r=Number(n);switch(i?.unit){case"date":return r.toString()+"日";case"hour":return r.toString()+"时";case"minute":return r.toString()+"分";case"second":return r.toString()+"秒";default:return"第 "+r.toString()}},X2={ordinalNumber:Y2,era:Zi({values:G2,defaultWidth:"wide"}),quarter:Zi({values:F2,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Zi({values:V2,defaultWidth:"wide"}),day:Zi({values:$2,defaultWidth:"wide"}),dayPeriod:Zi({values:Q2,defaultWidth:"wide",formattingValues:I2,defaultFormattingWidth:"wide"})},K2=/^(第\s*)?\d+(日|时|分|秒)?/i,J2=/\d+/i,P2={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},Z2={any:[/^(前)/i,/^(公元)/i]},W2={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},e_={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},s_={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},t_={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},a_={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},l_={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},n_={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},i_={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},r_={ordinalNumber:Wb({matchPattern:K2,parsePattern:J2,valueCallback:n=>parseInt(n,10)}),era:Wi({matchPatterns:P2,defaultMatchWidth:"wide",parsePatterns:Z2,defaultParseWidth:"any"}),quarter:Wi({matchPatterns:W2,defaultMatchWidth:"wide",parsePatterns:e_,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Wi({matchPatterns:s_,defaultMatchWidth:"wide",parsePatterns:t_,defaultParseWidth:"any"}),day:Wi({matchPatterns:a_,defaultMatchWidth:"wide",parsePatterns:l_,defaultParseWidth:"any"}),dayPeriod:Wi({matchPatterns:n_,defaultMatchWidth:"any",parsePatterns:i_,defaultParseWidth:"any"})},Bc={code:"zh-CN",formatDistance:O2,formatLong:B2,formatRelative:q2,localize:X2,match:r_,options:{weekStartsOn:1,firstWeekContainsDate:4}},Hc={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function c_(){const[n,i]=u.useState([]),[r,d]=u.useState(""),[m,x]=u.useState("all"),[f,p]=u.useState("all"),[g,b]=u.useState(void 0),[j,y]=u.useState(void 0),[N,k]=u.useState(!0),[w,U]=u.useState(!1),[D,B]=u.useState("xs"),[Y,L]=u.useState(4),z=u.useRef(null);u.useEffect(()=>{const q=tn.getAllLogs();i(q);const se=tn.onLog(()=>{i(tn.getAllLogs())}),R=tn.onConnectionChange(ue=>{U(ue)});return()=>{se(),R()}},[]);const X=u.useMemo(()=>{const q=new Set(n.map(se=>se.module).filter(se=>se&&se.trim()!==""));return Array.from(q).sort()},[n]),I=q=>{switch(q){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},T=q=>{switch(q){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},M=()=>{window.location.reload()},ae=()=>{tn.clearLogs(),i([])},he=()=>{const q=fe.map(xe=>`${xe.timestamp} [${xe.level.padEnd(8)}] [${xe.module}] ${xe.message}`).join(` -`),se=new Blob([q],{type:"text/plain;charset=utf-8"}),R=URL.createObjectURL(se),ue=document.createElement("a");ue.href=R,ue.download=`logs-${Nu(new Date,"yyyy-MM-dd-HHmmss")}.txt`,ue.click(),URL.revokeObjectURL(R)},je=()=>{k(!N)},ge=()=>{b(void 0),y(void 0)},fe=u.useMemo(()=>n.filter(q=>{const se=r===""||q.message.toLowerCase().includes(r.toLowerCase())||q.module.toLowerCase().includes(r.toLowerCase()),R=m==="all"||q.level===m,ue=f==="all"||q.module===f;let xe=!0;if(g||j){const ke=new Date(q.timestamp);if(g){const we=new Date(g);we.setHours(0,0,0,0),xe=xe&&ke>=we}if(j){const we=new Date(j);we.setHours(23,59,59,999),xe=xe&&ke<=we}}return se&&R&&ue&&xe}),[n,r,m,f,g,j]),be=Hc[D].rowHeight+Y,Te=Gb({count:fe.length,getScrollElement:()=>z.current,estimateSize:()=>be,overscan:50}),O=u.useRef(!1),V=u.useRef(fe.length);return u.useEffect(()=>{const q=z.current;if(!q)return;const se=()=>{if(O.current)return;const{scrollTop:R,scrollHeight:ue,clientHeight:xe}=q,ke=ue-R-xe;ke>100&&N?k(!1):ke<50&&!N&&k(!0)};return q.addEventListener("scroll",se,{passive:!0}),()=>q.removeEventListener("scroll",se)},[N]),u.useEffect(()=>{const q=fe.length>V.current;V.current=fe.length,N&&fe.length>0&&q&&(O.current=!0,Te.scrollToIndex(fe.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{O.current=!1})}))},[fe.length,N,Te]),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:F("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",w?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:w?"已连接":"未连接"})]})]}),e.jsx(Fe,{className:"p-3 sm:p-4",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索日志...",value:r,onChange:q=>d(q.target.value),className:"pl-9 h-9 text-sm"})]}),e.jsxs(Ue,{value:m,onValueChange:x,children:[e.jsxs(Oe,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[e.jsx(Uu,{className:"h-4 w-4 mr-2"}),e.jsx(Be,{placeholder:"级别"})]}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部级别"}),e.jsx(le,{value:"DEBUG",children:"DEBUG"}),e.jsx(le,{value:"INFO",children:"INFO"}),e.jsx(le,{value:"WARNING",children:"WARNING"}),e.jsx(le,{value:"ERROR",children:"ERROR"}),e.jsx(le,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Ue,{value:f,onValueChange:p,children:[e.jsxs(Oe,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[e.jsx(Uu,{className:"h-4 w-4 mr-2"}),e.jsx(Be,{placeholder:"模块"})]}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部模块"}),X.map(q=>e.jsx(le,{value:q,children:q},q))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[e.jsxs(Ua,{children:[e.jsx(Ba,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:F("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!g&&"text-muted-foreground"),children:[e.jsx(ep,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:g?Nu(g,"PPP",{locale:Bc}):"开始日期"})]})}),e.jsx(Ta,{className:"w-auto p-0",align:"start",children:e.jsx(wp,{mode:"single",selected:g,onSelect:b,initialFocus:!0,locale:Bc})})]}),e.jsxs(Ua,{children:[e.jsx(Ba,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:F("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!j&&"text-muted-foreground"),children:[e.jsx(ep,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:j?Nu(j,"PPP",{locale:Bc}):"结束日期"})]})}),e.jsx(Ta,{className:"w-auto p-0",align:"start",children:e.jsx(wp,{mode:"single",selected:j,onSelect:y,initialFocus:!0,locale:Bc})})]}),(g||j)&&e.jsxs(S,{variant:"outline",size:"sm",onClick:ge,className:"w-full sm:w-auto h-9",children:[e.jsx(il,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),e.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(S,{variant:N?"default":"outline",size:"sm",onClick:je,className:"flex-1 sm:flex-none h-9",children:[N?e.jsx(gy,{className:"h-4 w-4"}):e.jsx(jy,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:N?"自动滚动":"已暂停"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:M,className:"flex-1 sm:flex-none h-9",children:[e.jsx(Et,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:ae,className:"flex-1 sm:flex-none h-9",children:[e.jsx(We,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:he,className:"flex-1 sm:flex-none h-9",children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),e.jsx("div",{className:"flex-1 hidden sm:block"}),e.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[e.jsxs("span",{className:"font-mono",children:[fe.length," / ",n.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(vy,{className:"h-4 w-4"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Hc).map(q=>e.jsx(S,{variant:D===q?"default":"outline",size:"sm",onClick:()=>B(q),className:"h-7 px-3 text-xs",children:Hc[q].label},q))})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[e.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),e.jsx(ga,{value:[Y],onValueChange:([q])=>L(q),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[Y,"px"]})]})]})]})})]}),e.jsx("div",{className:"flex-1 min-h-0 px-3 sm:px-4 lg:px-6 pb-3 sm:pb-4 lg:pb-6",children:e.jsx(Fe,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:z,className:F("h-full overflow-auto","[&::-webkit-scrollbar]:w-2.5","[&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb:hover]:bg-border/80"),children:e.jsx("div",{className:F("p-2 sm:p-3 font-mono relative",Hc[D].class),style:{height:`${Te.getTotalSize()}px`},children:fe.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):Te.getVirtualItems().map(q=>{const se=fe[q.index];return e.jsxs("div",{"data-index":q.index,ref:Te.measureElement,className:F("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",T(se.level)),style:{transform:`translateY(${q.start}px)`,paddingTop:`${Y/2}px`,paddingBottom:`${Y/2}px`},children:[e.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:se.timestamp}),e.jsxs("span",{className:F("font-semibold",I(se.level)),children:["[",se.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:se.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:se.message})]}),e.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:se.timestamp}),e.jsxs("span",{className:F("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",I(se.level)),children:["[",se.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:se.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:se.message})]})]},q.key)})})})})})]})}const o_="Mai-with-u",d_="plugin-repo",u_="main",m_="plugin_details.json";async function x_(){try{const n=await _e("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:o_,repo:d_,branch:u_,file_path:m_})});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const i=await n.json();if(!i.success||!i.data)throw new Error(i.error||"获取插件列表失败");return JSON.parse(i.data).filter(m=>!m?.id||!m?.manifest?(console.warn("跳过无效插件数据:",m),!1):!m.manifest.name||!m.manifest.version?(console.warn("跳过缺少必需字段的插件:",m.id),!1):!0).map(m=>({id:m.id,manifest:{manifest_version:m.manifest.manifest_version||1,name:m.manifest.name,version:m.manifest.version,description:m.manifest.description||"",author:m.manifest.author||{name:"Unknown"},license:m.manifest.license||"Unknown",host_application:m.manifest.host_application||{min_version:"0.0.0"},homepage_url:m.manifest.homepage_url,repository_url:m.manifest.repository_url,keywords:m.manifest.keywords||[],categories:m.manifest.categories||[],default_locale:m.manifest.default_locale||"zh-CN",locales_path:m.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(n){throw console.error("Failed to fetch plugin list:",n),n}}async function h_(){try{const n=await _e("/api/webui/plugins/git-status");if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return await n.json()}catch(n){return console.error("Failed to check Git status:",n),{installed:!1,error:"无法检测 Git 安装状态"}}}async function f_(){try{const n=await _e("/api/webui/plugins/version");if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return await n.json()}catch(n){return console.error("Failed to get Maimai version:",n),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function p_(n,i,r){const d=n.split(".").map(p=>parseInt(p)||0),m=d[0]||0,x=d[1]||0,f=d[2]||0;if(r.version_majorparseInt(y)||0),g=p[0]||0,b=p[1]||0,j=p[2]||0;if(r.version_major>g||r.version_major===g&&r.version_minor>b||r.version_major===g&&r.version_minor===b&&r.version_patch>j)return!1}return!0}function g_(n,i){const r=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,m=new WebSocket(`${r}//${d}/api/webui/ws/plugin-progress`);return m.onopen=()=>{console.log("Plugin progress WebSocket connected");const x=setInterval(()=>{m.readyState===WebSocket.OPEN?m.send("ping"):clearInterval(x)},3e4)},m.onmessage=x=>{try{if(x.data==="pong")return;const f=JSON.parse(x.data);n(f)}catch(f){console.error("Failed to parse progress data:",f)}},m.onerror=x=>{console.error("Plugin progress WebSocket error:",x),i?.(x)},m.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},m}async function ir(){try{const n=await _e("/api/webui/plugins/installed",{headers:Ds()});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const i=await n.json();if(!i.success)throw new Error(i.message||"获取已安装插件列表失败");return i.plugins||[]}catch(n){return console.error("Failed to get installed plugins:",n),[]}}function qc(n,i){return i.some(r=>r.id===n)}function Gc(n,i){const r=i.find(d=>d.id===n);if(r)return r.manifest?.version||r.version}async function j_(n,i,r="main"){const d=await _e("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:n,repository_url:i,branch:r})});if(!d.ok){const m=await d.json();throw new Error(m.detail||"安装失败")}return await d.json()}async function v_(n){const i=await _e("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:n})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"卸载失败")}return await i.json()}async function b_(n,i,r="main"){const d=await _e("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:n,repository_url:i,branch:r})});if(!d.ok){const m=await d.json();throw new Error(m.detail||"更新失败")}return await d.json()}async function N_(n){const i=await _e(`/api/webui/plugins/config/${n}/schema`,{headers:Ds()});if(!i.ok){const d=await i.json();throw new Error(d.detail||"获取配置 Schema 失败")}const r=await i.json();if(!r.success)throw new Error(r.message||"获取配置 Schema 失败");return r.schema}async function y_(n){const i=await _e(`/api/webui/plugins/config/${n}`,{headers:Ds()});if(!i.ok){const d=await i.json();throw new Error(d.detail||"获取配置失败")}const r=await i.json();if(!r.success)throw new Error(r.message||"获取配置失败");return r.config}async function w_(n,i){const r=await _e(`/api/webui/plugins/config/${n}`,{method:"PUT",body:JSON.stringify({config:i})});if(!r.ok){const d=await r.json();throw new Error(d.detail||"保存配置失败")}return await r.json()}async function __(n){const i=await _e(`/api/webui/plugins/config/${n}/reset`,{method:"POST",headers:Ds()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"重置配置失败")}return await i.json()}async function S_(n){const i=await _e(`/api/webui/plugins/config/${n}/toggle`,{method:"POST",headers:Ds()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"切换状态失败")}return await i.json()}const vr="https://maibot-plugin-stats.maibot-webui.workers.dev";async function Wg(n){try{const i=await fetch(`${vr}/stats/${n}`);return i.ok?await i.json():(console.error("Failed to fetch plugin stats:",i.statusText),null)}catch(i){return console.error("Error fetching plugin stats:",i),null}}async function C_(n,i){try{const r=i||am(),d=await fetch(`${vr}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n,user_id:r})}),m=await d.json();return d.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:d.ok?{success:!0,...m}:{success:!1,error:m.error||"点赞失败"}}catch(r){return console.error("Error liking plugin:",r),{success:!1,error:"网络错误"}}}async function k_(n,i){try{const r=i||am(),d=await fetch(`${vr}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n,user_id:r})}),m=await d.json();return d.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:d.ok?{success:!0,...m}:{success:!1,error:m.error||"点踩失败"}}catch(r){return console.error("Error disliking plugin:",r),{success:!1,error:"网络错误"}}}async function T_(n,i,r,d){if(i<1||i>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const m=d||am(),x=await fetch(`${vr}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n,rating:i,comment:r,user_id:m})}),f=await x.json();return x.status===429?{success:!1,error:"每天最多评分 3 次"}:x.ok?{success:!0,...f}:{success:!1,error:f.error||"评分失败"}}catch(m){return console.error("Error rating plugin:",m),{success:!1,error:"网络错误"}}}async function E_(n){try{const i=await fetch(`${vr}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:n})}),r=await i.json();return i.status===429?(console.warn("Download recording rate limited"),{success:!0}):i.ok?{success:!0,...r}:(console.error("Failed to record download:",r.error),{success:!1,error:r.error})}catch(i){return console.error("Error recording download:",i),{success:!1,error:"网络错误"}}}function z_(){const n=navigator,i=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,n.deviceMemory||0].join("|");let r=0;for(let d=0;d{x(!0);const B=await Wg(n);B&&d(B),x(!1)};u.useEffect(()=>{k()},[n]);const w=async()=>{const B=await C_(n);B.success?(N({title:"已点赞",description:"感谢你的支持!"}),k()):N({title:"点赞失败",description:B.error||"未知错误",variant:"destructive"})},U=async()=>{const B=await k_(n);B.success?(N({title:"已反馈",description:"感谢你的反馈!"}),k()):N({title:"操作失败",description:B.error||"未知错误",variant:"destructive"})},D=async()=>{if(f===0){N({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const B=await T_(n,f,g||void 0);B.success?(N({title:"评分成功",description:"感谢你的评价!"}),y(!1),p(0),b(""),k()):N({title:"评分失败",description:B.error||"未知错误",variant:"destructive"})};return m?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nl,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):r?i?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${r.downloads.toLocaleString()}`,children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsx("span",{children:r.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${r.rating.toFixed(1)} (${r.rating_count} 条评价)`,children:[e.jsx(nl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:r.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${r.likes}`,children:[e.jsx(wu,{className:"h-4 w-4"}),e.jsx("span",{children:r.likes})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Ra,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.downloads.toLocaleString()}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(nl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:r.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.rating_count," 条评价"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(wu,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.likes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(sp,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.dislikes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:w,children:[e.jsx(wu,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:U,children:[e.jsx(sp,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Hs,{open:j,onOpenChange:y,children:[e.jsx(Zu,{asChild:!0,children:e.jsxs(S,{variant:"default",size:"sm",children:[e.jsx(nl,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Os,{children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"为插件评分"}),e.jsx(Js,{children:"分享你的使用体验,帮助其他用户"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(B=>e.jsx("button",{onClick:()=>p(B),className:"focus:outline-none",children:e.jsx(nl,{className:`h-8 w-8 transition-colors ${B<=f?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},B))}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[f===0&&"点击星星进行评分",f===1&&"很差",f===2&&"一般",f===3&&"还行",f===4&&"不错",f===5&&"非常好"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),e.jsx(As,{value:g,onChange:B=>b(B.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[g.length," / 500"]})]})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>y(!1),children:"取消"}),e.jsx(S,{onClick:D,disabled:f===0,children:"提交评分"})]})]})]})]}),r.recent_ratings&&r.recent_ratings.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),e.jsx("div",{className:"space-y-3",children:r.recent_ratings.map((B,Y)=>e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(L=>e.jsx(nl,{className:`h-3 w-3 ${L<=B.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},L))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(B.created_at).toLocaleDateString()})]}),B.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:B.comment})]},Y))})]})]}):null}const Sp={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function A_(){const n=ba(),[i,r]=u.useState(null),[d,m]=u.useState(""),[x,f]=u.useState("all"),[p,g]=u.useState("all"),[b,j]=u.useState(!0),[y,N]=u.useState([]),[k,w]=u.useState(!0),[U,D]=u.useState(null),[B,Y]=u.useState(null),[L,z]=u.useState(null),[X,I]=u.useState(null),[,T]=u.useState([]),[M,ae]=u.useState({}),[he,je]=u.useState(!1),[ge,fe]=u.useState(null),[be,Te]=u.useState("main"),[O,V]=u.useState(""),[q,se]=u.useState("preset"),[R,ue]=u.useState(!1),{toast:xe}=qs(),ke=async E=>{const me=E.map(async J=>{try{const Ne=await Wg(J.id);return{id:J.id,stats:Ne}}catch(Ne){return console.warn(`Failed to load stats for ${J.id}:`,Ne),{id:J.id,stats:null}}}),Ie=await Promise.all(me),Se={};Ie.forEach(({id:J,stats:Ne})=>{Ne&&(Se[J]=Ne)}),ae(Se)};u.useEffect(()=>{let E=null,me=!1;return(async()=>{if(E=g_(Se=>{me||(z(Se),Se.stage==="success"?setTimeout(()=>{me||z(null)},2e3):Se.stage==="error"&&(w(!1),D(Se.error||"加载失败")))},Se=>{console.error("WebSocket error:",Se),me||xe({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(Se=>{if(!E){Se();return}const J=()=>{E&&E.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),Se()):E&&E.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),Se()):setTimeout(J,100)};J()}),!me){const Se=await h_();Y(Se),Se.installed||xe({title:"Git 未安装",description:Se.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!me){const Se=await f_();I(Se)}if(!me)try{w(!0),D(null);const Se=await x_();if(!me){const J=await ir();T(J);const Ne=Se.map(Ce=>{const Gs=qc(Ce.id,J),ws=Gc(Ce.id,J);return{...Ce,installed:Gs,installed_version:ws}});for(const Ce of J)!Ne.some(ws=>ws.id===Ce.id)&&Ce.manifest&&Ne.push({id:Ce.id,manifest:{manifest_version:Ce.manifest.manifest_version||1,name:Ce.manifest.name,version:Ce.manifest.version,description:Ce.manifest.description||"",author:Ce.manifest.author,license:Ce.manifest.license||"Unknown",host_application:Ce.manifest.host_application,homepage_url:Ce.manifest.homepage_url,repository_url:Ce.manifest.repository_url,keywords:Ce.manifest.keywords||[],categories:Ce.manifest.categories||[],default_locale:Ce.manifest.default_locale||"zh-CN",locales_path:Ce.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Ce.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});N(Ne),ke(Ne)}}catch(Se){if(!me){const J=Se instanceof Error?Se.message:"加载插件列表失败";D(J),xe({title:"加载失败",description:J,variant:"destructive"})}}finally{me||w(!1)}})(),()=>{me=!0,E&&E.close()}},[xe]);const we=E=>{if(!E.installed&&X&&!Me(E))return e.jsxs($e,{variant:"destructive",className:"gap-1",children:[e.jsx(Mt,{className:"h-3 w-3"}),"不兼容"]});if(E.installed){const me=E.installed_version?.trim(),Ie=E.manifest.version?.trim();if(me!==Ie){const Se=me?.split(".").map(Number)||[0,0,0],J=Ie?.split(".").map(Number)||[0,0,0];for(let Ne=0;Ne<3;Ne++){if((J[Ne]||0)>(Se[Ne]||0))return e.jsxs($e,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(Mt,{className:"h-3 w-3"}),"可更新"]});if((J[Ne]||0)<(Se[Ne]||0))break}}return e.jsxs($e,{variant:"default",className:"gap-1",children:[e.jsx(aa,{className:"h-3 w-3"}),"已安装"]})}return null},Me=E=>!X||!E.manifest?.host_application?!0:p_(E.manifest.host_application.min_version,E.manifest.host_application.max_version,X),pe=E=>{if(!E.installed||!E.installed_version||!E.manifest?.version)return!1;const me=E.installed_version.trim(),Ie=E.manifest.version.trim();if(me===Ie)return!1;const Se=me.split(".").map(Number),J=Ie.split(".").map(Number);for(let Ne=0;Ne<3;Ne++){if((J[Ne]||0)>(Se[Ne]||0))return!0;if((J[Ne]||0)<(Se[Ne]||0))return!1}return!1},ee=y.filter(E=>{if(!E.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",E.id),!1;const me=d===""||E.manifest.name?.toLowerCase().includes(d.toLowerCase())||E.manifest.description?.toLowerCase().includes(d.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(Ne=>Ne.toLowerCase().includes(d.toLowerCase())),Ie=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x);let Se=!0;p==="installed"?Se=E.installed===!0:p==="updates"&&(Se=E.installed===!0&&pe(E));const J=!b||!X||Me(E);return me&&Ie&&Se&&J}),ie=()=>{r(null)},$=E=>{if(!B?.installed){xe({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(X&&!Me(E)){xe({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}fe(E),Te("main"),V(""),se("preset"),ue(!1),je(!0)},Z=async()=>{if(!ge)return;const E=q==="custom"?O:be;if(!E||E.trim()===""){xe({title:"分支名称不能为空",variant:"destructive"});return}try{je(!1),await j_(ge.id,ge.manifest.repository_url||"",E),E_(ge.id).catch(Ie=>{console.warn("Failed to record download:",Ie)}),xe({title:"安装成功",description:`${ge.manifest.name} 已成功安装`});const me=await ir();T(me),N(Ie=>Ie.map(Se=>{if(Se.id===ge.id){const J=qc(Se.id,me),Ne=Gc(Se.id,me);return{...Se,installed:J,installed_version:Ne}}return Se}))}catch(me){xe({title:"安装失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}finally{fe(null)}},Ee=async E=>{try{await v_(E.id),xe({title:"卸载成功",description:`${E.manifest.name} 已成功卸载`});const me=await ir();T(me),N(Ie=>Ie.map(Se=>{if(Se.id===E.id){const J=qc(Se.id,me),Ne=Gc(Se.id,me);return{...Se,installed:J,installed_version:Ne}}return Se}))}catch(me){xe({title:"卸载失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},qe=async E=>{if(!B?.installed){xe({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const me=await b_(E.id,E.manifest.repository_url||"","main");xe({title:"更新成功",description:`${E.manifest.name} 已从 ${me.old_version} 更新到 ${me.new_version}`});const Ie=await ir();T(Ie),N(Se=>Se.map(J=>{if(J.id===E.id){const Ne=qc(J.id,Ie),Ce=Gc(J.id,Ie);return{...J,installed:Ne,installed_version:Ce}}return J}))}catch(me){xe({title:"更新失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}};return e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs(S,{onClick:()=>n({to:"/plugin-mirrors"}),children:[e.jsx(by,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),B&&!B.installed&&e.jsxs(Fe,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(ts,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ka,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(as,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(Zs,{className:"text-orange-800 dark:text-orange-200",children:B.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(hs,{children:e.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",e.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),e.jsx(Fe,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索插件...",value:d,onChange:E=>m(E.target.value),className:"pl-9"})]}),e.jsxs(Ue,{value:x,onValueChange:f,children:[e.jsx(Oe,{className:"w-full sm:w-[200px]",children:e.jsx(Be,{placeholder:"选择分类"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部分类"}),e.jsx(le,{value:"Group Management",children:"群组管理"}),e.jsx(le,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(le,{value:"Utility Tools",children:"实用工具"}),e.jsx(le,{value:"Content Generation",children:"内容生成"}),e.jsx(le,{value:"Multimedia",children:"多媒体"}),e.jsx(le,{value:"External Integration",children:"外部集成"}),e.jsx(le,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(le,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(dt,{id:"compatible-only",checked:b,onCheckedChange:E=>j(E===!0)}),e.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),e.jsx(ja,{value:p,onValueChange:g,className:"w-full",children:e.jsxs(la,{className:"grid w-full grid-cols-3",children:[e.jsxs(ss,{value:"all",children:["全部插件 (",y.filter(E=>{if(!E.manifest)return!1;const me=d===""||E.manifest.name?.toLowerCase().includes(d.toLowerCase())||E.manifest.description?.toLowerCase().includes(d.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(J=>J.toLowerCase().includes(d.toLowerCase())),Ie=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),Se=!b||!X||Me(E);return me&&Ie&&Se}).length,")"]}),e.jsxs(ss,{value:"installed",children:["已安装 (",y.filter(E=>{if(!E.manifest)return!1;const me=d===""||E.manifest.name?.toLowerCase().includes(d.toLowerCase())||E.manifest.description?.toLowerCase().includes(d.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(J=>J.toLowerCase().includes(d.toLowerCase())),Ie=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),Se=!b||!X||Me(E);return E.installed&&me&&Ie&&Se}).length,")"]}),e.jsxs(ss,{value:"updates",children:["可更新 (",y.filter(E=>{if(!E.manifest)return!1;const me=d===""||E.manifest.name?.toLowerCase().includes(d.toLowerCase())||E.manifest.description?.toLowerCase().includes(d.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(J=>J.toLowerCase().includes(d.toLowerCase())),Ie=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),Se=!b||!X||Me(E);return E.installed&&pe(E)&&me&&Ie&&Se}).length,")"]})]})}),L&&L.stage==="loading"&&e.jsx(Fe,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ws,{className:"h-4 w-4 animate-spin"}),e.jsxs("span",{className:"text-sm font-medium",children:[L.operation==="fetch"&&"加载插件列表",L.operation==="install"&&`安装插件${L.plugin_id?`: ${L.plugin_id}`:""}`,L.operation==="uninstall"&&`卸载插件${L.plugin_id?`: ${L.plugin_id}`:""}`,L.operation==="update"&&`更新插件${L.plugin_id?`: ${L.plugin_id}`:""}`]})]}),e.jsxs("span",{className:"text-sm font-medium",children:[L.progress,"%"]})]}),e.jsx(ii,{value:L.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:L.message}),L.operation==="fetch"&&L.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",L.loaded_plugins," / ",L.total_plugins," 个插件"]})]})}),L&&L.stage==="error"&&L.error&&e.jsx(Fe,{className:"border-destructive bg-destructive/10",children:e.jsx(ts,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ka,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(as,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(Zs,{className:"text-destructive/80",children:L.error})]})]})})}),k?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Ws,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):U?e.jsx(Fe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(ka,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:U}),e.jsx(S,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):ee.length===0?e.jsx(Fe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(At,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d||x!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:ee.map(E=>e.jsxs(Fe,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(ts,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(as,{className:"text-xl",children:E.manifest?.name||E.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[E.manifest?.categories&&E.manifest.categories[0]&&e.jsx($e,{variant:"secondary",className:"text-xs whitespace-nowrap",children:Sp[E.manifest.categories[0]]||E.manifest.categories[0]}),we(E)]})]}),e.jsx(Zs,{className:"line-clamp-2",children:E.manifest?.description||"无描述"})]}),e.jsx(hs,{className:"flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsx("span",{children:(M[E.id]?.downloads??E.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(M[E.id]?.rating??E.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[E.manifest?.keywords&&E.manifest.keywords.slice(0,3).map(me=>e.jsx($e,{variant:"outline",className:"text-xs",children:me},me)),E.manifest?.keywords&&E.manifest.keywords.length>3&&e.jsxs($e,{variant:"outline",className:"text-xs",children:["+",E.manifest.keywords.length-3]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[e.jsxs("div",{children:["v",E.manifest?.version||"unknown"," · ",E.manifest?.author?.name||"Unknown"]}),E.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[E.manifest.host_application.min_version,E.manifest.host_application.max_version?` - ${E.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(Eg,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>r(E),children:"查看详情"}),E.installed?pe(E)?e.jsxs(S,{size:"sm",disabled:!B?.installed,title:B?.installed?void 0:"Git 未安装",onClick:()=>qe(E),children:[e.jsx(Et,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(S,{variant:"destructive",size:"sm",disabled:!B?.installed,title:B?.installed?void 0:"Git 未安装",onClick:()=>Ee(E),children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(S,{size:"sm",disabled:!B?.installed||L?.operation==="install"||X!==null&&!Me(E),title:B?.installed?X!==null&&!Me(E)?`不兼容当前版本 (需要 ${E.manifest?.host_application?.min_version||"未知"}${E.manifest?.host_application?.max_version?` - ${E.manifest.host_application.max_version}`:"+"},当前 ${X?.version})`:void 0:"Git 未安装",onClick:()=>$(E),children:[e.jsx(Ra,{className:"h-4 w-4 mr-1"}),L?.operation==="install"&&L?.plugin_id===E.id?"安装中...":"安装"]})]})})]},E.id))}),e.jsx(Hs,{open:i!==null,onOpenChange:ie,children:i&&i.manifest&&e.jsx(Os,{className:"max-w-2xl max-h-[80vh] p-0 flex flex-col",children:e.jsx(Je,{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-6",children:[e.jsx(Rs,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(Ls,{className:"text-2xl",children:i.manifest.name}),e.jsxs(Js,{children:["作者: ",i.manifest.author?.name||"Unknown",i.manifest.author?.url&&e.jsx("a",{href:i.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:e.jsx(Fc,{className:"h-3 w-3 inline"})})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[i.manifest.categories&&i.manifest.categories[0]&&e.jsx($e,{variant:"secondary",children:Sp[i.manifest.categories[0]]||i.manifest.categories[0]}),we(i)]})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(M_,{pluginId:i.id}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"版本"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",i.manifest?.version||"unknown"]}),i.installed&&i.installed_version&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",i.installed_version]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"下载量"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:(M[i.id]?.downloads??i.downloads??0).toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"评分"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(M[i.id]?.rating??i.rating??0).toFixed(1)," (",M[i.id]?.rating_count??i.review_count??0,")"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"许可证"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.manifest.license||"Unknown"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.manifest.host_application?.min_version||"未知",i.manifest.host_application?.max_version?` - ${i.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.manifest.keywords&&i.manifest.keywords.map(E=>e.jsx($e,{variant:"outline",children:E},E))})]}),i.detailed_description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:i.detailed_description})]}),!i.detailed_description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.manifest.description||"无描述"})]}),e.jsxs("div",{className:"space-y-2",children:[i.manifest.homepage_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"主页: "}),e.jsx("a",{href:i.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i.manifest.homepage_url})]}),i.manifest.repository_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"仓库: "}),e.jsx("a",{href:i.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i.manifest.repository_url})]})]})]}),e.jsxs(et,{children:[i.manifest.homepage_url&&e.jsxs(S,{onClick:()=>window.open(i.manifest.homepage_url,"_blank"),children:[e.jsx(Fc,{className:"h-4 w-4 mr-2"}),"访问主页"]}),i.manifest.repository_url&&e.jsxs(S,{variant:"outline",onClick:()=>window.open(i.manifest.repository_url,"_blank"),children:[e.jsx(Fc,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})})}),e.jsx(Hs,{open:he,onOpenChange:je,children:e.jsxs(Os,{children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"安装插件"}),e.jsxs(Js,{children:["安装 ",ge?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",ge?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof ge?.manifest.author=="string"?ge.manifest.author:ge?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(dt,{id:"advanced-options",checked:R,onCheckedChange:E=>ue(E)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),R&&e.jsx("div",{className:"space-y-4 p-4 border rounded-lg",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"分支选择"}),e.jsxs(ja,{value:q,onValueChange:E=>se(E),children:[e.jsxs(la,{className:"grid w-full grid-cols-2",children:[e.jsx(ss,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(ss,{value:"custom",className:"text-xs",children:"自定义分支"})]}),q==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Ue,{value:be,onValueChange:Te,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择分支"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"main",children:"main (默认)"}),e.jsx(le,{value:"master",children:"master"}),e.jsx(le,{value:"dev",children:"dev (开发版)"}),e.jsx(le,{value:"develop",children:"develop"}),e.jsx(le,{value:"beta",children:"beta (测试版)"}),e.jsx(le,{value:"stable",children:"stable (稳定版)"})]})]})}),q==="custom"&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("input",{type:"text",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"输入分支名称,例如: feature/new-feature",value:O,onChange:E=>V(E.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!R&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>je(!1),children:"取消"}),e.jsxs(S,{onClick:Z,children:[e.jsx(Ra,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})})]})})}function D_(){return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(wg,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(Je,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(Fe,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(ts,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Ol,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(as,{className:"text-2xl",children:"功能开发中"}),e.jsx(Zs,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(hs,{children:e.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground",children:"📦 即将推出的功能:"}),e.jsxs("ul",{className:"space-y-2 ml-6",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"浏览社区共享的模型分配预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"一键下载和应用预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"分享自己的模型分配方案"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"预设配置评分和评论系统"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"根据使用场景智能推荐配置"})]})]})]})})]})})})]})}const Vu=fN,$u=pN,Qu=gN;function O_({field:n,value:i,onChange:r}){const[d,m]=u.useState(!1);switch(n.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:n.label}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]}),e.jsx(Qe,{checked:!!i,onCheckedChange:r,disabled:n.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:n.label}),e.jsx(re,{type:"number",value:i??n.default,onChange:x=>r(parseFloat(x.target.value)||0),min:n.min,max:n.max,step:n.step??1,placeholder:n.placeholder,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:n.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:i??n.default})]}),e.jsx(ga,{value:[i??n.default],onValueChange:x=>r(x[0]),min:n.min??0,max:n.max??100,step:n.step??1,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:n.label}),e.jsxs(Ue,{value:String(i??n.default),onValueChange:r,disabled:n.disabled,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:n.placeholder??"请选择"})}),e.jsx(Re,{children:n.choices?.map(x=>e.jsx(le,{value:String(x),children:String(x)},String(x)))})]}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:n.label}),e.jsx(As,{value:i??n.default,onChange:x=>r(x.target.value),placeholder:n.placeholder,rows:n.rows??3,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:n.label}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{type:d?"text":"password",value:i??"",onChange:x=>r(x.target.value),placeholder:n.placeholder,disabled:n.disabled,className:"pr-10"}),e.jsx(S,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>m(!d),children:d?e.jsx(dr,{className:"h-4 w-4"}):e.jsx(Rt,{className:"h-4 w-4"})})]}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:n.label}),e.jsx(re,{type:"text",value:i??n.default??"",onChange:x=>r(x.target.value),placeholder:n.placeholder,maxLength:n.max_length,disabled:n.disabled}),n.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.hint})]})}}function Cp({section:n,config:i,onChange:r}){const[d,m]=u.useState(!n.collapsed),x=Object.entries(n.fields).filter(([,f])=>!f.hidden).sort(([,f],[,p])=>f.order-p.order);return e.jsx(Vu,{open:d,onOpenChange:m,children:e.jsxs(Fe,{children:[e.jsx($u,{asChild:!0,children:e.jsxs(ts,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[d?e.jsx(Ll,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Ha,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(as,{className:"text-lg",children:n.title})]}),e.jsxs($e,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),n.description&&e.jsx(Zs,{className:"ml-6",children:n.description})]})}),e.jsx(Qu,{children:e.jsx(hs,{className:"space-y-4 pt-0",children:x.map(([f,p])=>e.jsx(O_,{field:p,value:i[n.name]?.[f],onChange:g=>r(n.name,f,g),sectionName:n.name},f))})})]})})}function R_({plugin:n,onBack:i}){const{toast:r}=qs(),[d,m]=u.useState(null),[x,f]=u.useState({}),[p,g]=u.useState({}),[b,j]=u.useState(!0),[y,N]=u.useState(!1),[k,w]=u.useState(!1),[U,D]=u.useState(!1),B=u.useCallback(async()=>{j(!0);try{const[M,ae]=await Promise.all([N_(n.id),y_(n.id)]);m(M),f(ae),g(JSON.parse(JSON.stringify(ae)))}catch(M){r({title:"加载配置失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}finally{j(!1)}},[n.id,r]);u.useEffect(()=>{B()},[B]),u.useEffect(()=>{w(JSON.stringify(x)!==JSON.stringify(p))},[x,p]);const Y=(M,ae,he)=>{f(je=>({...je,[M]:{...je[M]||{},[ae]:he}}))},L=async()=>{N(!0);try{await w_(n.id,x),g(JSON.parse(JSON.stringify(x))),r({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(M){r({title:"保存失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}finally{N(!1)}},z=async()=>{try{await __(n.id),r({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),D(!1),B()}catch(M){r({title:"重置失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},X=async()=>{try{const M=await S_(n.id);r({title:M.message,description:M.note}),B()}catch(M){r({title:"切换状态失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}};if(b)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Ws,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!d)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(Mt,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(S,{onClick:i,variant:"outline",children:[e.jsx(ei,{className:"h-4 w-4 mr-2"}),"返回"]})]});const I=Object.values(d.sections).sort((M,ae)=>M.order-ae.order),T=x.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(S,{variant:"ghost",size:"icon",onClick:i,children:e.jsx(ei,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:d.plugin_info.name||n.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx($e,{variant:T?"default":"secondary",children:T?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",d.plugin_info.version||n.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:X,children:[e.jsx(gr,{className:"h-4 w-4 mr-2"}),T?"禁用":"启用"]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>D(!0),children:[e.jsx(Qc,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(S,{size:"sm",onClick:L,disabled:!k||y,children:[y?e.jsx(Ws,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(jr,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),k&&e.jsx(Fe,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(hs,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(La,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),d.layout.type==="tabs"&&d.layout.tabs.length>0?e.jsxs(ja,{defaultValue:d.layout.tabs[0]?.id,children:[e.jsx(la,{children:d.layout.tabs.map(M=>e.jsxs(ss,{value:M.id,children:[M.title,M.badge&&e.jsx($e,{variant:"secondary",className:"ml-2 text-xs",children:M.badge})]},M.id))}),d.layout.tabs.map(M=>e.jsx(ys,{value:M.id,className:"space-y-4 mt-4",children:M.sections.map(ae=>{const he=d.sections[ae];return he?e.jsx(Cp,{section:he,config:x,onChange:Y},ae):null})},M.id))]}):e.jsx("div",{className:"space-y-4",children:I.map(M=>e.jsx(Cp,{section:M,config:x,onChange:Y},M.name))}),e.jsx(Hs,{open:U,onOpenChange:D,children:e.jsxs(Os,{children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"确认重置配置"}),e.jsx(Js,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>D(!1),children:"取消"}),e.jsx(S,{variant:"destructive",onClick:z,children:"确认重置"})]})]})})]})}function L_(){const{toast:n}=qs(),[i,r]=u.useState([]),[d,m]=u.useState(!0),[x,f]=u.useState(""),[p,g]=u.useState(null),b=async()=>{m(!0);try{const k=await ir();r(k)}catch(k){n({title:"加载插件列表失败",description:k instanceof Error?k.message:"未知错误",variant:"destructive"})}finally{m(!1)}};u.useEffect(()=>{b()},[]);const j=i.filter(k=>{const w=x.toLowerCase();return k.id.toLowerCase().includes(w)||k.manifest.name.toLowerCase().includes(w)||k.manifest.description?.toLowerCase().includes(w)}),y=i.length,N=0;return p?e.jsx(Je,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(R_,{plugin:p,onBack:()=>g(null)})})}):e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),e.jsxs(S,{variant:"outline",size:"sm",onClick:b,children:[e.jsx(Et,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(Ol,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(hs,{children:[e.jsx("div",{className:"text-2xl font-bold",children:i.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d?"正在加载...":"个插件"})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"已启用"}),e.jsx(aa,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(hs,{children:[e.jsx("div",{className:"text-2xl font-bold",children:y}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(as,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(Mt,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(hs,{children:[e.jsx("div",{className:"text-2xl font-bold",children:N}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索插件...",value:x,onChange:k=>f(k.target.value),className:"pl-9"})]}),e.jsxs(Fe,{children:[e.jsxs(ts,{children:[e.jsx(as,{children:"已安装的插件"}),e.jsx(Zs,{children:"点击插件查看和编辑配置"})]}),e.jsx(hs,{children:d?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Ws,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(Ol,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:x?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:x?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:j.map(k=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>g(k),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(Ol,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:k.manifest.name}),e.jsxs($e,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",k.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:k.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(S,{variant:"ghost",size:"sm",children:e.jsx(ai,{className:"h-4 w-4"})}),e.jsx(Ha,{className:"h-4 w-4 text-muted-foreground"})]})]},k.id))})})]})]})})}function U_(){const n=ba(),{toast:i}=qs(),[r,d]=u.useState([]),[m,x]=u.useState(!0),[f,p]=u.useState(null),[g,b]=u.useState(null),[j,y]=u.useState(!1),[N,k]=u.useState(!1),[w,U]=u.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D=u.useCallback(async()=>{try{x(!0),p(null);const T=localStorage.getItem("access-token"),M=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${T}`}});if(!M.ok)throw new Error("获取镜像源列表失败");const ae=await M.json();d(ae.mirrors||[])}catch(T){const M=T instanceof Error?T.message:"加载镜像源失败";p(M),i({title:"加载失败",description:M,variant:"destructive"})}finally{x(!1)}},[i]);u.useEffect(()=>{D()},[D]);const B=async()=>{try{const T=localStorage.getItem("access-token"),M=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${T}`,"Content-Type":"application/json"},body:JSON.stringify(w)});if(!M.ok){const ae=await M.json();throw new Error(ae.detail||"添加镜像源失败")}i({title:"添加成功",description:"镜像源已添加"}),y(!1),U({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D()}catch(T){i({title:"添加失败",description:T instanceof Error?T.message:"未知错误",variant:"destructive"})}},Y=async()=>{if(g)try{const T=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${g.id}`,{method:"PUT",headers:{Authorization:`Bearer ${T}`,"Content-Type":"application/json"},body:JSON.stringify({name:w.name,raw_prefix:w.raw_prefix,clone_prefix:w.clone_prefix,enabled:w.enabled,priority:w.priority})})).ok)throw new Error("更新镜像源失败");i({title:"更新成功",description:"镜像源已更新"}),k(!1),b(null),D()}catch(T){i({title:"更新失败",description:T instanceof Error?T.message:"未知错误",variant:"destructive"})}},L=async T=>{if(confirm("确定要删除这个镜像源吗?"))try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${T}`,{method:"DELETE",headers:{Authorization:`Bearer ${M}`}})).ok)throw new Error("删除镜像源失败");i({title:"删除成功",description:"镜像源已删除"}),D()}catch(M){i({title:"删除失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},z=async T=>{try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${T.id}`,{method:"PUT",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!T.enabled})})).ok)throw new Error("更新状态失败");D()}catch(M){i({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},X=T=>{b(T),U({id:T.id,name:T.name,raw_prefix:T.raw_prefix,clone_prefix:T.clone_prefix,enabled:T.enabled,priority:T.priority}),k(!0)},I=async(T,M)=>{const ae=M==="up"?T.priority-1:T.priority+1;if(!(ae<1))try{const he=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${T.id}`,{method:"PUT",headers:{Authorization:`Bearer ${he}`,"Content-Type":"application/json"},body:JSON.stringify({priority:ae})})).ok)throw new Error("更新优先级失败");D()}catch(he){i({title:"更新失败",description:he instanceof Error?he.message:"未知错误",variant:"destructive"})}};return e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(S,{variant:"ghost",size:"icon",onClick:()=>n({to:"/plugins"}),children:e.jsx(ei,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),e.jsxs(S,{onClick:()=>y(!0),children:[e.jsx(ct,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),m?e.jsx(Fe,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ws,{className:"h-8 w-8 animate-spin text-primary"})})}):f?e.jsx(Fe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(ka,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:f}),e.jsx(S,{onClick:D,children:"重新加载"})]})}):e.jsxs(Fe,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(rn,{children:[e.jsx(cn,{children:e.jsxs(ot,{children:[e.jsx(Ke,{children:"状态"}),e.jsx(Ke,{children:"名称"}),e.jsx(Ke,{children:"ID"}),e.jsx(Ke,{children:"优先级"}),e.jsx(Ke,{className:"text-right",children:"操作"})]})}),e.jsx(on,{children:r.map(T=>e.jsxs(ot,{children:[e.jsx(Ve,{children:e.jsx(Qe,{checked:T.enabled,onCheckedChange:()=>z(T)})}),e.jsx(Ve,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:T.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",T.raw_prefix]})]})}),e.jsx(Ve,{children:e.jsx($e,{variant:"outline",children:T.id})}),e.jsx(Ve,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:T.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(S,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>I(T,"up"),disabled:T.priority===1,children:e.jsx(mr,{className:"h-3 w-3"})}),e.jsx(S,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>I(T,"down"),children:e.jsx(Ll,{className:"h-3 w-3"})})]})]})}),e.jsx(Ve,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(S,{variant:"ghost",size:"icon",onClick:()=>X(T),children:e.jsx(ln,{className:"h-4 w-4"})}),e.jsx(S,{variant:"ghost",size:"icon",onClick:()=>L(T.id),children:e.jsx(We,{className:"h-4 w-4 text-destructive"})})]})})]},T.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:r.map(T=>e.jsx(Fe,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:T.name}),T.enabled&&e.jsx($e,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx($e,{variant:"outline",className:"mt-1 text-xs",children:T.id})]}),e.jsx(Qe,{checked:T.enabled,onCheckedChange:()=>z(T)})]}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Raw: "}),e.jsx("span",{className:"break-all",children:T.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:T.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(S,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>X(T),children:[e.jsx(ln,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>I(T,"up"),disabled:T.priority===1,children:e.jsx(mr,{className:"h-4 w-4"})}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>I(T,"down"),children:e.jsx(Ll,{className:"h-4 w-4"})}),e.jsx(S,{variant:"destructive",size:"sm",onClick:()=>L(T.id),children:e.jsx(We,{className:"h-4 w-4"})})]})]})},T.id))})]}),e.jsx(Hs,{open:j,onOpenChange:y,children:e.jsxs(Os,{className:"max-w-lg",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"添加镜像源"}),e.jsx(Js,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(re,{id:"add-id",placeholder:"例如: my-mirror",value:w.id,onChange:T=>U({...w,id:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-name",children:"名称 *"}),e.jsx(re,{id:"add-name",placeholder:"例如: 我的镜像源",value:w.name,onChange:T=>U({...w,name:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(re,{id:"add-raw",placeholder:"https://example.com/raw",value:w.raw_prefix,onChange:T=>U({...w,raw_prefix:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(re,{id:"add-clone",placeholder:"https://example.com/clone",value:w.clone_prefix,onChange:T=>U({...w,clone_prefix:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-priority",children:"优先级"}),e.jsx(re,{id:"add-priority",type:"number",min:"1",value:w.priority,onChange:T=>U({...w,priority:parseInt(T.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"add-enabled",checked:w.enabled,onCheckedChange:T=>U({...w,enabled:T})}),e.jsx(C,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>y(!1),children:"取消"}),e.jsx(S,{onClick:B,children:"添加"})]})]})}),e.jsx(Hs,{open:N,onOpenChange:k,children:e.jsxs(Os,{className:"max-w-lg",children:[e.jsxs(Rs,{children:[e.jsx(Ls,{children:"编辑镜像源"}),e.jsx(Js,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"镜像源 ID"}),e.jsx(re,{value:w.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(re,{id:"edit-name",value:w.name,onChange:T=>U({...w,name:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(re,{id:"edit-raw",value:w.raw_prefix,onChange:T=>U({...w,raw_prefix:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(re,{id:"edit-clone",value:w.clone_prefix,onChange:T=>U({...w,clone_prefix:T.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(re,{id:"edit-priority",type:"number",min:"1",value:w.priority,onChange:T=>U({...w,priority:parseInt(T.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qe,{id:"edit-enabled",checked:w.enabled,onCheckedChange:T=>U({...w,enabled:T})}),e.jsx(C,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(et,{children:[e.jsx(S,{variant:"outline",onClick:()=>k(!1),children:"取消"}),e.jsx(S,{onClick:Y,children:"保存"})]})]})})]})})}const rr=u.forwardRef(({className:n,...i},r)=>e.jsx(Qp,{ref:r,className:F("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",n),...i}));rr.displayName=Qp.displayName;const B_=u.forwardRef(({className:n,...i},r)=>e.jsx(Ip,{ref:r,className:F("aspect-square h-full w-full",n),...i}));B_.displayName=Ip.displayName;const cr=u.forwardRef(({className:n,...i},r)=>e.jsx(Yp,{ref:r,className:F("flex h-full w-full items-center justify-center rounded-full bg-muted",n),...i}));cr.displayName=Yp.displayName;function H_(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function q_(){const n="maibot_webui_user_id";let i=localStorage.getItem(n);return i||(i=H_(),localStorage.setItem(n,i)),i}function G_(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function F_(n){localStorage.setItem("maibot_webui_user_name",n)}const ej="maibot_webui_virtual_tabs";function V_(){try{const n=localStorage.getItem(ej);if(n)return JSON.parse(n)}catch(n){console.error("[Chat] 加载虚拟标签页失败:",n)}return[]}function kp(n){try{localStorage.setItem(ej,JSON.stringify(n))}catch(i){console.error("[Chat] 保存虚拟标签页失败:",i)}}function $_(){const n={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},i=()=>{const Ge=V_().map(Ae=>{const Xe=Ae.virtualConfig;return!Xe.groupId&&Xe.platform&&Xe.userId&&(Xe.groupId=`webui_virtual_group_${Xe.platform}_${Xe.userId}`),{id:Ae.id,type:"virtual",label:Ae.label,virtualConfig:Xe,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[n,...Ge]},[r,d]=u.useState(i),[m,x]=u.useState("webui-default"),f=r.find(K=>K.id===m)||r[0],[p,g]=u.useState(""),[b,j]=u.useState(!1),[y,N]=u.useState(!0),[k,w]=u.useState(G_()),[U,D]=u.useState(!1),[B,Y]=u.useState(""),[L,z]=u.useState(!1),[X,I]=u.useState(!1),[T,M]=u.useState([]),[ae,he]=u.useState([]),[je,ge]=u.useState(!1),[fe,be]=u.useState(!1),[Te,O]=u.useState(""),[V,q]=u.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),se=u.useRef(q_()),R=u.useRef(new Map),ue=u.useRef(null),xe=u.useRef(new Map),ke=u.useRef(0),we=u.useRef(new Map),{toast:Me}=qs(),pe=K=>(ke.current+=1,`${K}-${Date.now()}-${ke.current}-${Math.random().toString(36).substr(2,9)}`),ee=u.useCallback((K,Ge)=>{d(Ae=>Ae.map(Xe=>Xe.id===K?{...Xe,...Ge}:Xe))},[]),ie=u.useCallback((K,Ge)=>{d(Ae=>Ae.map(Xe=>Xe.id===K?{...Xe,messages:[...Xe.messages,Ge]}:Xe))},[]),$=u.useCallback(()=>{ue.current?.scrollIntoView({behavior:"smooth"})},[]);u.useEffect(()=>{$()},[f?.messages,$]);const Z=u.useCallback(async()=>{ge(!0);try{const K=await _e("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",K.status,K.headers.get("content-type")),K.ok){const Ge=K.headers.get("content-type");if(Ge&&Ge.includes("application/json")){const Ae=await K.json();console.log("[Chat] 平台列表数据:",Ae),M(Ae.platforms||[])}else{const Ae=await K.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",Ae.substring(0,200)),Me({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",K.status),Me({title:"获取平台失败",description:`服务器返回错误: ${K.status}`,variant:"destructive"})}catch(K){console.error("[Chat] 获取平台列表失败:",K),Me({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{ge(!1)}},[Me]),Ee=u.useCallback(async(K,Ge)=>{be(!0);try{const Ae=new URLSearchParams;K&&Ae.append("platform",K),Ge&&Ae.append("search",Ge),Ae.append("limit","50");const Xe=await _e(`/api/chat/persons?${Ae.toString()}`);if(Xe.ok){const Vs=Xe.headers.get("content-type");if(Vs&&Vs.includes("application/json")){const Pe=await Xe.json();he(Pe.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(Ae){console.error("[Chat] 获取用户列表失败:",Ae)}finally{be(!1)}},[]);u.useEffect(()=>{V.platform&&Ee(V.platform,Te)},[V.platform,Te,Ee]);const qe=u.useCallback(async(K,Ge)=>{N(!0);try{const Ae=new URLSearchParams;Ae.append("user_id",se.current),Ae.append("limit","50"),Ge&&Ae.append("group_id",Ge);const Xe=`/api/chat/history?${Ae.toString()}`;console.log("[Chat] 正在加载历史消息:",Xe);const Vs=await _e(Xe);if(Vs.ok){const Pe=await Vs.text();try{const $s=JSON.parse(Pe);if($s.messages&&$s.messages.length>0){const ve=$s.messages.map(Le=>({id:Le.id,type:Le.type,content:Le.content,timestamp:Le.timestamp,sender:{name:Le.sender_name||(Le.is_bot?"麦麦":"WebUI用户"),user_id:Le.user_id,is_bot:Le.is_bot}}));ee(K,{messages:ve});const _s=we.current.get(K)||new Set;ve.forEach(Le=>{if(Le.type==="bot"){const Qs=`bot-${Le.content}-${Math.floor(Le.timestamp*1e3)}`;_s.add(Qs)}}),we.current.set(K,_s)}}catch($s){console.error("[Chat] JSON 解析失败:",$s)}}}catch(Ae){console.error("[Chat] 加载历史消息失败:",Ae)}finally{N(!1)}},[ee]),E=u.useCallback((K,Ge,Ae)=>{const Xe=R.current.get(K);if(Xe?.readyState===WebSocket.OPEN||Xe?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${K}] WebSocket 已存在,跳过连接`);return}j(!0);const Vs=window.location.protocol==="https:"?"wss:":"ws:",Pe=new URLSearchParams;Ge==="virtual"&&Ae?(Pe.append("user_id",Ae.userId),Pe.append("user_name",Ae.userName),Pe.append("platform",Ae.platform),Pe.append("person_id",Ae.personId),Pe.append("group_name",Ae.groupName||"WebUI虚拟群聊"),Ae.groupId&&Pe.append("group_id",Ae.groupId)):(Pe.append("user_id",se.current),Pe.append("user_name",k));const $s=`${Vs}//${window.location.host}/api/chat/ws?${Pe.toString()}`;console.log(`[Tab ${K}] 正在连接 WebSocket:`,$s);try{const ve=new WebSocket($s);R.current.set(K,ve),ve.onopen=()=>{ee(K,{isConnected:!0}),j(!1),console.log(`[Tab ${K}] WebSocket 已连接`)},ve.onmessage=_s=>{try{const Le=JSON.parse(_s.data);switch(Le.type){case"session_info":ee(K,{sessionInfo:{session_id:Le.session_id,user_id:Le.user_id,user_name:Le.user_name,bot_name:Le.bot_name}});break;case"system":ie(K,{id:pe("sys"),type:"system",content:Le.content||"",timestamp:Le.timestamp||Date.now()/1e3});break;case"user_message":{const Qs=Le.sender?.user_id,mt=Ge==="virtual"&&Ae?Ae.userId:se.current;if(Qs===mt)break;ie(K,{id:Le.message_id||pe("user"),type:"user",content:Le.content||"",timestamp:Le.timestamp||Date.now()/1e3,sender:Le.sender});break}case"bot_message":{ee(K,{isTyping:!1}),z(!1);const Qs=we.current.get(K)||new Set,mt=`bot-${Le.content}-${Math.floor((Le.timestamp||0)*1e3)}`;if(Qs.has(mt))break;if(Qs.add(mt),we.current.set(K,Qs),Qs.size>100){const Fs=Qs.values().next().value;Fs&&Qs.delete(Fs)}d(Fs=>Fs.map(ls=>{if(ls.id!==K)return ls;const Is=ls.messages.filter(Xt=>Xt.type!=="thinking");return{...ls,messages:[...Is,{id:pe("bot"),type:"bot",content:Le.content||"",timestamp:Le.timestamp||Date.now()/1e3,sender:Le.sender}]}}));break}case"typing":ee(K,{isTyping:Le.is_typing||!1});break;case"error":z(!1),d(Qs=>Qs.map(mt=>{if(mt.id!==K)return mt;const Fs=mt.messages.filter(ls=>ls.type!=="thinking");return{...mt,messages:[...Fs,{id:pe("error"),type:"error",content:Le.content||"发生错误",timestamp:Le.timestamp||Date.now()/1e3}]}})),Me({title:"错误",description:Le.content,variant:"destructive"});break;case"pong":break;case"history":{const Qs=Le.messages||[];if(Qs.length>0){const mt=we.current.get(K)||new Set,Fs=Qs.map(ls=>{const Is=ls.is_bot||!1,Xt=ls.id||pe(Is?"bot":"user"),zt=`${Is?"bot":"user"}-${ls.content}-${Math.floor(ls.timestamp*1e3)}`;return mt.add(zt),{id:Xt,type:Is?"bot":"user",content:ls.content,timestamp:ls.timestamp,sender:{name:ls.sender_name||(Is?"麦麦":"用户"),user_id:ls.sender_id,is_bot:Is}}});we.current.set(K,mt),ee(K,{messages:Fs}),console.log(`[Tab ${K}] 已加载 ${Fs.length} 条历史消息`)}break}default:console.log("未知消息类型:",Le.type)}}catch(Le){console.error("解析消息失败:",Le)}},ve.onclose=()=>{ee(K,{isConnected:!1}),j(!1),R.current.delete(K),console.log(`[Tab ${K}] WebSocket 已断开`);const _s=xe.current.get(K);_s&&clearTimeout(_s);const Le=window.setTimeout(()=>{if(!me.current){const Qs=r.find(mt=>mt.id===K);Qs&&E(K,Qs.type,Qs.virtualConfig)}},5e3);xe.current.set(K,Le)},ve.onerror=_s=>{console.error(`[Tab ${K}] WebSocket 错误:`,_s),j(!1)}}catch(ve){console.error(`[Tab ${K}] 创建 WebSocket 失败:`,ve),j(!1)}},[k,ee,ie,Me,r]),me=u.useRef(!1);u.useEffect(()=>{me.current=!1;const K=R.current,Ge=xe.current,Ae=we.current;qe("webui-default");const Xe=setTimeout(()=>{me.current||(E("webui-default","webui"),r.forEach(Pe=>{Pe.type==="virtual"&&Pe.virtualConfig&&(Ae.set(Pe.id,new Set),setTimeout(()=>{me.current||E(Pe.id,"virtual",Pe.virtualConfig)},200))}))},100),Vs=setInterval(()=>{K.forEach(Pe=>{Pe.readyState===WebSocket.OPEN&&Pe.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{me.current=!0,clearTimeout(Xe),clearInterval(Vs),Ge.forEach(Pe=>{clearTimeout(Pe)}),Ge.clear(),K.forEach(Pe=>{Pe.close()}),K.clear()}},[]);const Ie=u.useCallback(()=>{const K=R.current.get(m);if(!p.trim()||!K||K.readyState!==WebSocket.OPEN||L)return;z(!0);const Ge=f?.type==="virtual"&&f.virtualConfig?.userName||k,Ae=p.trim(),Xe=Date.now()/1e3;K.send(JSON.stringify({type:"message",content:Ae,user_name:Ge}));const Vs={id:pe("user"),type:"user",content:Ae,timestamp:Xe,sender:{name:Ge,is_bot:!1}};ie(m,Vs);const Pe={id:pe("thinking"),type:"thinking",content:"",timestamp:Xe+.001,sender:{name:f?.sessionInfo.bot_name||"麦麦",is_bot:!0}};ie(m,Pe),g("")},[p,k,m,f,ie,L]),Se=K=>{K.key==="Enter"&&!K.shiftKey&&(K.preventDefault(),Ie())},J=()=>{Y(k),D(!0)},Ne=()=>{const K=B.trim()||"WebUI用户";w(K),F_(K),D(!1);const Ge=R.current.get(m);Ge?.readyState===WebSocket.OPEN&&Ge.send(JSON.stringify({type:"update_nickname",user_name:K}))},Ce=()=>{Y(""),D(!1)},Gs=K=>new Date(K*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),ws=()=>{const K=R.current.get(m);K&&(K.close(),R.current.delete(m)),E(m,f?.type||"webui",f?.virtualConfig)},bt=()=>{q({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),O(""),Z(),I(!0)},ut=()=>{if(!V.platform||!V.personId){Me({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const K=`webui_virtual_group_${V.platform}_${V.userId}`,Ge=`virtual-${V.platform}-${V.userId}-${Date.now()}`,Ae=V.userName||V.userId,Xe={id:Ge,type:"virtual",label:Ae,virtualConfig:{...V,groupId:K},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};d(Vs=>{const Pe=[...Vs,Xe],$s=Pe.filter(ve=>ve.type==="virtual"&&ve.virtualConfig).map(ve=>({id:ve.id,label:ve.label,virtualConfig:ve.virtualConfig,createdAt:Date.now()}));return kp($s),Pe}),x(Ge),I(!1),we.current.set(Ge,new Set),setTimeout(()=>{E(Ge,"virtual",V)},100),Me({title:"虚拟身份标签页",description:`已创建 ${Ae} 的对话`})},Us=(K,Ge)=>{if(Ge?.stopPropagation(),K==="webui-default")return;const Ae=R.current.get(K);Ae&&(Ae.close(),R.current.delete(K));const Xe=xe.current.get(K);Xe&&(clearTimeout(Xe),xe.current.delete(K)),we.current.delete(K),d(Vs=>{const Pe=Vs.filter(ve=>ve.id!==K),$s=Pe.filter(ve=>ve.type==="virtual"&&ve.virtualConfig).map(ve=>({id:ve.id,label:ve.label,virtualConfig:ve.virtualConfig,createdAt:Date.now()}));return kp($s),Pe}),m===K&&x("webui-default")},ks=K=>{x(K)},na=K=>{q(Ge=>({...Ge,personId:K.person_id,userId:K.user_id,userName:K.nickname||K.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Hs,{open:X,onOpenChange:I,children:e.jsxs(Os,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Rs,{children:[e.jsxs(Ls,{className:"flex items-center gap-2",children:[e.jsx(_u,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(Js,{children:"选择一个麦麦已认识的用户,以该用户的身份与麦麦对话。麦麦将使用她对该用户的记忆和认知来回应。"})]}),e.jsxs("div",{className:"space-y-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(Bu,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Ue,{value:V.platform,onValueChange:K=>{q(Ge=>({...Ge,platform:K,personId:"",userId:"",userName:""})),he([])},children:[e.jsx(Oe,{disabled:je,children:e.jsx(Be,{placeholder:je?"加载中...":"选择平台"})}),e.jsx(Re,{children:T.map(K=>e.jsxs(le,{value:K.platform,children:[K.platform," (",K.count," 人)"]},K.platform))})]})]}),V.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(Hu,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索用户名...",value:Te,onChange:K=>O(K.target.value),className:"pl-9"})]}),e.jsx(Je,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:fe?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ws,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ae.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(Hu,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:ae.map(K=>e.jsxs("button",{onClick:()=>na(K),className:F("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",V.personId===K.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(rr,{className:"h-8 w-8 shrink-0",children:e.jsx(cr,{className:F("text-xs",V.personId===K.person_id?"bg-primary-foreground/20":"bg-muted"),children:(K.nickname||K.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:K.nickname||K.person_name}),e.jsxs("div",{className:F("text-xs truncate",V.personId===K.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",K.user_id,K.is_known&&" · 已认识"]})]})]},K.person_id))})})})]}),V.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"虚拟群名(可选)"}),e.jsx(re,{placeholder:"WebUI虚拟群聊",value:V.groupName,onChange:K=>q(Ge=>({...Ge,groupName:K.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(et,{className:"gap-2 sm:gap-0",children:[e.jsx(S,{variant:"outline",onClick:()=>I(!1),children:"取消"}),e.jsx(S,{onClick:ut,disabled:!V.platform||!V.personId,children:"创建对话"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[r.map(K=>e.jsxs("button",{onClick:()=>ks(K.id),className:F("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors","hover:bg-muted",m===K.id?"bg-background shadow-sm border":"text-muted-foreground"),children:[K.type==="webui"?e.jsx(Rl,{className:"h-3.5 w-3.5"}):e.jsx(_u,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:K.label}),e.jsx("span",{className:F("w-1.5 h-1.5 rounded-full",K.isConnected?"bg-green-500":"bg-muted-foreground/50")}),K.id!=="webui-default"&&e.jsx("button",{onClick:Ge=>Us(K.id,Ge),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20",children:e.jsx(il,{className:"h-3 w-3"})})]},K.id)),e.jsx("button",{onClick:bt,className:"flex items-center gap-1 px-2 py-1.5 rounded-md text-sm text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"新建虚拟身份对话",children:e.jsx(ct,{className:"h-3.5 w-3.5"})})]})})}),e.jsx("div",{className:"shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx(rr,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(cr,{className:"bg-primary/10 text-primary",children:e.jsx(lr,{className:"h-4 w-4 sm:h-5 sm:w-5"})})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:f?.sessionInfo.bot_name||"麦麦"}),e.jsx("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:f?.isConnected?e.jsxs(e.Fragment,{children:[e.jsx(Ny,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):b?e.jsxs(e.Fragment,{children:[e.jsx(Ws,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(yy,{className:"h-3 w-3 text-red-500"}),e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"未连接"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[y&&e.jsx(Ws,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(S,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ws,disabled:b,title:"重新连接",children:e.jsx(Et,{className:F("h-4 w-4",b&&"animate-spin")})})]})]}),e.jsx("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:f?.type==="virtual"&&f.virtualConfig?e.jsxs(e.Fragment,{children:[e.jsx(_u,{className:"h-3 w-3 text-primary"}),e.jsx("span",{children:"虚拟身份:"}),e.jsx("span",{className:"font-medium text-primary",children:f.virtualConfig.userName}),e.jsxs("span",{className:"text-xs",children:["(",f.virtualConfig.platform,")"]}),f.virtualConfig.groupName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1",children:"·"}),e.jsxs("span",{className:"text-xs",children:["群:",f.virtualConfig.groupName]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Xc,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),U?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{value:B,onChange:K=>Y(K.target.value),onKeyDown:K=>{K.key==="Enter"&&Ne(),K.key==="Escape"&&Ce()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Ne,children:"保存"}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Ce,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:k}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:J,title:"修改昵称",children:e.jsx(wy,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[f?.messages.length===0&&!y&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(lr,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",f?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),f?.messages.map(K=>e.jsxs("div",{className:F("flex gap-2 sm:gap-3",K.type==="user"&&"flex-row-reverse",K.type==="system"&&"justify-center",K.type==="error"&&"justify-center"),children:[K.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:K.content}),K.type==="error"&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:K.content}),K.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(rr,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(cr,{className:"bg-primary/10 text-primary",children:e.jsx(lr,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:"flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",children:[e.jsx("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:e.jsx("span",{className:"hidden sm:inline",children:K.sender?.name||f?.sessionInfo.bot_name})}),e.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"思考中..."})]})})]})]}),(K.type==="user"||K.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(rr,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(cr,{className:F("text-xs",K.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:K.type==="bot"?e.jsx(lr,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(Xc,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:F("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",K.type==="user"&&"items-end"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:K.sender?.name||(K.type==="bot"?f?.sessionInfo.bot_name:k)}),e.jsx("span",{children:Gs(K.timestamp)})]}),e.jsx("div",{className:F("rounded-2xl px-3 py-2 text-sm whitespace-pre-wrap break-words",K.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:K.content})]})]})]},K.id)),e.jsx("div",{ref:ue})]})})}),e.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:p,onChange:K=>g(K.target.value),onKeyDown:Se,placeholder:L?"等待响应中...":f?.isConnected?"输入消息...":"等待连接...",disabled:!f?.isConnected||L,className:"flex-1 h-10 sm:h-10"}),e.jsx(S,{onClick:Ie,disabled:!f?.isConnected||!p.trim()||L,size:"icon",className:"h-10 w-10 shrink-0",children:L?e.jsx(Ws,{className:"h-4 w-4 animate-spin"}):e.jsx(_y,{className:"h-4 w-4"})})]})})})]})}var lm="Radio",[Q_,sj]=cg(lm),[I_,Y_]=Q_(lm),tj=u.forwardRef((n,i)=>{const{__scopeRadio:r,name:d,checked:m=!1,required:x,disabled:f,value:p="on",onCheck:g,form:b,...j}=n,[y,N]=u.useState(null),k=Iu(i,D=>N(D)),w=u.useRef(!1),U=y?b||!!y.closest("form"):!0;return e.jsxs(I_,{scope:r,checked:m,disabled:f,children:[e.jsx(Zc.button,{type:"button",role:"radio","aria-checked":m,"data-state":ij(m),"data-disabled":f?"":void 0,disabled:f,value:p,...j,ref:k,onClick:Lu(n.onClick,D=>{m||g?.(),U&&(w.current=D.isPropagationStopped(),w.current||D.stopPropagation())})}),U&&e.jsx(nj,{control:y,bubbles:!w.current,name:d,value:p,checked:m,required:x,disabled:f,form:b,style:{transform:"translateX(-100%)"}})]})});tj.displayName=lm;var aj="RadioIndicator",lj=u.forwardRef((n,i)=>{const{__scopeRadio:r,forceMount:d,...m}=n,x=Y_(aj,r);return e.jsx(VN,{present:d||x.checked,children:e.jsx(Zc.span,{"data-state":ij(x.checked),"data-disabled":x.disabled?"":void 0,...m,ref:i})})});lj.displayName=aj;var X_="RadioBubbleInput",nj=u.forwardRef(({__scopeRadio:n,control:i,checked:r,bubbles:d=!0,...m},x)=>{const f=u.useRef(null),p=Iu(f,x),g=$N(r),b=QN(i);return u.useEffect(()=>{const j=f.current;if(!j)return;const y=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(y,"checked").set;if(g!==r&&k){const w=new Event("click",{bubbles:d});k.call(j,r),j.dispatchEvent(w)}},[g,r,d]),e.jsx(Zc.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...m,tabIndex:-1,ref:p,style:{...m.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});nj.displayName=X_;function ij(n){return n?"checked":"unchecked"}var K_=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ro="RadioGroup",[J_]=cg(ro,[Xp,sj]),rj=Xp(),cj=sj(),[P_,Z_]=J_(ro),oj=u.forwardRef((n,i)=>{const{__scopeRadioGroup:r,name:d,defaultValue:m,value:x,required:f=!1,disabled:p=!1,orientation:g,dir:b,loop:j=!0,onValueChange:y,...N}=n,k=rj(r),w=GN(b),[U,D]=FN({prop:x,defaultProp:m??null,onChange:y,caller:ro});return e.jsx(P_,{scope:r,name:d,required:f,disabled:p,value:U,onValueChange:D,children:e.jsx(jN,{asChild:!0,...k,orientation:g,dir:w,loop:j,children:e.jsx(Zc.div,{role:"radiogroup","aria-required":f,"aria-orientation":g,"data-disabled":p?"":void 0,dir:w,...N,ref:i})})})});oj.displayName=ro;var dj="RadioGroupItem",uj=u.forwardRef((n,i)=>{const{__scopeRadioGroup:r,disabled:d,...m}=n,x=Z_(dj,r),f=x.disabled||d,p=rj(r),g=cj(r),b=u.useRef(null),j=Iu(i,b),y=x.value===m.value,N=u.useRef(!1);return u.useEffect(()=>{const k=U=>{K_.includes(U.key)&&(N.current=!0)},w=()=>N.current=!1;return document.addEventListener("keydown",k),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",k),document.removeEventListener("keyup",w)}},[]),e.jsx(vN,{asChild:!0,...p,focusable:!f,active:y,children:e.jsx(tj,{disabled:f,required:x.required,checked:y,...g,...m,name:x.name,ref:j,onCheck:()=>x.onValueChange(m.value),onKeyDown:Lu(k=>{k.key==="Enter"&&k.preventDefault()}),onFocus:Lu(m.onFocus,()=>{N.current&&b.current?.click()})})})});uj.displayName=dj;var W_="RadioGroupIndicator",mj=u.forwardRef((n,i)=>{const{__scopeRadioGroup:r,...d}=n,m=cj(r);return e.jsx(lj,{...m,...d,ref:i})});mj.displayName=W_;var xj=oj,hj=uj,eS=mj;const fj=u.forwardRef(({className:n,...i},r)=>e.jsx(xj,{className:F("grid gap-2",n),...i,ref:r}));fj.displayName=xj.displayName;const pj=u.forwardRef(({className:n,...i},r)=>e.jsx(hj,{ref:r,className:F("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",n),...i,children:e.jsx(eS,{className:"flex items-center justify-center",children:e.jsx(Sy,{className:"h-2.5 w-2.5 fill-current text-current"})})}));pj.displayName=hj.displayName;function sS({question:n,value:i,onChange:r,error:d,disabled:m=!1}){const[x,f]=u.useState(null),p=m||n.readOnly,g=()=>{switch(n.type){case"single":return e.jsx(fj,{value:i||"",onValueChange:r,disabled:p,className:"space-y-2",children:n.options?.map(b=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(pj,{value:b.value,id:`${n.id}-${b.id}`}),e.jsx(C,{htmlFor:`${n.id}-${b.id}`,className:"cursor-pointer font-normal",children:b.label})]},b.id))});case"multiple":{const b=i||[];return e.jsxs("div",{className:"space-y-2",children:[n.options?.map(j=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(dt,{id:`${n.id}-${j.id}`,checked:b.includes(j.value),disabled:p||n.maxSelections!==void 0&&b.length>=n.maxSelections&&!b.includes(j.value),onCheckedChange:y=>{r(y?[...b,j.value]:b.filter(N=>N!==j.value))}}),e.jsx(C,{htmlFor:`${n.id}-${j.id}`,className:"cursor-pointer font-normal",children:j.label})]},j.id)),n.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",n.maxSelections," 项"]})]})}case"text":return e.jsx(re,{value:i||"",onChange:b=>r(b.target.value),placeholder:n.placeholder||"请输入...",disabled:p,readOnly:n.readOnly,maxLength:n.maxLength,className:F(n.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(As,{value:i||"",onChange:b=>r(b.target.value),placeholder:n.placeholder||"请输入...",disabled:p,readOnly:n.readOnly,maxLength:n.maxLength,rows:4,className:F(n.readOnly&&"bg-muted cursor-not-allowed")}),n.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(i||"").length," / ",n.maxLength]})]});case"rating":{const b=i||0,j=x!==null?x:b;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(y=>e.jsx("button",{type:"button",disabled:p,className:F("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",p&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!p&&f(y),onMouseLeave:()=>f(null),onClick:()=>!p&&r(y),children:e.jsx(nl,{className:F("h-6 w-6 transition-colors",y<=j?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},y)),b>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[b," / 5"]})]})}case"scale":{const b=n.min??1,j=n.max??10,y=n.step??1,N=i??b;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(ga,{value:[N],onValueChange:([k])=>r(k),min:b,max:j,step:y,disabled:p}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:n.minLabel||b}),e.jsx("span",{className:"font-medium text-foreground",children:N}),e.jsx("span",{children:n.maxLabel||j})]})]})}case"dropdown":return e.jsxs(Ue,{value:i||"",onValueChange:r,disabled:p,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:n.placeholder||"请选择..."})}),e.jsx(Re,{children:n.options?.map(b=>e.jsx(le,{value:b.value,children:b.label},b.id))})]});default:return e.jsx("div",{className:"text-muted-foreground",children:"不支持的问题类型"})}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-base font-medium",children:[n.title,n.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),n.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]}),g(),d&&e.jsx("p",{className:"text-sm text-destructive",children:d})]})}const gj="https://maibot-plugin-stats.maibot-webui.workers.dev";function jj(){const n="maibot_user_id";let i=localStorage.getItem(n);if(!i){const r=Math.random().toString(36).substring(2,10),d=Date.now().toString(36),m=Math.random().toString(36).substring(2,10);i=`fp_${r}_${d}_${m}`,localStorage.setItem(n,i)}return i}async function tS(n,i,r,d){try{const m=d?.userId||jj(),x={surveyId:n,surveyVersion:i,userId:m,answers:r,submittedAt:new Date().toISOString(),allowMultiple:d?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},f=await fetch(`${gj}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}),p=await f.json();return f.status===429?{success:!1,error:"提交过于频繁,请稍后再试"}:f.status===409?{success:!1,error:p.error||"你已经提交过这份问卷了"}:f.ok?{success:!0,submissionId:p.submissionId,message:p.message}:{success:!1,error:p.error||"提交失败"}}catch(m){return console.error("Error submitting survey:",m),{success:!1,error:"网络错误"}}}async function aS(n,i){try{const r=i||jj(),d=new URLSearchParams({user_id:r,survey_id:n}),m=await fetch(`${gj}/survey/check?${d}`);return m.ok?{success:!0,hasSubmitted:(await m.json()).hasSubmitted}:{success:!1,error:(await m.json()).error||"检查失败"}}catch(r){return console.error("Error checking submission:",r),{success:!1,error:"网络错误"}}}function vj({config:n,initialAnswers:i,onSubmitSuccess:r,onSubmitError:d,showProgress:m=!0,paginateQuestions:x=!1,className:f}){const p=u.useCallback(()=>!i||i.length===0?{}:i.reduce((q,se)=>(q[se.questionId]=se.value,q),{}),[i]),[g,b]=u.useState(()=>p()),[j,y]=u.useState({}),[N,k]=u.useState(0),[w,U]=u.useState(!1),[D,B]=u.useState(!1),[Y,L]=u.useState(null),[z,X]=u.useState(null),[I,T]=u.useState(!1),[M,ae]=u.useState(!0);u.useEffect(()=>{i&&i.length>0&&b(q=>({...q,...p()}))},[i,p]),u.useEffect(()=>{(async()=>{if(!n.settings?.allowMultiple){const se=await aS(n.id);se.success&&se.hasSubmitted&&T(!0)}ae(!1)})()},[n.id,n.settings?.allowMultiple]);const he=u.useCallback(()=>{const q=new Date;return!(n.settings?.startTime&&new Date(n.settings.startTime)>q||n.settings?.endTime&&new Date(n.settings.endTime){const se=g[q.id];return se==null?!1:Array.isArray(se)?se.length>0:typeof se=="string"?se.trim()!=="":!0}).length,ge=je/n.questions.length*100,fe=u.useCallback((q,se)=>{b(R=>({...R,[q]:se})),y(R=>{const ue={...R};return delete ue[q],ue})},[]),be=u.useCallback(()=>{const q={};for(const se of n.questions){if(se.required){const R=g[se.id];if(R==null){q[se.id]="此题为必填项";continue}if(Array.isArray(R)&&R.length===0){q[se.id]="请至少选择一项";continue}if(typeof R=="string"&&R.trim()===""){q[se.id]="此题为必填项";continue}}se.minLength&&typeof g[se.id]=="string"&&g[se.id].length{if(!be()){if(x){const q=n.questions.findIndex(se=>j[se.id]);q>=0&&k(q)}return}U(!0),L(null);try{const q=n.questions.filter(R=>g[R.id]!==void 0).map(R=>({questionId:R.id,value:g[R.id]})),se=await tS(n.id,n.version,q,{allowMultiple:n.settings?.allowMultiple});if(se.success&&se.submissionId)B(!0),X(se.submissionId),r?.(se.submissionId);else{const R=se.error||"提交失败";L(R),d?.(R)}}catch(q){const se=q instanceof Error?q.message:"提交失败";L(se),d?.(se)}finally{U(!1)}},[be,x,n,g,j,r,d]),O=u.useCallback(q=>{q>=0&&qe.jsxs("div",{className:F("p-4 rounded-lg border bg-card",j[q.id]?"border-destructive bg-destructive/5":"border-border"),children:[x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",N+1," / ",n.questions.length]}),!x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[se+1,"."]}),e.jsx(sS,{question:q,value:g[q.id],onChange:R=>fe(q.id,R),error:j[q.id],disabled:w})]},q.id)),Y&&e.jsxs(Qt,{variant:"destructive",children:[e.jsx(Mt,{className:"h-4 w-4"}),e.jsx(It,{children:Y})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(S,{variant:"outline",onClick:()=>O(N-1),disabled:N===0||w,children:[e.jsx(rl,{className:"h-4 w-4 mr-1"}),"上一题"]}),N===n.questions.length-1?e.jsxs(S,{onClick:Te,disabled:w,children:[w&&e.jsx(Ws,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(S,{onClick:()=>O(N+1),disabled:w,children:["下一题",e.jsx(Ha,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(j).length>0&&e.jsxs("span",{className:"text-destructive",children:["还有 ",Object.keys(j).length," 个必填项未完成"]})}),e.jsxs(S,{onClick:Te,disabled:w,size:"lg",children:[w&&e.jsx(Ws,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const lS={id:"webui-feedback-v1",version:"1.0.0",title:"麦麦 WebUI 使用反馈问卷",description:"感谢您使用麦麦 WebUI!您的反馈将帮助我们不断改进产品体验。",questions:[{id:"webui_version",type:"text",title:"你正在使用的 WebUI 版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"ui_design_satisfaction",type:"single",title:"你觉得当前的 WebUI 界面设计如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"problems_encountered",type:"multiple",title:"你在使用 WebUI 时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"lag",label:"界面卡顿",value:"lag"},{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"complex",label:"操作复杂",value:"complex"},{id:"bugs",label:"存在 Bug",value:"bugs"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"useful_features",type:"textarea",title:"你觉得哪些功能是最有用的?",required:!0,placeholder:"请分享你认为最有价值的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦 WebUI 的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦 WebUI 给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},nS={id:"maibot-feedback-v1",version:"1.0.0",title:"麦麦使用体验反馈问卷",description:"感谢您使用麦麦!您的反馈将帮助我们打造更好的 AI 伙伴。",questions:[{id:"maibot_version",type:"text",title:"你正在使用的麦麦版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"improvement_areas",type:"textarea",title:"你认为麦麦还有哪些部分可以改进?",required:!0,placeholder:"请分享你认为可以改进的方面...",maxLength:1e3},{id:"problems_encountered",type:"multiple",title:"你在使用麦麦时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"slow_response",label:"响应速度慢",value:"slow_response"},{id:"complex",label:"操作复杂",value:"complex"},{id:"unstable",label:"运行不稳定",value:"unstable"},{id:"config_difficult",label:"配置困难",value:"config_difficult"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"helpful_features",type:"textarea",title:"你觉得麦麦的哪些功能对你最有帮助?",required:!0,placeholder:"请分享对你最有帮助的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对麦麦的成长非常重要,我们会认真考虑每一条建议。"}};function iS(){const[n,i]=u.useState(null),[r,d]=u.useState(!0);u.useEffect(()=>{const p=JSON.parse(JSON.stringify(lS));i(p),d(!1)},[]);const m=u.useMemo(()=>[{questionId:"webui_version",value:`v${eo}`}],[]),x=u.useCallback(p=>{console.log("WebUI Survey submitted:",p)},[]),f=u.useCallback(p=>{console.error("WebUI Survey submission error:",p)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Ws,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(_g,{className:"h-8 w-8",strokeWidth:2}),"WebUI 使用反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们持续改进产品体验"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(vj,{config:n,initialAnswers:m,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:x,onSubmitError:f})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(Qt,{variant:"destructive",className:"max-w-md",children:[e.jsx(Mt,{className:"h-4 w-4"}),e.jsx(It,{children:"无法加载问卷配置"})]}),e.jsx(S,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function rS(){const[n,i]=u.useState(null),[r,d]=u.useState(!0),[m,x]=u.useState("未知版本");u.useEffect(()=>{(async()=>{try{const y=await qg();x(y.version||"未知版本")}catch(y){console.error("Failed to get MaiBot version:",y),x("获取失败")}const j=JSON.parse(JSON.stringify(nS));i(j),d(!1)})()},[]);const f=u.useMemo(()=>[{questionId:"maibot_version",value:m}],[m]),p=u.useCallback(b=>{console.log("MaiBot Survey submitted:",b)},[]),g=u.useCallback(b=>{console.error("MaiBot Survey submission error:",b)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Ws,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(_g,{className:"h-8 w-8",strokeWidth:2}),"麦麦使用体验反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们打造更好的 AI 伙伴"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(vj,{config:n,initialAnswers:f,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:p,onSubmitError:g})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(Qt,{variant:"destructive",className:"max-w-md",children:[e.jsx(Mt,{className:"h-4 w-4"}),e.jsx(It,{children:"无法加载问卷配置"})]}),e.jsx(S,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function cS(){const n=ba(),[i,r]=u.useState(!0);return u.useEffect(()=>{let d=!1;return(async()=>{try{const x=await Wu();!d&&!x&&n({to:"/auth"})}catch{d||n({to:"/auth"})}finally{d||r(!1)}})(),()=>{d=!0}},[n]),{checking:i}}async function oS(){return await Wu()}const dS=ti("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),bj=u.forwardRef(({className:n,size:i,abbrTitle:r,children:d,...m},x)=>e.jsx("kbd",{className:F(dS({size:i,className:n})),ref:x,...m,children:r?e.jsx("abbr",{title:r,children:d}):d}));bj.displayName="Kbd";const uS=[{icon:Wc,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Ca,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Sg,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:Cg,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Yu,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Rl,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:kg,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:si,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:Cy,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Ol,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Xu,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:ai,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function mS({open:n,onOpenChange:i}){const[r,d]=u.useState(""),[m,x]=u.useState(0),f=ba(),p=uS.filter(j=>j.title.toLowerCase().includes(r.toLowerCase())||j.description.toLowerCase().includes(r.toLowerCase())||j.category.toLowerCase().includes(r.toLowerCase()));u.useEffect(()=>{n&&(d(""),x(0))},[n]);const g=u.useCallback(j=>{f({to:j}),i(!1)},[f,i]),b=u.useCallback(j=>{j.key==="ArrowDown"?(j.preventDefault(),x(y=>(y+1)%p.length)):j.key==="ArrowUp"?(j.preventDefault(),x(y=>(y-1+p.length)%p.length)):j.key==="Enter"&&p[m]&&(j.preventDefault(),g(p[m].path))},[p,m,g]);return e.jsx(Hs,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Rs,{className:"px-4 pt-4 pb-0",children:[e.jsx(Ls,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(re,{value:r,onChange:j=>{d(j.target.value),x(0)},onKeyDown:b,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(Je,{className:"h-[400px]",children:p.length>0?e.jsx("div",{className:"p-2",children:p.map((j,y)=>{const N=j.icon;return e.jsxs("button",{onClick:()=>g(j.path),onMouseEnter:()=>x(y),className:F("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",y===m?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(N,{className:"h-5 w-5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm",children:j.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:j.description})]}),e.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:j.category})]},j.path)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(At,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),e.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}const xS=YN,hS=XN,fS=KN,Nj=u.forwardRef(({className:n,sideOffset:i=4,...r},d)=>e.jsx(IN,{children:e.jsx(og,{ref:d,sideOffset:i,className:F("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]",n),...r})}));Nj.displayName=og.displayName;function pS({children:n}){const{checking:i}=cS(),[r,d]=u.useState(!0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),{theme:g,setTheme:b}=Ju(),j=Fb();if(u.useEffect(()=>{const U=D=>{(D.metaKey||D.ctrlKey)&&D.key==="k"&&(D.preventDefault(),p(!0))};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[]),i)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const y=[{title:"概览",items:[{icon:Wc,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Ca,label:"麦麦主程序配置",path:"/config/bot"},{icon:Sg,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:Cg,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:tp,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Yu,label:"表情包管理",path:"/resource/emoji"},{icon:Rl,label:"表达方式管理",path:"/resource/expression"},{icon:si,label:"黑话管理",path:"/resource/jargon"},{icon:kg,label:"人物信息管理",path:"/resource/person"},{icon:yg,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:Ol,label:"插件市场",path:"/plugins"},{icon:wg,label:"模型分配预设市场",path:"/model-presets"},{icon:tp,label:"插件配置",path:"/plugin-config"},{icon:Xu,label:"日志查看器",path:"/logs"},{icon:Rl,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:ai,label:"系统设置",path:"/settings"}]}],k=g==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":g,w=async()=>{await K0()};return e.jsx(xS,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:F("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",r?"lg:w-64":"lg:w-16",m?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:F("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!r&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:F("flex items-baseline gap-2",!r&&"lg:hidden"),children:[e.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),e.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:D0()})]}),!r&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(Je,{className:F("flex-1 overflow-x-hidden",!r&&"lg:w-16"),children:e.jsx("nav",{className:F("p-4",!r&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:F("space-y-6",!r&&"lg:space-y-3 lg:w-full"),children:y.map((U,D)=>e.jsxs("li",{children:[e.jsx("div",{className:F("px-3 h-[1.25rem]","mb-2",!r&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:U.title})}),!r&&D>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:U.items.map(B=>{const Y=j({to:B.path}),L=B.icon,z=e.jsxs(e.Fragment,{children:[Y&&e.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),e.jsxs("div",{className:F("flex items-center transition-all duration-300",r?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(L,{className:F("h-5 w-5 flex-shrink-0",Y&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:F("text-sm font-medium whitespace-nowrap transition-all duration-300",Y&&"font-semibold",r?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:B.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(hS,{children:[e.jsx(fS,{asChild:!0,children:e.jsx(Xn,{to:B.path,"data-tour":B.tourId,className:F("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",Y?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",r?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>x(!1),children:z})}),!r&&e.jsx(Nj,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:B.label})})]})},B.path)})})]},U.title))})})})]}),m&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>x(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>x(!m),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(ky,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>d(!r),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:r?"收起侧边栏":"展开侧边栏",children:e.jsx(rl,{className:F("h-5 w-5 transition-transform",!r&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>p(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx(At,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),e.jsxs(bj,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(mS,{open:f,onOpenChange:p}),e.jsxs(S,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(Ty,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:U=>{T0(k==="dark"?"light":"dark",b,U)},className:"rounded-lg p-2 hover:bg-accent",title:k==="dark"?"切换到浅色模式":"切换到深色模式",children:k==="dark"?e.jsx(gg,{className:"h-5 w-5"}):e.jsx(jg,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(S,{variant:"ghost",size:"sm",onClick:w,className:"gap-2",title:"登出系统",children:[e.jsx(Ey,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:n})]})]})})}function gS(n){const i=n.split(` -`).slice(1),r=[];for(const d of i){const m=d.trim();if(!m.startsWith("at "))continue;const x=m.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);x?r.push({functionName:x[1]||"",fileName:x[2],lineNumber:x[3],columnNumber:x[4],raw:m}):r.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:m})}return r}function jS({error:n,errorInfo:i}){const[r,d]=u.useState(!0),[m,x]=u.useState(!1),[f,p]=u.useState(!1),g=n.stack?gS(n.stack):[],b=async()=>{const j=` -Error: ${n.name} -Message: ${n.message} - -Stack Trace: -${n.stack||"No stack trace available"} - -Component Stack: -${i?.componentStack||"No component stack available"} - -URL: ${window.location.href} -User Agent: ${navigator.userAgent} -Time: ${new Date().toISOString()} - `.trim();try{await navigator.clipboard.writeText(j),p(!0),setTimeout(()=>p(!1),2e3)}catch(y){console.error("Failed to copy:",y)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Qt,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(ka,{className:"h-4 w-4"}),e.jsxs(It,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[n.name,":"]})," ",n.message]})]}),g.length>0&&e.jsxs(Vu,{open:r,onOpenChange:d,children:[e.jsx($u,{asChild:!0,children:e.jsxs(S,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(zy,{className:"h-4 w-4"}),"Stack Trace (",g.length," frames)"]}),r?e.jsx(mr,{className:"h-4 w-4"}):e.jsx(Ll,{className:"h-4 w-4"})]})}),e.jsx(Qu,{children:e.jsx(Je,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:g.map((j,y)=>e.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[y+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:j.functionName}),j.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[j.fileName,j.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",j.lineNumber,":",j.columnNumber]})]})]})]})},y))})})})]}),i?.componentStack&&e.jsxs(Vu,{open:m,onOpenChange:x,children:[e.jsx($u,{asChild:!0,children:e.jsxs(S,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(ka,{className:"h-4 w-4"}),"Component Stack"]}),m?e.jsx(mr,{className:"h-4 w-4"}):e.jsx(Ll,{className:"h-4 w-4"})]})}),e.jsx(Qu,{children:e.jsx(Je,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:i.componentStack})})})]}),e.jsx(S,{variant:"outline",size:"sm",onClick:b,className:"w-full",children:f?e.jsxs(e.Fragment,{children:[e.jsx($t,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(Yc,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function yj({error:n,errorInfo:i}){const r=()=>{window.location.href="/"},d=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(Fe,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(ts,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:e.jsx(ka,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(as,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(Zs,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(hs,{className:"space-y-4",children:[e.jsx(jS,{error:n,errorInfo:i}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(S,{onClick:d,className:"flex-1",children:[e.jsx(Et,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(S,{onClick:r,variant:"outline",className:"flex-1",children:[e.jsx(Wc,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class vS extends u.Component{constructor(i){super(i),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(i){return{hasError:!0,error:i}}componentDidCatch(i,r){console.error("ErrorBoundary caught an error:",i,r),this.setState({errorInfo:r})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:e.jsx(yj,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function wj({error:n}){return e.jsx(yj,{error:n,errorInfo:null})}const br=Vb({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(Tp,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!oS())throw Qb({to:"/auth"})}}),bS=st({getParentRoute:()=>br,path:"/auth",component:J0}),NS=st({getParentRoute:()=>br,path:"/setup",component:mw}),jt=st({getParentRoute:()=>br,id:"protected",component:()=>e.jsx(pS,{children:e.jsx(Tp,{})}),errorComponent:({error:n})=>e.jsx(wj,{error:n})}),yS=st({getParentRoute:()=>jt,path:"/",component:C0}),wS=st({getParentRoute:()=>jt,path:"/config/bot",component:$w}),_S=st({getParentRoute:()=>jt,path:"/config/modelProvider",component:e1}),SS=st({getParentRoute:()=>jt,path:"/config/model",component:f1}),CS=st({getParentRoute:()=>jt,path:"/config/adapter",component:g1}),kS=st({getParentRoute:()=>jt,path:"/resource/emoji",component:q1}),TS=st({getParentRoute:()=>jt,path:"/resource/expression",component:Z1}),ES=st({getParentRoute:()=>jt,path:"/resource/person",component:y2}),zS=st({getParentRoute:()=>jt,path:"/resource/jargon",component:m2}),MS=st({getParentRoute:()=>jt,path:"/resource/knowledge-graph",component:M2}),AS=st({getParentRoute:()=>jt,path:"/logs",component:c_}),DS=st({getParentRoute:()=>jt,path:"/chat",component:$_}),OS=st({getParentRoute:()=>jt,path:"/plugins",component:A_}),RS=st({getParentRoute:()=>jt,path:"/model-presets",component:D_}),LS=st({getParentRoute:()=>jt,path:"/plugin-config",component:L_}),US=st({getParentRoute:()=>jt,path:"/plugin-mirrors",component:U_}),BS=st({getParentRoute:()=>jt,path:"/settings",component:V0}),HS=st({getParentRoute:()=>jt,path:"/survey/webui-feedback",component:iS}),qS=st({getParentRoute:()=>jt,path:"/survey/maibot-feedback",component:rS}),GS=st({getParentRoute:()=>br,path:"*",component:Gg}),FS=br.addChildren([bS,NS,jt.addChildren([yS,wS,_S,SS,CS,kS,TS,zS,ES,MS,OS,RS,LS,US,AS,DS,BS,HS,qS]),GS]),VS=$b({routeTree:FS,defaultNotFoundComponent:Gg,defaultErrorComponent:({error:n})=>e.jsx(wj,{error:n})});function $S({children:n,defaultTheme:i="system",storageKey:r="ui-theme",...d}){const[m,x]=u.useState(()=>localStorage.getItem(r)||i);u.useEffect(()=>{const p=window.document.documentElement;if(p.classList.remove("light","dark"),m==="system"){const g=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";p.classList.add(g);return}p.classList.add(m)},[m]),u.useEffect(()=>{const p=localStorage.getItem("accent-color");if(p){const g=document.documentElement,j={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[p];j&&(g.style.setProperty("--primary",j.hsl),j.gradient?(g.style.setProperty("--primary-gradient",j.gradient),g.classList.add("has-gradient")):(g.style.removeProperty("--primary-gradient"),g.classList.remove("has-gradient")))}},[]);const f={theme:m,setTheme:p=>{localStorage.setItem(r,p),x(p)}};return e.jsx(Og.Provider,{...d,value:f,children:n})}function QS({children:n,defaultEnabled:i=!0,defaultWavesEnabled:r=!0,storageKey:d="enable-animations",wavesStorageKey:m="enable-waves-background"}){const[x,f]=u.useState(()=>{const j=localStorage.getItem(d);return j!==null?j==="true":i}),[p,g]=u.useState(()=>{const j=localStorage.getItem(m);return j!==null?j==="true":r});u.useEffect(()=>{const j=document.documentElement;x?j.classList.remove("no-animations"):j.classList.add("no-animations"),localStorage.setItem(d,String(x))},[x,d]),u.useEffect(()=>{localStorage.setItem(m,String(p))},[p,m]);const b={enableAnimations:x,setEnableAnimations:f,enableWavesBackground:p,setEnableWavesBackground:g};return e.jsx(Rg.Provider,{value:b,children:n})}const IS=JN,_j=u.forwardRef(({className:n,...i},r)=>e.jsx(dg,{ref:r,className:F("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",n),...i}));_j.displayName=dg.displayName;const YS=ti("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),Sj=u.forwardRef(({className:n,variant:i,...r},d)=>e.jsx(ug,{ref:d,className:F(YS({variant:i}),n),...r}));Sj.displayName=ug.displayName;const XS=u.forwardRef(({className:n,...i},r)=>e.jsx(mg,{ref:r,className:F("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",n),...i}));XS.displayName=mg.displayName;const Cj=u.forwardRef(({className:n,...i},r)=>e.jsx(xg,{ref:r,className:F("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",n),"toast-close":"",...i,children:e.jsx(il,{className:"h-4 w-4"})}));Cj.displayName=xg.displayName;const kj=u.forwardRef(({className:n,...i},r)=>e.jsx(hg,{ref:r,className:F("text-sm font-semibold [&+div]:text-xs",n),...i}));kj.displayName=hg.displayName;const Tj=u.forwardRef(({className:n,...i},r)=>e.jsx(fg,{ref:r,className:F("text-sm opacity-90",n),...i}));Tj.displayName=fg.displayName;function KS(){const{toasts:n}=qs();return e.jsxs(IS,{children:[n.map(function({id:i,title:r,description:d,action:m,...x}){return e.jsxs(Sj,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[r&&e.jsx(kj,{children:r}),d&&e.jsx(Tj,{children:d})]}),m,e.jsx(Cj,{})]},i)}),e.jsx(_j,{})]})}f0.createRoot(document.getElementById("root")).render(e.jsx(u.StrictMode,{children:e.jsx(vS,{children:e.jsx($S,{defaultTheme:"system",children:e.jsx(QS,{children:e.jsxs(Kw,{children:[e.jsx(Ib,{router:VS}),e.jsx(Zw,{}),e.jsx(KS,{})]})})})})})); diff --git a/webui/dist/assets/index-DrsALSzA.css b/webui/dist/assets/index-DrsALSzA.css deleted file mode 100644 index 20dd8da0..00000000 --- a/webui/dist/assets/index-DrsALSzA.css +++ /dev/null @@ -1 +0,0 @@ -@charset "UTF-8";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[140px\]{height:140px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[140px\]{min-height:140px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[1px\]{width:1px}.w-\[65px\]{width:65px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[100px\]{max-width:100px}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[1fr_1fr_90px_32px\]{grid-template-columns:1fr 1fr 90px 32px}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900\/30:is(.dark *){background-color:#1e3a8a4d}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-purple-900\/30:is(.dark *){background-color:#581c874d}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-purple-400:is(.dark *){--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-4{padding-bottom:1rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}.lg\:pb-6{padding-bottom:1.5rem}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}.uppy-Root{box-sizing:border-box;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1;position:relative;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.uppy-Root[dir=rtl],[dir=rtl] .uppy-Root{text-align:right}.uppy-Root *,.uppy-Root :after,.uppy-Root :before{box-sizing:inherit}.uppy-Root [hidden]{display:none}.uppy-u-reset{all:initial;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1}[dir=rtl] .uppy-u-reset{text-align:right}.uppy-c-textInput{background-color:#fff;border:1px solid #ddd;border-radius:4px;font-family:inherit;font-size:14px;line-height:1.5;padding:6px 8px}.uppy-size--md .uppy-c-textInput{padding:8px 10px}.uppy-c-textInput:focus{border-color:#1269cf99;box-shadow:0 0 0 3px #1269cf26;outline:none}[data-uppy-theme=dark] .uppy-c-textInput{background-color:#333;border-color:#333;color:#eaeaea}[data-uppy-theme=dark] .uppy-c-textInput:focus{border-color:#525252;box-shadow:none}.uppy-c-icon{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;fill:currentColor}.uppy-c-btn{align-items:center;color:inherit;display:inline-flex;font-family:inherit;font-size:inherit;font-weight:500;justify-content:center;line-height:1;transition-duration:.3s;transition-property:background-color,color;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.uppy-c-btn,[dir=rtl] .uppy-c-btn{text-align:center}.uppy-c-btn:not(:disabled):not(.disabled){cursor:pointer}.uppy-c-btn::-moz-focus-inner{border:0}.uppy-c-btn-primary{background-color:#1269cf;border-radius:4px;color:#fff;font-size:14px;padding:10px 18px}.uppy-c-btn-primary:not(:disabled):hover{background-color:#0e51a0}.uppy-c-btn-primary:focus{box-shadow:0 0 0 3px #1269cf66;outline:none}.uppy-size--md .uppy-c-btn-primary{padding:13px 22px}[data-uppy-theme=dark] .uppy-c-btn-primary{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-primary::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-c-btn-primary.uppy-c-btn--disabled{background-color:#8eb2db}.uppy-c-btn-link{background-color:initial;border-radius:4px;color:#525252;font-size:14px;line-height:1;padding:10px 15px}.uppy-c-btn-link:hover{color:#333}.uppy-c-btn-link:focus{box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-size--md .uppy-c-btn-link{padding:13px 18px}[data-uppy-theme=dark] .uppy-c-btn-link{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-link:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-link::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-link:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-c-btn-link:hover{color:#939393}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;padding:6px}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list:after,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list:after{content:"";flex:auto}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{margin:0;position:relative;width:50%}.uppy-size--md .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--md .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:33.3333%}.uppy-size--lg .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--lg .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:25%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem:before,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem:before{content:"";display:block;padding-top:100%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected svg{opacity:.85}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--disabled,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--disabled{opacity:.5}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#93939333}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#eaeaea33}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{height:30%;width:30%;fill:#000000b3}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{fill:#fffc}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{border-radius:4px;height:calc(100% - 14px);inset:7px;overflow:hidden;position:absolute;text-align:center;width:calc(100% - 14px)}@media(hover:none){.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author{display:block}}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{box-shadow:0 0 0 3px #aae1ffb3}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner img{border-radius:4px;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author{background:#0000004d;bottom:0;color:#fff;display:none;font-size:12px;font-weight:500;left:0;margin:0;padding:5px;position:absolute;text-decoration:none;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author:hover,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author:hover{background:#0006;text-decoration:underline}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-radius:50%;height:26px;opacity:0;position:absolute;right:16px;top:16px;width:26px;z-index:1002}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox:after{height:7px;inset-inline-start:7px;top:8px;width:12px}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{opacity:1}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author{display:block}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus{outline:none}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner{border:0}.uppy-ProviderBrowser-viewType--list{background-color:#fff}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list{background-color:#1f1f1f}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{align-items:center;display:flex;margin:0;padding:7px 15px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{color:#eaeaea}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem--disabled{opacity:.6}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox{background-color:#fff;border:1px solid #cfcfcf;border-radius:3px;height:17px;margin-inline-end:15px;width:17px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border:1px solid #1269cf;box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:after{height:5px;inset-inline-start:3px;opacity:0;top:4px;width:9px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border-color:#02baf2b3;box-shadow:0 0 0 3px #02baf233}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-color:#1269cf}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{opacity:1}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner{align-items:center;color:inherit;display:flex;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;overflow:hidden;padding:2px;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner:focus{outline:none;text-decoration:underline}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner svg{margin-inline-end:8px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner span{line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--disabled .uppy-ProviderBrowserItem-inner{cursor:default}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-iconWrap{margin-inline-end:7px;width:20px}.uppy-ProviderBrowserItem-checkbox{cursor:pointer;flex-shrink:0;position:relative}.uppy-ProviderBrowserItem-checkbox:disabled,.uppy-ProviderBrowserItem-checkbox:disabled:after{cursor:default}[data-uppy-theme=dark] .uppy-ProviderBrowserItem-checkbox{background-color:#1f1f1f;border-color:#939393}[data-uppy-theme=dark] .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{background-color:#333}.uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after{border-bottom:2px solid #eaeaea;border-left:2px solid #eaeaea;content:"";cursor:pointer;position:absolute;transform:rotate(-45deg)}.uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{background-color:#eaeaea!important;content:""!important;height:2px!important;left:20%!important;position:absolute!important;right:20%!important;top:50%!important;transform:translateY(-50%)!important}.uppy-SearchProvider{align-items:center;display:flex;flex:1;flex-direction:column;height:100%;justify-content:center;width:100%}[data-uppy-theme=dark] .uppy-SearchProvider{background-color:#1f1f1f}.uppy-SearchProvider-input{margin-bottom:15px;max-width:650px;width:90%}.uppy-size--md .uppy-SearchProvider-input{margin-bottom:20px}.uppy-SearchProvider-input::-webkit-search-cancel-button{display:none}.uppy-SearchProvider-searchButton{padding:13px 25px}.uppy-size--md .uppy-SearchProvider-searchButton{padding:13px 30px}.uppy-DashboardContent-panelBody{align-items:center;display:flex;flex:1;justify-content:center}[data-uppy-theme=dark] .uppy-DashboardContent-panelBody{background-color:#1f1f1f}.uppy-Provider-auth,.uppy-Provider-empty,.uppy-Provider-error,.uppy-Provider-loading{align-items:center;color:#939393;display:flex;flex:1;flex-flow:column wrap;justify-content:center}.uppy-Provider-empty{color:#939393}.uppy-Provider-authIcon svg{height:75px;width:100px}.uppy-Provider-authTitle{color:#757575;font-size:17px;font-weight:400;line-height:1.4;margin-bottom:30px;max-width:500px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Provider-authTitle{font-size:20px}[data-uppy-theme=dark] .uppy-Provider-authTitle{color:#cfcfcf}.uppy-Provider-btn-google{align-items:center;background:#4285f4;display:flex;padding:8px 12px!important}.uppy-Provider-btn-google:hover{background-color:#1266f1}.uppy-Provider-btn-google:focus{box-shadow:0 0 0 3px #4285f466;outline:none}.uppy-Provider-btn-google svg{margin-right:8px}.uppy-Provider-breadcrumbs{color:#525252;flex:1;font-size:12px;margin-bottom:10px;text-align:start}.uppy-size--md .uppy-Provider-breadcrumbs{margin-bottom:0}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs{color:#eaeaea}.uppy-Provider-breadcrumbsIcon{color:#525252;display:inline-block;line-height:1;margin-inline-end:4px;vertical-align:middle}.uppy-Provider-breadcrumbsIcon svg{height:13px;width:13px;fill:#525252}.uppy-Provider-breadcrumbs button{border-radius:3px;display:inline-block;line-height:inherit;padding:4px}.uppy-Provider-breadcrumbs button:focus{outline:none}.uppy-Provider-breadcrumbs button::-moz-focus-inner{border:0}.uppy-Provider-breadcrumbs button:hover{color:#0e51a0}.uppy-Provider-breadcrumbs button:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button:focus{background-color:#333}.uppy-Provider-breadcrumbs button:not(:last-of-type){text-decoration:underline}.uppy-Provider-breadcrumbs button:last-of-type{color:#333;cursor:normal;font-weight:500;pointer-events:none}.uppy-Provider-breadcrumbs button:hover{cursor:pointer}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button{color:#eaeaea}.uppy-ProviderBrowser{display:flex;flex:1;flex-direction:column;font-size:14px;font-weight:400;height:100%}.uppy-ProviderBrowser-user{color:#333;font-weight:500;margin:0 8px 0 0}[data-uppy-theme=dark] .uppy-ProviderBrowser-user{color:#eaeaea}.uppy-ProviderBrowser-user:after{color:#939393;content:"·";font-weight:400;inset-inline-start:4px;position:relative}.uppy-ProviderBrowser-header{border-bottom:1px solid #eaeaea;position:relative;z-index:1001}[data-uppy-theme=dark] .uppy-ProviderBrowser-header{border-bottom:1px solid #333}.uppy-ProviderBrowser-headerBar{background-color:#fafafa;color:#757575;font-size:12px;line-height:1.4;padding:7px 15px;z-index:1001}.uppy-size--md .uppy-ProviderBrowser-headerBar{align-items:center;display:flex}[data-uppy-theme=dark] .uppy-ProviderBrowser-headerBar{background-color:#1f1f1f}.uppy-ProviderBrowser-headerBar--simple{display:block;justify-content:center;text-align:center}.uppy-ProviderBrowser-headerBar--simple .uppy-Provider-breadcrumbsWrap{display:inline-block;flex:none;vertical-align:middle}.uppy-ProviderBrowser-searchFilter{align-items:center;display:flex;height:30px;margin-bottom:15px;margin-top:15px;padding-left:8px;padding-right:8px;position:relative;width:100%}.uppy-ProviderBrowser-searchFilterInput{background-color:#eaeaea;border:0;border-radius:4px;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;font-size:13px;height:30px;line-height:1.4;outline:0;padding-inline-end:30px;padding-inline-start:30px;width:100%;z-index:1001}.uppy-ProviderBrowser-searchFilterInput::-webkit-search-cancel-button{display:none}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput{background-color:#1f1f1f;color:#eaeaea}.uppy-ProviderBrowser-searchFilterInput:focus{background-color:#cfcfcf;border:0}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput:focus{background-color:#333}.uppy-ProviderBrowser-searchFilterIcon{color:#757575;height:12px;inset-inline-start:16px;position:absolute;width:12px;z-index:1002}.uppy-ProviderBrowser-searchFilterInput::-moz-placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterInput::placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterReset{border-radius:3px;color:#939393;cursor:pointer;height:22px;inset-inline-end:16px;padding:6px;position:absolute;width:22px;z-index:1002}.uppy-ProviderBrowser-searchFilterReset:focus{outline:none}.uppy-ProviderBrowser-searchFilterReset::-moz-focus-inner{border:0}.uppy-ProviderBrowser-searchFilterReset:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-searchFilterReset:hover{color:#757575}.uppy-ProviderBrowser-searchFilterReset svg{vertical-align:text-top}.uppy-ProviderBrowser-userLogout{border-radius:3px;color:#1269cf;cursor:pointer;line-height:inherit;padding:4px}.uppy-ProviderBrowser-userLogout:focus{outline:none}.uppy-ProviderBrowser-userLogout::-moz-focus-inner{border:0}.uppy-ProviderBrowser-userLogout:hover{color:#0e51a0}.uppy-ProviderBrowser-userLogout:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout:focus{background-color:#333}.uppy-ProviderBrowser-userLogout:hover{text-decoration:underline}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout{color:#eaeaea}.uppy-ProviderBrowser-body{flex:1;position:relative}.uppy-ProviderBrowser-list{background-color:#fff;border-spacing:0;display:block;flex:1;height:100%;inset:0;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;width:100%;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-ProviderBrowser-list{background-color:#1f1f1f}.uppy-ProviderBrowser-list:focus{outline:none}.uppy-ProviderBrowserItem-inner{cursor:pointer;font-size:13px;font-weight:500}.uppy-ProviderBrowser-footer{align-items:center;background-color:#fff;border-top:1px solid #eaeaea;display:flex;justify-content:space-between;padding:15px}.uppy-ProviderBrowser-footer button{margin-inline-end:8px}[data-uppy-theme=dark] .uppy-ProviderBrowser-footer{background-color:#1f1f1f;border-top:1px solid #333}.uppy-ProviderBrowser-footer-buttons{flex-shrink:0}.uppy-ProviderBrowser-footer-error{color:#e32437;line-height:18px}@media(max-width:426px){.uppy-ProviderBrowser-footer{align-items:stretch;flex-direction:column-reverse}.uppy-ProviderBrowser-footer-error{padding-bottom:10px}}.picker-dialog-bg{z-index:20000!important}.picker-dialog{z-index:20001!important}.uppy-Dashboard-Item-previewInnerWrap{align-items:center;border-radius:3px;box-shadow:0 0 2px #0006;display:flex;flex-direction:column;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.uppy-size--md .uppy-Dashboard-Item-previewInnerWrap{box-shadow:0 1px 2px #00000026}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewInnerWrap{box-shadow:none}.uppy-Dashboard-Item-previewInnerWrap:after{background-color:#000000a6;content:"";display:none;inset:0;position:absolute;z-index:1001}.uppy-Dashboard-Item-previewLink{inset:0;position:absolute;z-index:1002}.uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #579df0}[data-uppy-theme=dark] .uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #016c8d}.uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;height:100%;-o-object-fit:cover;object-fit:cover;transform:translateZ(0);width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{height:auto;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;padding:10px;width:auto}.uppy-Dashboard-Item-progress{color:#fff;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%);transition:all .35 ease;width:120px;z-index:1002}.uppy-Dashboard-Item-progressIndicator{color:#fff;display:inline-block;height:38px;opacity:.9;width:38px}.uppy-size--md .uppy-Dashboard-Item-progressIndicator{height:55px;width:55px}button.uppy-Dashboard-Item-progressIndicator{cursor:pointer}button.uppy-Dashboard-Item-progressIndicator:focus{outline:none}button.uppy-Dashboard-Item-progressIndicator::-moz-focus-inner{border:0}button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--bg,button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--retry{fill:#579df0}.uppy-Dashboard-Item-progressIcon--circle{height:100%;width:100%}.uppy-Dashboard-Item-progressIcon--bg{stroke:#fff6}.uppy-Dashboard-Item-progressIcon--progress{transition:stroke-dashoffset .5s ease-out;stroke:#fff}.uppy-Dashboard-Item-progressIcon--play{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--cancel{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--pause{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--check{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--retry{fill:#fff}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{inset-inline-end:-8px;inset-inline-start:auto;top:-9px;transform:none;width:auto}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:18px;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:28px;width:28px}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:18px;opacity:1;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:22px;width:22px}.uppy-Dashboard-Item.is-processing .uppy-Dashboard-Item-progress{opacity:0}.uppy-Dashboard-Item-fileInfo{padding-inline-end:5px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:10px}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:15px}.uppy-Dashboard-Item-name{font-size:12px;font-weight:500;line-height:1.3;margin-bottom:5px;word-wrap:anywhere;word-break:break-all}[data-uppy-theme=dark] .uppy-Dashboard-Item-name{color:#eaeaea}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-name{font-size:14px;line-height:1.4}.uppy-Dashboard-Item-fileName{align-items:baseline;display:flex}.uppy-Dashboard-Item-fileName button{margin-left:5px}.uppy-Dashboard-Item-author{color:#757575;display:inline-block;font-size:11px;font-weight:400;line-height:1;margin-bottom:5px;vertical-align:bottom}.uppy-Dashboard-Item-author a{color:#757575}.uppy-Dashboard-Item-status{color:#757575;font-size:11px;font-weight:400;line-height:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-status{color:#bbb}.uppy-Dashboard-Item-statusSize{display:inline-block;margin-bottom:5px;text-transform:uppercase;vertical-align:bottom}.uppy-Dashboard-Item-reSelect{color:#1269cf;font-family:inherit;font-size:inherit;font-weight:600}.uppy-Dashboard-Item-errorMessage{background-color:#fdeff1;color:#a51523;font-size:11px;font-weight:500;line-height:1.3;padding:5px 6px}.uppy-Dashboard-Item-errorMessageBtn{color:#a51523;cursor:pointer;font-size:11px;font-weight:500;text-decoration:underline}.uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{display:none}.uppy-size--md .uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-top:1px solid #f7c2c8;bottom:0;display:block;left:0;line-height:1.4;padding:6px 8px;position:absolute;right:0}.uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{border:1px solid #f7c2c8;border-radius:3px;display:inline-block;position:static}.uppy-size--md .uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{display:none}.uppy-Dashboard-Item-action{color:#939393;cursor:pointer}.uppy-Dashboard-Item-action:focus{outline:none}.uppy-Dashboard-Item-action::-moz-focus-inner{border:0}.uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-Item-action:hover{color:#1f1f1f;opacity:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-action{color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{outline:none}[data-uppy-theme=dark] .uppy-Dashboard-Item-action::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:hover{color:#eaeaea}.uppy-Dashboard-Item-action--remove{color:#1f1f1f;opacity:.95}.uppy-Dashboard-Item-action--remove:hover{color:#000;opacity:1}.uppy-size--md .uppy-Dashboard-Item-action--remove{height:18px;inset-inline-end:-8px;padding:0;position:absolute;top:-8px;width:18px;z-index:1002}.uppy-size--md .uppy-Dashboard-Item-action--remove:focus{border-radius:50%}.uppy-Dashboard--singleFile.uppy-size--height-md .uppy-Dashboard-Item-action--remove{inset-inline-end:8px;position:absolute;top:8px}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove{color:#525252}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove:hover{color:#333}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-actionWrapper{align-items:center;display:flex}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action{height:22px;margin-left:3px;padding:3px;width:22px}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action:focus{border-radius:3px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink,.uppy-size--md .uppy-Dashboard-Item-action--edit{height:16px;padding:0;width:16px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink:focus,.uppy-size--md .uppy-Dashboard-Item-action--edit:focus{border-radius:3px}.uppy-Dashboard-Item{align-items:center;border-bottom:1px solid #eaeaea;display:flex;padding:10px}.uppy-Dashboard:not(.uppy-Dashboard--singleFile) .uppy-Dashboard-Item{padding-inline-end:0}[data-uppy-theme=dark] .uppy-Dashboard-Item{border-bottom:1px solid #333}.uppy-size--md .uppy-Dashboard-Item{border-bottom:0;display:block;float:inline-start;height:215px;margin:5px 15px;padding:0;position:relative;width:calc(33.333% - 30px)}.uppy-size--lg .uppy-Dashboard-Item{height:190px;margin:5px 15px;padding:0;width:calc(25% - 30px)}.uppy-size--xl .uppy-Dashboard-Item{height:210px;padding:0;width:calc(20% - 30px)}.uppy-Dashboard--singleFile .uppy-Dashboard-Item{border-bottom:0;display:flex;flex-direction:column;height:100%;max-width:400px;padding:15px;position:relative;width:100%}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-previewInnerWrap{opacity:.2}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-name{opacity:.7}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='35' height='39' viewBox='0 0 35 39'%3E%3Cpath fill='%2523000' d='M1.708 38.66c1.709 0 3.417-3.417 6.834-3.417s5.125 3.417 8.61 3.417c3.348 0 5.056-3.417 8.473-3.417 4.305 0 5.125 3.417 6.833 3.417.889 0 1.709-.889 1.709-1.709v-19.68C34.167-5.757 0-5.757 0 17.271v19.68c0 .82.888 1.709 1.708 1.709m8.542-17.084a3.383 3.383 0 0 1-3.417-3.416 3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.417 3.417 3.383 3.383 0 0 1-3.417 3.416m13.667 0A3.383 3.383 0 0 1 20.5 18.16a3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.416 3.417 3.383 3.383 0 0 1-3.416 3.416'/%3E%3C/svg%3E");background-position:50% 10px;background-repeat:no-repeat;background-size:25px;content:"";inset:0;opacity:.5;position:absolute;z-index:1005}.uppy-size--md .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:40px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:30%}.uppy-Dashboard-Item-preview{flex-grow:0;flex-shrink:0;height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-Item-preview{height:140px;width:100%}.uppy-size--lg .uppy-Dashboard-Item-preview{height:120px}.uppy-size--xl .uppy-Dashboard-Item-preview{height:140px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview{flex-grow:1;max-height:75%;width:100%}.uppy-Dashboard--singleFile.uppy-size--md .uppy-Dashboard-Item-preview{max-height:100%}.uppy-Dashboard-Item-fileInfoAndButtons{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-inline-end:8px;padding-inline-start:12px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons,.uppy-size--md .uppy-Dashboard-Item-fileInfoAndButtons{align-items:flex-start;padding:9px 0 0}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons{flex-grow:0;width:100%}.uppy-Dashboard-Item-fileInfo{flex-grow:1;flex-shrink:1}.uppy-Dashboard-Item-actionWrapper{flex-grow:0;flex-shrink:0}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-previewInnerWrap:after,.uppy-Dashboard-Item.is-inprogress .uppy-Dashboard-Item-previewInnerWrap:after{display:block}.uppy-Dashboard-Item-errorDetails{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border:none;border-radius:50%;color:#fff;cursor:help;flex-shrink:0;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;width:13px}.uppy-Dashboard-Item-errorDetails:after{line-height:1.3;word-wrap:break-word}.uppy-Dashboard-FileCard{background-color:#fff;border-radius:5px;box-shadow:0 0 10px 4px #0000001a;display:flex;flex-direction:column;height:100%;inset:0;position:absolute;width:100%;z-index:1005}.uppy-Dashboard-FileCard .uppy-DashboardContent-bar{border-top-left-radius:5px;border-top-right-radius:5px}.uppy-Dashboard-FileCard .uppy-Dashboard-FileCard-actions{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.uppy-Dashboard-FileCard-inner{display:flex;flex-direction:column;flex-grow:1;flex-shrink:1;height:100%;min-height:0}.uppy-Dashboard-FileCard-preview{align-items:center;border-bottom:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:1;height:60%;justify-content:center;min-height:0;position:relative}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-preview{background-color:#333;border-bottom:0}.uppy-Dashboard-FileCard-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;box-shadow:0 3px 20px #00000026;flex:0 0 auto;max-height:90%;max-width:90%;-o-object-fit:cover;object-fit:cover}.uppy-Dashboard-FileCard-edit{background-color:#00000080;border-radius:50px;color:#fff;font-size:13px;inset-inline-end:10px;padding:7px 15px;position:absolute;top:10px}.uppy-Dashboard-FileCard-edit:focus{outline:none}.uppy-Dashboard-FileCard-edit::-moz-focus-inner{border:0}.uppy-Dashboard-FileCard-edit:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-FileCard-edit:hover{background-color:#000c}.uppy-Dashboard-FileCard-info{flex-grow:0;flex-shrink:0;height:40%;overflow-y:auto;padding:30px 20px 20px;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-info{background-color:#1f1f1f}.uppy-Dashboard-FileCard-fieldset{border:0;font-size:0;margin:auto auto 12px;max-width:640px;padding:0}.uppy-Dashboard-FileCard-label{color:#525252;display:inline-block;font-size:12px;vertical-align:middle;width:22%}.uppy-size--md .uppy-Dashboard-FileCard-label{font-size:14px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-label{color:#eaeaea}.uppy-Dashboard-FileCard-input{display:inline-block;vertical-align:middle;width:78%}.uppy-Dashboard-FileCard-actions{align-items:center;background-color:#fafafa;border-top:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:0;height:55px;padding:0 15px}.uppy-size--md .uppy-Dashboard-FileCard-actions{height:65px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-actions{background-color:#1f1f1f;border-top:1px solid #333}.uppy-Dashboard-FileCard-actionsBtn{margin-inline-end:10px}.uppy-Informer{bottom:60px;left:0;position:absolute;right:0;text-align:center;z-index:1005}.uppy-Informer span>div{margin-bottom:6px}.uppy-Informer-animated{opacity:0;transform:translateY(350%);transition:all .3s ease-in;z-index:-1000}.uppy-Informer p{background-color:#757575;border-radius:18px;color:#fff;display:inline-block;font-size:12px;font-weight:400;line-height:1.4;margin:0;max-width:90%;padding:6px 15px}.uppy-size--md .uppy-Informer p{font-size:14px;line-height:1.3;max-width:500px;padding:10px 20px}[data-uppy-theme=dark] .uppy-Informer p{background-color:#333}.uppy-Informer p span{background-color:#fff;border-radius:50%;color:#525252;display:inline-block;font-size:10px;height:13px;inset-inline-start:3px;line-height:12px;margin-inline-start:-1px;position:relative;top:-1px;vertical-align:middle;width:13px}.uppy-Informer p span:hover{cursor:help}.uppy-Informer p span:after{line-height:1.3;word-wrap:break-word}.uppy-Root [aria-label][role~=tooltip]{position:relative}.uppy-Root [aria-label][role~=tooltip]:after,.uppy-Root [aria-label][role~=tooltip]:before{backface-visibility:hidden;box-sizing:border-box;opacity:0;pointer-events:none;position:absolute;transform:translateZ(0);transform-origin:top;transition:all var(--microtip-transition-duration,.18s) var(--microtip-transition-easing,ease-in-out) var(--microtip-transition-delay,0s);will-change:transform;z-index:10}.uppy-Root [aria-label][role~=tooltip]:before{background-size:100% auto!important;content:""}.uppy-Root [aria-label][role~=tooltip]:after{background:#111111e6;border-radius:4px;box-sizing:initial;color:#fff;content:attr(aria-label);font-size:var(--microtip-font-size,13px);font-weight:var(--microtip-font-weight,normal);padding:.5em 1em;text-transform:var(--microtip-text-transform,none);white-space:nowrap}.uppy-Root [aria-label][role~=tooltip]:focus:after,.uppy-Root [aria-label][role~=tooltip]:focus:before,.uppy-Root [aria-label][role~=tooltip]:hover:after,.uppy-Root [aria-label][role~=tooltip]:hover:before{opacity:1;pointer-events:auto}.uppy-Root [role~=tooltip][data-microtip-position|=top]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M2.658 0h32.004c-6 0-11.627 12.002-16.002 12.002S8.594 0 2.658 0'/%3E%3C/svg%3E") no-repeat;bottom:100%;height:6px;left:50%;margin-bottom:5px;transform:translate3d(-50%,0,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=top]:after{bottom:100%;left:50%;margin-bottom:11px;transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=top]:hover:before{transform:translate3d(-50%,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:after{bottom:100%;transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:hover:after{transform:translate3d(calc(-100% + 16px),-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:after{bottom:100%;transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:hover:after{transform:translate3d(-16px,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M33.342 12H1.338c6 0 11.627-12.002 16.002-12.002S27.406 12 33.342 12'/%3E%3C/svg%3E") no-repeat;bottom:auto;height:6px;left:50%;margin-bottom:0;margin-top:5px;top:100%;transform:translate3d(-50%,-10px,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:after{left:50%;margin-top:11px;top:100%;transform:translate3d(-50%,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:hover:before{transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:after{top:100%;transform:translate3d(calc(-100% + 16px),-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:hover:after{transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:after{top:100%;transform:translate3d(-16px,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:hover:after{transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:before{inset:50% 100% auto auto;transform:translate3d(10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M0 33.342V1.338c0 6 12.002 11.627 12.002 16.002S0 27.406 0 33.342'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-right:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=left]:after{margin-right:11px}.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:before{bottom:auto;left:100%;top:50%;transform:translate3d(-10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M12 2.658v32.004c0-6-12.002-11.627-12.002-16.002S12 8.594 12 2.658'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-left:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=right]:after{margin-left:11px}.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-size=small]:after{white-space:normal;width:80px}.uppy-Root [role~=tooltip][data-microtip-size=medium]:after{white-space:normal;width:150px}.uppy-Root [role~=tooltip][data-microtip-size=large]:after{white-space:normal;width:260px}.uppy-StatusBar{background-color:#fff;color:#fff;display:flex;font-size:12px;font-weight:400;height:46px;line-height:40px;position:relative;transition:height .2s;z-index:1001}[data-uppy-theme=dark] .uppy-StatusBar{background-color:#1f1f1f}.uppy-StatusBar:before{background-color:#eaeaea;content:"";height:2px;inset:0;position:absolute;width:100%}[data-uppy-theme=dark] .uppy-StatusBar:before{background-color:#757575}.uppy-StatusBar[aria-hidden=true]{height:0;overflow-y:hidden}.uppy-StatusBar.is-complete .uppy-StatusBar-progress{background-color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-progress{background-color:#e32437}.uppy-StatusBar.is-complete .uppy-StatusBar-statusIndicator{color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-statusIndicator{color:#e32437}.uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#fff;border-top:1px solid #eaeaea;height:65px}[data-uppy-theme=dark] .uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#1f1f1f;border-top:1px solid #333}.uppy-StatusBar-progress{background-color:#1269cf;height:2px;position:absolute;transition:background-color,width .3s ease-out;z-index:1001}.uppy-StatusBar-progress.is-indeterminate{animation:uppy-StatusBar-ProgressStripes 1s linear infinite;background-image:linear-gradient(45deg,#0000004d 25%,#0000 0 50%,#0000004d 0 75%,#0000 0,#0000);background-size:64px 64px}@keyframes uppy-StatusBar-ProgressStripes{0%{background-position:0 0}to{background-position:64px 0}}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-progress,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-progress{background-color:#f6a623}.uppy-StatusBar.is-waiting .uppy-StatusBar-progress{display:none}.uppy-StatusBar-content{align-items:center;color:#333;display:flex;height:100%;padding-inline-start:10px;position:relative;text-overflow:ellipsis;white-space:nowrap;z-index:1002}.uppy-size--md .uppy-StatusBar-content{padding-inline-start:15px}[data-uppy-theme=dark] .uppy-StatusBar-content{color:#eaeaea}.uppy-StatusBar-status{display:flex;flex-direction:column;font-weight:400;justify-content:center;line-height:1.4;padding-inline-end:.3em}.uppy-StatusBar-statusPrimary{display:flex;font-weight:500;line-height:1}.uppy-StatusBar-statusPrimary button.uppy-StatusBar-details{margin-left:5px}[data-uppy-theme=dark] .uppy-StatusBar-statusPrimary{color:#eaeaea}.uppy-StatusBar-statusSecondary{color:#757575;display:inline-block;font-size:11px;line-height:1.2;margin-top:1px;white-space:nowrap}[data-uppy-theme=dark] .uppy-StatusBar-statusSecondary{color:#bbb}.uppy-StatusBar-statusSecondaryHint{display:inline-block;line-height:1;margin-inline-end:5px;vertical-align:middle}.uppy-size--md .uppy-StatusBar-statusSecondaryHint{margin-inline-end:8px}.uppy-StatusBar-statusIndicator{color:#525252;margin-inline-end:7px;position:relative;top:1px}.uppy-StatusBar-statusIndicator svg{vertical-align:text-bottom}.uppy-StatusBar-actions{align-items:center;bottom:0;display:flex;inset-inline-end:10px;position:absolute;top:0;z-index:1004}.uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#fafafa;height:100%;padding:0 15px;position:static;width:100%}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#1f1f1f}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:column;height:90px}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:row;height:65px}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:column;justify-content:center}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:row;justify-content:normal}.uppy-StatusBar-actionCircleBtn{cursor:pointer;line-height:1;margin:3px;opacity:.9}.uppy-StatusBar-actionCircleBtn:focus{outline:none}.uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}.uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionCircleBtn:hover{opacity:1}.uppy-StatusBar-actionCircleBtn:focus{border-radius:50%}.uppy-StatusBar-actionCircleBtn svg{vertical-align:bottom}.uppy-StatusBar-actionBtn{color:#1269cf;display:inline-block;font-size:10px;line-height:inherit;vertical-align:middle}.uppy-size--md .uppy-StatusBar-actionBtn{font-size:11px}.uppy-StatusBar-actionBtn--disabled{opacity:.4}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--disabled{opacity:.7}.uppy-StatusBar-actionBtn--retry{background-color:#ff4b23;border-radius:8px;color:#fff;height:16px;line-height:1;margin-inline-end:6px;padding:1px 6px 3px 18px;position:relative}.uppy-StatusBar-actionBtn--retry:focus{outline:none}.uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionBtn--retry:hover{background-color:#f92d00}.uppy-StatusBar-actionBtn--retry svg{inset-inline-start:6px;position:absolute;top:3px}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1bb240;color:#fff;font-size:14px;line-height:1;padding:15px 10px;width:100%}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#189c38}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1c8b37}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#18762f}.uppy-size--md .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{padding:13px 22px;width:auto}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1bb240;cursor:not-allowed}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1c8b37}.uppy-StatusBar:not(.is-waiting) .uppy-StatusBar-actionBtn--upload{background-color:initial;color:#1269cf}.uppy-StatusBar-actionBtn--uploadNewlyAdded{border-radius:3px;padding-inline-end:3px;padding-bottom:1px;padding-inline-start:3px}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}.uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded{display:none}.uppy-StatusBar-actionBtn--done{border-radius:3px;line-height:1;padding:7px 8px}.uppy-StatusBar-actionBtn--done:focus{outline:none}.uppy-StatusBar-actionBtn--done::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--done:hover{color:#0e51a0}.uppy-StatusBar-actionBtn--done:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done:focus{background-color:#333}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done{color:#02baf2}.uppy-size--md .uppy-StatusBar-actionBtn--done{font-size:14px}.uppy-StatusBar-serviceMsg{color:#000;font-size:11px;line-height:1.1;padding-left:10px}.uppy-size--md .uppy-StatusBar-serviceMsg{font-size:14px;padding-left:15px}[data-uppy-theme=dark] .uppy-StatusBar-serviceMsg{color:#eaeaea}.uppy-StatusBar-serviceMsg-ghostsIcon{left:6px;opacity:.5;position:relative;top:2px;vertical-align:text-bottom;width:10px}.uppy-size--md .uppy-StatusBar-serviceMsg-ghostsIcon{left:10px;top:1px;width:15px}.uppy-StatusBar-details{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border-radius:50%;color:#fff;cursor:help;display:inline-block;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;vertical-align:middle;width:13px}.uppy-StatusBar-details:after{line-height:1.3;word-wrap:break-word}.uppy-StatusBar-spinner{animation-duration:1s;animation-iteration-count:infinite;animation-name:uppy-StatusBar-spinnerAnimation;animation-timing-function:linear;fill:#1269cf;margin-inline-end:10px}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-spinner,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-spinner{fill:#f6a623}@keyframes uppy-StatusBar-spinnerAnimation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.uppy-transition-slideDownUp-enter{opacity:.01;transform:translate3d(0,-105%,0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-enter.uppy-transition-slideDownUp-enter-active{opacity:1;transform:translateZ(0)}.uppy-transition-slideDownUp-leave{opacity:1;transform:translateZ(0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-leave.uppy-transition-slideDownUp-leave-active{opacity:.01;transform:translate3d(0,-105%,0)}@keyframes uppy-Dashboard-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes uppy-Dashboard-fadeOut{0%{opacity:1}to{opacity:0}}@keyframes uppy-Dashboard-slideDownAndFadeIn{0%{opacity:0;transform:translate3d(-50%,-70%,0)}to{opacity:1;transform:translate3d(-50%,-50%,0)}}@keyframes uppy-Dashboard-slideDownAndFadeIn--small{0%{opacity:0;transform:translate3d(0,-20%,0)}to{opacity:1;transform:translateZ(0)}}@keyframes uppy-Dashboard-slideUpFadeOut{0%{opacity:1;transform:translate3d(-50%,-50%,0)}to{opacity:0;transform:translate3d(-50%,-70%,0)}}@keyframes uppy-Dashboard-slideUpFadeOut--small{0%{opacity:1;transform:translateZ(0)}to{opacity:0;transform:translate3d(0,-20%,0)}}.uppy-Dashboard--modal{z-index:1001}.uppy-Dashboard--modal[aria-hidden=true]{display:none}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeIn .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeOut .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard-isFixed{height:100vh;overflow:hidden}.uppy-Dashboard--modal .uppy-Dashboard-overlay{background-color:#00000080;inset:0;position:fixed;z-index:1001}.uppy-Dashboard-inner{background-color:#f4f4f4;border:1px solid #eaeaea;border-radius:5px;max-height:100%;max-width:100%;outline:none;position:relative}.uppy-size--md .uppy-Dashboard-inner{min-height:auto}@media only screen and (min-width:820px){.uppy-Dashboard-inner{height:500px;width:650px}}.uppy-Dashboard--modal .uppy-Dashboard-inner{z-index:1002}[data-uppy-theme=dark] .uppy-Dashboard-inner{background-color:#1f1f1f}.uppy-Dashboard--isDisabled .uppy-Dashboard-inner{cursor:not-allowed}.uppy-Dashboard-innerWrap{border-radius:5px;display:flex;flex-direction:column;height:100%;opacity:0;overflow:hidden;position:relative}.uppy-Dashboard--isInnerWrapVisible .uppy-Dashboard-innerWrap{opacity:1}.uppy-Dashboard--isDisabled .uppy-Dashboard-innerWrap{cursor:not-allowed;filter:grayscale(100%);opacity:.6;-webkit-user-select:none;-moz-user-select:none;user-select:none}.uppy-Dashboard--isDisabled .uppy-ProviderIconBg{fill:#9f9f9f}.uppy-Dashboard--isDisabled [aria-disabled],.uppy-Dashboard--isDisabled [disabled]{cursor:not-allowed;pointer-events:none}.uppy-Dashboard--modal .uppy-Dashboard-inner{border:none;inset:35px 15px 15px;position:fixed}@media only screen and (min-width:820px){.uppy-Dashboard--modal .uppy-Dashboard-inner{box-shadow:0 5px 15px 4px #00000026;left:50%;right:auto;top:50%;transform:translate(-50%,-50%)}}.uppy-Dashboard-close{color:#ffffffe6;cursor:pointer;display:block;font-size:27px;inset-inline-end:-2px;position:absolute;top:-33px;z-index:1005}.uppy-Dashboard-close:focus{outline:none}.uppy-Dashboard-close::-moz-focus-inner{border:0}.uppy-Dashboard-close:focus{color:#6eabf2}@media only screen and (min-width:820px){.uppy-Dashboard-close{font-size:35px;inset-inline-end:-35px;top:-10px}}.uppy-Dashboard-serviceMsg{background-color:#fffbf7;border-bottom:1px solid #edd4b9;border-top:1px solid #edd4b9;font-size:12px;font-weight:500;line-height:1.3;padding:12px 0;position:relative;top:-1px;z-index:1004}.uppy-size--md .uppy-Dashboard-serviceMsg{font-size:14px;line-height:1.4}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg{background-color:#1f1f1f;border-bottom:1px solid #333;border-top:1px solid #333;color:#eaeaea}.uppy-Dashboard-serviceMsg-title{display:block;line-height:1;margin-bottom:4px;padding-left:42px}.uppy-Dashboard-serviceMsg-text{padding:0 15px}.uppy-Dashboard-serviceMsg-actionBtn{color:#1269cf;font-size:inherit;font-weight:inherit;vertical-align:initial}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg-actionBtn{color:#02baf2e6}.uppy-Dashboard-serviceMsg-icon{left:15px;position:absolute;top:10px}.uppy-Dashboard-AddFiles{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;position:relative;text-align:center}[data-uppy-drag-drop-supported=true] .uppy-Dashboard-AddFiles{border:1px dashed #dfdfdf;border-radius:3px;height:calc(100% - 14px);margin:7px}.uppy-Dashboard-AddFilesPanel .uppy-Dashboard-AddFiles{border:none;height:calc(100% - 54px)}.uppy-Dashboard--modal .uppy-Dashboard-AddFiles{border-color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles{border-color:#757575}.uppy-Dashboard-AddFiles-info{display:none;margin-top:auto;padding-bottom:15px;padding-top:15px}.uppy-size--height-md .uppy-Dashboard-AddFiles-info{display:block}.uppy-size--md .uppy-Dashboard-AddFiles-info{bottom:25px;left:0;padding-bottom:0;padding-top:30px;position:absolute;right:0}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-info{margin-top:0}.uppy-Dashboard-browse{color:#1269cf;cursor:pointer}.uppy-Dashboard-browse:focus{outline:none}.uppy-Dashboard-browse::-moz-focus-inner{border:0}.uppy-Dashboard-browse:focus,.uppy-Dashboard-browse:hover{border-bottom:1px solid #1269cf}[data-uppy-theme=dark] .uppy-Dashboard-browse{color:#02baf2e6}[data-uppy-theme=dark] .uppy-Dashboard-browse:focus,[data-uppy-theme=dark] .uppy-Dashboard-browse:hover{border-bottom:1px solid #02baf2}.uppy-Dashboard-browseBtn{display:block;font-size:14px;font-weight:500;margin-bottom:5px;margin-top:8px;width:100%}.uppy-size--md .uppy-Dashboard-browseBtn{font-size:15px;margin:15px auto;padding:13px 44px;width:auto}.uppy-Dashboard-AddFiles-list{display:flex;flex:1;flex-direction:column;margin-top:2px;overflow-y:auto;padding:2px 0;width:100%;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-AddFiles-list{flex:none;flex-direction:row;flex-wrap:wrap;justify-content:center;margin-top:15px;max-width:600px;overflow-y:visible;padding-top:0}.uppy-DashboardTab{border-bottom:1px solid #eaeaea;text-align:center;width:100%}[data-uppy-theme=dark] .uppy-DashboardTab{border-bottom:1px solid #333}.uppy-size--md .uppy-DashboardTab{border-bottom:none;display:inline-block;margin-bottom:10px;width:auto}.uppy-DashboardTab-btn{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:initial;color:#525252;cursor:pointer;flex-direction:row;height:100%;justify-content:left;padding:12px 15px;width:100%}.uppy-DashboardTab-btn:focus{outline:none}.uppy-size--md .uppy-DashboardTab-btn{border-radius:5px;flex-direction:column;margin-inline-end:1px;padding:10px 3px;width:86px}[data-uppy-theme=dark] .uppy-DashboardTab-btn{color:#eaeaea}.uppy-DashboardTab-btn::-moz-focus-inner{border:0}.uppy-DashboardTab-btn:hover{background-color:#e9ecef}[data-uppy-theme=dark] .uppy-DashboardTab-btn:hover{background-color:#333}.uppy-DashboardTab-btn:active,.uppy-DashboardTab-btn:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardTab-btn:active,[data-uppy-theme=dark] .uppy-DashboardTab-btn:focus{background-color:#525252}.uppy-DashboardTab-btn svg{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;transition:transform .15s ease-in-out;vertical-align:text-top}.uppy-DashboardTab-inner{align-items:center;background-color:#fff;border-radius:8px;box-shadow:0 1px 1px #0000001a,0 1px 2px #0000001a,0 2px 3px #00000005;display:flex;height:32px;justify-content:center;margin-inline-end:10px;width:32px}.uppy-size--md .uppy-DashboardTab-inner{margin-inline-end:0}[data-uppy-theme=dark] .uppy-DashboardTab-inner{background-color:#323232;box-shadow:0 1px 1px #0003,0 1px 2px #0003,0 2px 3px #00000014}.uppy-DashboardTab-name{font-size:14px;font-weight:400}.uppy-size--md .uppy-DashboardTab-name{font-size:12px;line-height:15px;margin-bottom:0;margin-top:8px}.uppy-DashboardTab-iconMyDevice{color:#1269cf}[data-uppy-theme=dark] .uppy-DashboardTab-iconMyDevice{color:#02baf2}.uppy-DashboardTab-iconBox{color:#0061d5}[data-uppy-theme=dark] .uppy-DashboardTab-iconBox{color:#eaeaea}.uppy-DashboardTab-iconDropbox{color:#0061fe}[data-uppy-theme=dark] .uppy-DashboardTab-iconDropbox{color:#eaeaea}.uppy-DashboardTab-iconUnsplash{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconUnsplash{color:#eaeaea}.uppy-DashboardTab-iconWebdav{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconWebdav{color:#eaeaea}.uppy-DashboardTab-iconScreenRec{color:#2c3e50}[data-uppy-theme=dark] .uppy-DashboardTab-iconScreenRec{color:#eaeaea}.uppy-DashboardTab-iconAudio{color:#8030a3}[data-uppy-theme=dark] .uppy-DashboardTab-iconAudio{color:#bf6ee3}.uppy-Dashboard-input{height:.1px;opacity:0;overflow:hidden;position:absolute;width:.1px;z-index:-1}.uppy-DashboardContent-bar{align-items:center;background-color:#fafafa;border-bottom:1px solid #eaeaea;display:flex;flex-shrink:0;height:40px;justify-content:space-between;padding:0 10px;position:relative;width:100%;z-index:1004}.uppy-size--md .uppy-DashboardContent-bar{height:50px;padding:0 15px}[data-uppy-theme=dark] .uppy-DashboardContent-bar{background-color:#1f1f1f;border-bottom:1px solid #333}.uppy-DashboardContent-title{font-size:12px;font-weight:500;left:0;line-height:40px;margin:auto;max-width:170px;overflow-x:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0;white-space:nowrap;width:100%}.uppy-size--md .uppy-DashboardContent-title{font-size:14px;line-height:50px;max-width:300px}[data-uppy-theme=dark] .uppy-DashboardContent-title{color:#eaeaea}.uppy-DashboardContent-back,.uppy-DashboardContent-save{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-size:12px;font-weight:400;line-height:1;margin:0;margin-inline-start:-6px;padding:7px 6px}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{outline:none}.uppy-DashboardContent-back::-moz-focus-inner,.uppy-DashboardContent-save::-moz-focus-inner{border:0}.uppy-DashboardContent-back:hover,.uppy-DashboardContent-save:hover{color:#0e51a0}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-back:focus,[data-uppy-theme=dark] .uppy-DashboardContent-save:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-back,.uppy-size--md .uppy-DashboardContent-save{font-size:14px}[data-uppy-theme=dark] .uppy-DashboardContent-back,[data-uppy-theme=dark] .uppy-DashboardContent-save{color:#02baf2}.uppy-DashboardContent-addMore{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:500;height:29px;line-height:1;margin:0;margin-inline-end:-5px;padding:7px 8px;width:29px}.uppy-DashboardContent-addMore:focus{outline:none}.uppy-DashboardContent-addMore::-moz-focus-inner{border:0}.uppy-DashboardContent-addMore:hover{color:#0e51a0}.uppy-DashboardContent-addMore:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-addMore:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-addMore{font-size:14px;height:auto;margin-inline-end:-8px;width:auto}[data-uppy-theme=dark] .uppy-DashboardContent-addMore{color:#02baf2}.uppy-DashboardContent-addMore svg{margin-inline-end:4px;vertical-align:initial}.uppy-size--md .uppy-DashboardContent-addMore svg{height:11px;width:11px}.uppy-DashboardContent-addMoreCaption{display:none}.uppy-size--md .uppy-DashboardContent-addMoreCaption{display:inline}.uppy-DashboardContent-panel{background-color:#f5f5f5;flex:1}.uppy-Dashboard-AddFilesPanel,.uppy-DashboardContent-panel{border-radius:5px;display:flex;flex-direction:column;inset:0;overflow:hidden;position:absolute;z-index:1005}.uppy-Dashboard-AddFilesPanel{background:#fafafa;background:linear-gradient(0deg,#fafafa 35%,#fafafad9);box-shadow:0 0 10px 5px #00000026}[data-uppy-theme=dark] .uppy-Dashboard-AddFilesPanel{background-color:#333;background-image:linear-gradient(0deg,#1f1f1f 35%,#1f1f1fd9)}.uppy-Dashboard--isAddFilesPanelVisible .uppy-Dashboard-files{filter:blur(2px)}.uppy-Dashboard-progress{bottom:0;height:12%;left:0;position:absolute;width:100%}.uppy-Dashboard-progressBarContainer.is-active{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1004}.uppy-Dashboard-filesContainer{flex:1;margin:0;overflow-y:hidden;position:relative}.uppy-Dashboard-filesContainer:after{clear:both;content:"";display:table}.uppy-Dashboard-files{flex:1;margin:0;overflow-y:auto;padding:0 0 10px;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-files{padding-top:10px}.uppy-Dashboard--singleFile .uppy-Dashboard-filesInner{align-items:center;display:flex;height:100%;justify-content:center}.uppy-Dashboard-dropFilesHereHint{align-items:center;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%231269CF' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;border:1px dashed #1269cf;border-radius:3px;color:#757575;display:flex;font-size:16px;justify-content:center;inset:7px;padding-top:90px;position:absolute;text-align:center;visibility:hidden;z-index:2000}[data-uppy-theme=dark] .uppy-Dashboard-dropFilesHereHint{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%2302BAF2' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");border-color:#02baf2;color:#bbb}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-dropFilesHereHint{pointer-events:none;visibility:visible}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-files,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-progressindicators,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-serviceMsg,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-DashboardContent-bar{opacity:.15}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-AddFiles{opacity:.03}.uppy-Dashboard-AddFiles-title{color:#000;font-size:17px;font-weight:500;line-height:1.35;margin-bottom:5px;margin-top:15px;padding:0 15px;text-align:inline-start;width:100%}.uppy-size--md .uppy-Dashboard-AddFiles-title{font-size:21px;font-weight:400;margin-top:5px;max-width:480px;padding:0 35px;text-align:center}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-title{text-align:center}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title{color:#eaeaea}.uppy-Dashboard-AddFiles-title button{font-weight:500}.uppy-size--md .uppy-Dashboard-AddFiles-title button{font-weight:400}.uppy-Dashboard-note{color:#757575;font-size:14px;line-height:1.25;margin:auto;max-width:350px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Dashboard-note{line-height:1.35;max-width:600px}[data-uppy-theme=dark] .uppy-Dashboard-note{color:#cfcfcf}a.uppy-Dashboard-poweredBy{color:#939393;display:inline-block;font-size:11px;margin-top:8px;text-align:center;text-decoration:none}.uppy-Dashboard-poweredByIcon{margin-left:1px;margin-right:1px;opacity:.9;position:relative;top:1px;vertical-align:text-top;fill:none;stroke:#939393}.uppy-Dashboard-Item-previewIcon{height:25px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:25px;z-index:100}.uppy-size--md .uppy-Dashboard-Item-previewIcon{height:38px;width:38px}.uppy-Dashboard-Item-previewIcon svg{height:100%;width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIcon{height:100%;max-height:60%;max-width:60%;width:100%}.uppy-Dashboard-Item-previewIconWrap{height:76px;max-height:75%;position:relative}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIconWrap{height:100%;width:100%}.uppy-Dashboard-Item-previewIconBg{filter:drop-shadow(rgba(0,0,0,.1) 0 1px 1px);height:100%;width:100%}.uppy-Dashboard-upload{height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-upload{height:60px;width:60px}.uppy-Dashboard-upload .uppy-c-icon{position:relative;top:1px;width:50%}.uppy-Dashboard-uploadCount{background-color:#1bb240;border-radius:50%;color:#fff;font-size:8px;height:16px;inset-inline-end:-12px;line-height:16px;position:absolute;top:-12px;width:16px}.uppy-size--md .uppy-Dashboard-uploadCount{font-size:9px;height:18px;line-height:18px;width:18px}.uppy-Dashboard-inner{border:none!important;background:transparent!important}.uppy-Dashboard-innerWrap{border-radius:.5rem;overflow:hidden}.uppy-Dashboard-AddFiles{border:2px dashed hsl(var(--border))!important;border-radius:.5rem!important;background:hsl(var(--muted) / .3)!important;transition:all .2s ease}.uppy-Dashboard-AddFiles:hover{border-color:hsl(var(--primary))!important;background:hsl(var(--muted) / .5)!important}.uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important;font-weight:500!important}.uppy-Dashboard-AddFiles-info{color:hsl(var(--muted-foreground))!important}.uppy-Dashboard-browse{color:hsl(var(--primary))!important;font-weight:500!important}.uppy-Dashboard-browse:hover{text-decoration:underline!important}.uppy-Dashboard-files{background:transparent!important}.uppy-Dashboard-Item{border-bottom-color:hsl(var(--border))!important}.uppy-Dashboard-Item-name{color:hsl(var(--foreground))!important}.uppy-Dashboard-Item-status{color:hsl(var(--muted-foreground))!important}.uppy-StatusBar{background:hsl(var(--muted))!important;border-top:1px solid hsl(var(--border))!important}.uppy-StatusBar-progress{background:hsl(var(--primary))!important}.uppy-StatusBar-content{color:hsl(var(--foreground))!important}.uppy-StatusBar-actionBtn--upload{background:hsl(var(--primary))!important;color:hsl(var(--primary-foreground))!important;border-radius:.375rem!important;font-weight:500!important;padding:.5rem 1rem!important}.uppy-StatusBar-actionBtn--upload:hover{background:hsl(var(--primary) / .9)!important}.uppy-Dashboard-note{color:hsl(var(--muted-foreground))!important;font-size:.75rem!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles,.dark .uppy-Dashboard-AddFiles{background:hsl(var(--muted) / .2)!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title,.dark .uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important}[data-uppy-theme=dark] .uppy-StatusBar,.dark .uppy-StatusBar{background:hsl(var(--muted) / .5)!important}.uppy-Dashboard{font-family:inherit!important}.uppy-Dashboard-Item-preview{border-radius:.375rem!important;overflow:hidden}.uppy-Dashboard-Item-action--remove{color:hsl(var(--destructive))!important}.uppy-Dashboard-Item-action--remove:hover{opacity:.8}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{color:hsl(var(--success, 142 76% 36%))!important}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progress{color:hsl(var(--destructive))!important}.uppy-Dashboard-files::-webkit-scrollbar{width:6px}.uppy-Dashboard-files::-webkit-scrollbar-track{background:transparent}.uppy-Dashboard-files::-webkit-scrollbar-thumb{background:hsl(var(--muted-foreground) / .3);border-radius:3px}.uppy-Dashboard-files::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5)}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/assets/index-M5fhZWWH.css b/webui/dist/assets/index-M5fhZWWH.css deleted file mode 100644 index 9fa83c68..00000000 --- a/webui/dist/assets/index-M5fhZWWH.css +++ /dev/null @@ -1 +0,0 @@ -@charset "UTF-8";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[140px\]{height:140px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[140px\]{min-height:140px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[1px\]{width:1px}.w-\[65px\]{width:65px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[100px\]{max-width:100px}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[1fr_1fr_90px_32px\]{grid-template-columns:1fr 1fr 90px 32px}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900\/30:is(.dark *){background-color:#1e3a8a4d}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-purple-900\/30:is(.dark *){background-color:#581c874d}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-purple-400:is(.dark *){--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-4{padding-bottom:1rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:grid-cols-9{grid-template-columns:repeat(9,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}.lg\:pb-6{padding-bottom:1.5rem}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}.uppy-Root{box-sizing:border-box;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1;position:relative;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.uppy-Root[dir=rtl],[dir=rtl] .uppy-Root{text-align:right}.uppy-Root *,.uppy-Root :after,.uppy-Root :before{box-sizing:inherit}.uppy-Root [hidden]{display:none}.uppy-u-reset{all:initial;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1}[dir=rtl] .uppy-u-reset{text-align:right}.uppy-c-textInput{background-color:#fff;border:1px solid #ddd;border-radius:4px;font-family:inherit;font-size:14px;line-height:1.5;padding:6px 8px}.uppy-size--md .uppy-c-textInput{padding:8px 10px}.uppy-c-textInput:focus{border-color:#1269cf99;box-shadow:0 0 0 3px #1269cf26;outline:none}[data-uppy-theme=dark] .uppy-c-textInput{background-color:#333;border-color:#333;color:#eaeaea}[data-uppy-theme=dark] .uppy-c-textInput:focus{border-color:#525252;box-shadow:none}.uppy-c-icon{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;fill:currentColor}.uppy-c-btn{align-items:center;color:inherit;display:inline-flex;font-family:inherit;font-size:inherit;font-weight:500;justify-content:center;line-height:1;transition-duration:.3s;transition-property:background-color,color;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.uppy-c-btn,[dir=rtl] .uppy-c-btn{text-align:center}.uppy-c-btn:not(:disabled):not(.disabled){cursor:pointer}.uppy-c-btn::-moz-focus-inner{border:0}.uppy-c-btn-primary{background-color:#1269cf;border-radius:4px;color:#fff;font-size:14px;padding:10px 18px}.uppy-c-btn-primary:not(:disabled):hover{background-color:#0e51a0}.uppy-c-btn-primary:focus{box-shadow:0 0 0 3px #1269cf66;outline:none}.uppy-size--md .uppy-c-btn-primary{padding:13px 22px}[data-uppy-theme=dark] .uppy-c-btn-primary{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-primary::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-c-btn-primary.uppy-c-btn--disabled{background-color:#8eb2db}.uppy-c-btn-link{background-color:initial;border-radius:4px;color:#525252;font-size:14px;line-height:1;padding:10px 15px}.uppy-c-btn-link:hover{color:#333}.uppy-c-btn-link:focus{box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-size--md .uppy-c-btn-link{padding:13px 18px}[data-uppy-theme=dark] .uppy-c-btn-link{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-link:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-link::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-link:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-c-btn-link:hover{color:#939393}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;padding:6px}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list:after,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list:after{content:"";flex:auto}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{margin:0;position:relative;width:50%}.uppy-size--md .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--md .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:33.3333%}.uppy-size--lg .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--lg .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:25%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem:before,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem:before{content:"";display:block;padding-top:100%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected svg{opacity:.85}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--disabled,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--disabled{opacity:.5}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#93939333}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#eaeaea33}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{height:30%;width:30%;fill:#000000b3}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{fill:#fffc}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{border-radius:4px;height:calc(100% - 14px);inset:7px;overflow:hidden;position:absolute;text-align:center;width:calc(100% - 14px)}@media(hover:none){.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author{display:block}}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{box-shadow:0 0 0 3px #aae1ffb3}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner img{border-radius:4px;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author{background:#0000004d;bottom:0;color:#fff;display:none;font-size:12px;font-weight:500;left:0;margin:0;padding:5px;position:absolute;text-decoration:none;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author:hover,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author:hover{background:#0006;text-decoration:underline}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-radius:50%;height:26px;opacity:0;position:absolute;right:16px;top:16px;width:26px;z-index:1002}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox:after{height:7px;inset-inline-start:7px;top:8px;width:12px}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{opacity:1}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author{display:block}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus{outline:none}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner{border:0}.uppy-ProviderBrowser-viewType--list{background-color:#fff}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list{background-color:#1f1f1f}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{align-items:center;display:flex;margin:0;padding:7px 15px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{color:#eaeaea}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem--disabled{opacity:.6}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox{background-color:#fff;border:1px solid #cfcfcf;border-radius:3px;height:17px;margin-inline-end:15px;width:17px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border:1px solid #1269cf;box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:after{height:5px;inset-inline-start:3px;opacity:0;top:4px;width:9px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border-color:#02baf2b3;box-shadow:0 0 0 3px #02baf233}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-color:#1269cf}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{opacity:1}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner{align-items:center;color:inherit;display:flex;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;overflow:hidden;padding:2px;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner:focus{outline:none;text-decoration:underline}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner svg{margin-inline-end:8px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner span{line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--disabled .uppy-ProviderBrowserItem-inner{cursor:default}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-iconWrap{margin-inline-end:7px;width:20px}.uppy-ProviderBrowserItem-checkbox{cursor:pointer;flex-shrink:0;position:relative}.uppy-ProviderBrowserItem-checkbox:disabled,.uppy-ProviderBrowserItem-checkbox:disabled:after{cursor:default}[data-uppy-theme=dark] .uppy-ProviderBrowserItem-checkbox{background-color:#1f1f1f;border-color:#939393}[data-uppy-theme=dark] .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{background-color:#333}.uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after{border-bottom:2px solid #eaeaea;border-left:2px solid #eaeaea;content:"";cursor:pointer;position:absolute;transform:rotate(-45deg)}.uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{background-color:#eaeaea!important;content:""!important;height:2px!important;left:20%!important;position:absolute!important;right:20%!important;top:50%!important;transform:translateY(-50%)!important}.uppy-SearchProvider{align-items:center;display:flex;flex:1;flex-direction:column;height:100%;justify-content:center;width:100%}[data-uppy-theme=dark] .uppy-SearchProvider{background-color:#1f1f1f}.uppy-SearchProvider-input{margin-bottom:15px;max-width:650px;width:90%}.uppy-size--md .uppy-SearchProvider-input{margin-bottom:20px}.uppy-SearchProvider-input::-webkit-search-cancel-button{display:none}.uppy-SearchProvider-searchButton{padding:13px 25px}.uppy-size--md .uppy-SearchProvider-searchButton{padding:13px 30px}.uppy-DashboardContent-panelBody{align-items:center;display:flex;flex:1;justify-content:center}[data-uppy-theme=dark] .uppy-DashboardContent-panelBody{background-color:#1f1f1f}.uppy-Provider-auth,.uppy-Provider-empty,.uppy-Provider-error,.uppy-Provider-loading{align-items:center;color:#939393;display:flex;flex:1;flex-flow:column wrap;justify-content:center}.uppy-Provider-empty{color:#939393}.uppy-Provider-authIcon svg{height:75px;width:100px}.uppy-Provider-authTitle{color:#757575;font-size:17px;font-weight:400;line-height:1.4;margin-bottom:30px;max-width:500px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Provider-authTitle{font-size:20px}[data-uppy-theme=dark] .uppy-Provider-authTitle{color:#cfcfcf}.uppy-Provider-btn-google{align-items:center;background:#4285f4;display:flex;padding:8px 12px!important}.uppy-Provider-btn-google:hover{background-color:#1266f1}.uppy-Provider-btn-google:focus{box-shadow:0 0 0 3px #4285f466;outline:none}.uppy-Provider-btn-google svg{margin-right:8px}.uppy-Provider-breadcrumbs{color:#525252;flex:1;font-size:12px;margin-bottom:10px;text-align:start}.uppy-size--md .uppy-Provider-breadcrumbs{margin-bottom:0}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs{color:#eaeaea}.uppy-Provider-breadcrumbsIcon{color:#525252;display:inline-block;line-height:1;margin-inline-end:4px;vertical-align:middle}.uppy-Provider-breadcrumbsIcon svg{height:13px;width:13px;fill:#525252}.uppy-Provider-breadcrumbs button{border-radius:3px;display:inline-block;line-height:inherit;padding:4px}.uppy-Provider-breadcrumbs button:focus{outline:none}.uppy-Provider-breadcrumbs button::-moz-focus-inner{border:0}.uppy-Provider-breadcrumbs button:hover{color:#0e51a0}.uppy-Provider-breadcrumbs button:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button:focus{background-color:#333}.uppy-Provider-breadcrumbs button:not(:last-of-type){text-decoration:underline}.uppy-Provider-breadcrumbs button:last-of-type{color:#333;cursor:normal;font-weight:500;pointer-events:none}.uppy-Provider-breadcrumbs button:hover{cursor:pointer}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button{color:#eaeaea}.uppy-ProviderBrowser{display:flex;flex:1;flex-direction:column;font-size:14px;font-weight:400;height:100%}.uppy-ProviderBrowser-user{color:#333;font-weight:500;margin:0 8px 0 0}[data-uppy-theme=dark] .uppy-ProviderBrowser-user{color:#eaeaea}.uppy-ProviderBrowser-user:after{color:#939393;content:"·";font-weight:400;inset-inline-start:4px;position:relative}.uppy-ProviderBrowser-header{border-bottom:1px solid #eaeaea;position:relative;z-index:1001}[data-uppy-theme=dark] .uppy-ProviderBrowser-header{border-bottom:1px solid #333}.uppy-ProviderBrowser-headerBar{background-color:#fafafa;color:#757575;font-size:12px;line-height:1.4;padding:7px 15px;z-index:1001}.uppy-size--md .uppy-ProviderBrowser-headerBar{align-items:center;display:flex}[data-uppy-theme=dark] .uppy-ProviderBrowser-headerBar{background-color:#1f1f1f}.uppy-ProviderBrowser-headerBar--simple{display:block;justify-content:center;text-align:center}.uppy-ProviderBrowser-headerBar--simple .uppy-Provider-breadcrumbsWrap{display:inline-block;flex:none;vertical-align:middle}.uppy-ProviderBrowser-searchFilter{align-items:center;display:flex;height:30px;margin-bottom:15px;margin-top:15px;padding-left:8px;padding-right:8px;position:relative;width:100%}.uppy-ProviderBrowser-searchFilterInput{background-color:#eaeaea;border:0;border-radius:4px;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;font-size:13px;height:30px;line-height:1.4;outline:0;padding-inline-end:30px;padding-inline-start:30px;width:100%;z-index:1001}.uppy-ProviderBrowser-searchFilterInput::-webkit-search-cancel-button{display:none}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput{background-color:#1f1f1f;color:#eaeaea}.uppy-ProviderBrowser-searchFilterInput:focus{background-color:#cfcfcf;border:0}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput:focus{background-color:#333}.uppy-ProviderBrowser-searchFilterIcon{color:#757575;height:12px;inset-inline-start:16px;position:absolute;width:12px;z-index:1002}.uppy-ProviderBrowser-searchFilterInput::-moz-placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterInput::placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterReset{border-radius:3px;color:#939393;cursor:pointer;height:22px;inset-inline-end:16px;padding:6px;position:absolute;width:22px;z-index:1002}.uppy-ProviderBrowser-searchFilterReset:focus{outline:none}.uppy-ProviderBrowser-searchFilterReset::-moz-focus-inner{border:0}.uppy-ProviderBrowser-searchFilterReset:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-searchFilterReset:hover{color:#757575}.uppy-ProviderBrowser-searchFilterReset svg{vertical-align:text-top}.uppy-ProviderBrowser-userLogout{border-radius:3px;color:#1269cf;cursor:pointer;line-height:inherit;padding:4px}.uppy-ProviderBrowser-userLogout:focus{outline:none}.uppy-ProviderBrowser-userLogout::-moz-focus-inner{border:0}.uppy-ProviderBrowser-userLogout:hover{color:#0e51a0}.uppy-ProviderBrowser-userLogout:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout:focus{background-color:#333}.uppy-ProviderBrowser-userLogout:hover{text-decoration:underline}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout{color:#eaeaea}.uppy-ProviderBrowser-body{flex:1;position:relative}.uppy-ProviderBrowser-list{background-color:#fff;border-spacing:0;display:block;flex:1;height:100%;inset:0;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;width:100%;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-ProviderBrowser-list{background-color:#1f1f1f}.uppy-ProviderBrowser-list:focus{outline:none}.uppy-ProviderBrowserItem-inner{cursor:pointer;font-size:13px;font-weight:500}.uppy-ProviderBrowser-footer{align-items:center;background-color:#fff;border-top:1px solid #eaeaea;display:flex;justify-content:space-between;padding:15px}.uppy-ProviderBrowser-footer button{margin-inline-end:8px}[data-uppy-theme=dark] .uppy-ProviderBrowser-footer{background-color:#1f1f1f;border-top:1px solid #333}.uppy-ProviderBrowser-footer-buttons{flex-shrink:0}.uppy-ProviderBrowser-footer-error{color:#e32437;line-height:18px}@media(max-width:426px){.uppy-ProviderBrowser-footer{align-items:stretch;flex-direction:column-reverse}.uppy-ProviderBrowser-footer-error{padding-bottom:10px}}.picker-dialog-bg{z-index:20000!important}.picker-dialog{z-index:20001!important}.uppy-Dashboard-Item-previewInnerWrap{align-items:center;border-radius:3px;box-shadow:0 0 2px #0006;display:flex;flex-direction:column;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.uppy-size--md .uppy-Dashboard-Item-previewInnerWrap{box-shadow:0 1px 2px #00000026}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewInnerWrap{box-shadow:none}.uppy-Dashboard-Item-previewInnerWrap:after{background-color:#000000a6;content:"";display:none;inset:0;position:absolute;z-index:1001}.uppy-Dashboard-Item-previewLink{inset:0;position:absolute;z-index:1002}.uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #579df0}[data-uppy-theme=dark] .uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #016c8d}.uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;height:100%;-o-object-fit:cover;object-fit:cover;transform:translateZ(0);width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{height:auto;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;padding:10px;width:auto}.uppy-Dashboard-Item-progress{color:#fff;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%);transition:all .35 ease;width:120px;z-index:1002}.uppy-Dashboard-Item-progressIndicator{color:#fff;display:inline-block;height:38px;opacity:.9;width:38px}.uppy-size--md .uppy-Dashboard-Item-progressIndicator{height:55px;width:55px}button.uppy-Dashboard-Item-progressIndicator{cursor:pointer}button.uppy-Dashboard-Item-progressIndicator:focus{outline:none}button.uppy-Dashboard-Item-progressIndicator::-moz-focus-inner{border:0}button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--bg,button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--retry{fill:#579df0}.uppy-Dashboard-Item-progressIcon--circle{height:100%;width:100%}.uppy-Dashboard-Item-progressIcon--bg{stroke:#fff6}.uppy-Dashboard-Item-progressIcon--progress{transition:stroke-dashoffset .5s ease-out;stroke:#fff}.uppy-Dashboard-Item-progressIcon--play{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--cancel{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--pause{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--check{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--retry{fill:#fff}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{inset-inline-end:-8px;inset-inline-start:auto;top:-9px;transform:none;width:auto}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:18px;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:28px;width:28px}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:18px;opacity:1;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:22px;width:22px}.uppy-Dashboard-Item.is-processing .uppy-Dashboard-Item-progress{opacity:0}.uppy-Dashboard-Item-fileInfo{padding-inline-end:5px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:10px}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:15px}.uppy-Dashboard-Item-name{font-size:12px;font-weight:500;line-height:1.3;margin-bottom:5px;word-wrap:anywhere;word-break:break-all}[data-uppy-theme=dark] .uppy-Dashboard-Item-name{color:#eaeaea}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-name{font-size:14px;line-height:1.4}.uppy-Dashboard-Item-fileName{align-items:baseline;display:flex}.uppy-Dashboard-Item-fileName button{margin-left:5px}.uppy-Dashboard-Item-author{color:#757575;display:inline-block;font-size:11px;font-weight:400;line-height:1;margin-bottom:5px;vertical-align:bottom}.uppy-Dashboard-Item-author a{color:#757575}.uppy-Dashboard-Item-status{color:#757575;font-size:11px;font-weight:400;line-height:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-status{color:#bbb}.uppy-Dashboard-Item-statusSize{display:inline-block;margin-bottom:5px;text-transform:uppercase;vertical-align:bottom}.uppy-Dashboard-Item-reSelect{color:#1269cf;font-family:inherit;font-size:inherit;font-weight:600}.uppy-Dashboard-Item-errorMessage{background-color:#fdeff1;color:#a51523;font-size:11px;font-weight:500;line-height:1.3;padding:5px 6px}.uppy-Dashboard-Item-errorMessageBtn{color:#a51523;cursor:pointer;font-size:11px;font-weight:500;text-decoration:underline}.uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{display:none}.uppy-size--md .uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-top:1px solid #f7c2c8;bottom:0;display:block;left:0;line-height:1.4;padding:6px 8px;position:absolute;right:0}.uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{border:1px solid #f7c2c8;border-radius:3px;display:inline-block;position:static}.uppy-size--md .uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{display:none}.uppy-Dashboard-Item-action{color:#939393;cursor:pointer}.uppy-Dashboard-Item-action:focus{outline:none}.uppy-Dashboard-Item-action::-moz-focus-inner{border:0}.uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-Item-action:hover{color:#1f1f1f;opacity:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-action{color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{outline:none}[data-uppy-theme=dark] .uppy-Dashboard-Item-action::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:hover{color:#eaeaea}.uppy-Dashboard-Item-action--remove{color:#1f1f1f;opacity:.95}.uppy-Dashboard-Item-action--remove:hover{color:#000;opacity:1}.uppy-size--md .uppy-Dashboard-Item-action--remove{height:18px;inset-inline-end:-8px;padding:0;position:absolute;top:-8px;width:18px;z-index:1002}.uppy-size--md .uppy-Dashboard-Item-action--remove:focus{border-radius:50%}.uppy-Dashboard--singleFile.uppy-size--height-md .uppy-Dashboard-Item-action--remove{inset-inline-end:8px;position:absolute;top:8px}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove{color:#525252}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove:hover{color:#333}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-actionWrapper{align-items:center;display:flex}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action{height:22px;margin-left:3px;padding:3px;width:22px}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action:focus{border-radius:3px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink,.uppy-size--md .uppy-Dashboard-Item-action--edit{height:16px;padding:0;width:16px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink:focus,.uppy-size--md .uppy-Dashboard-Item-action--edit:focus{border-radius:3px}.uppy-Dashboard-Item{align-items:center;border-bottom:1px solid #eaeaea;display:flex;padding:10px}.uppy-Dashboard:not(.uppy-Dashboard--singleFile) .uppy-Dashboard-Item{padding-inline-end:0}[data-uppy-theme=dark] .uppy-Dashboard-Item{border-bottom:1px solid #333}.uppy-size--md .uppy-Dashboard-Item{border-bottom:0;display:block;float:inline-start;height:215px;margin:5px 15px;padding:0;position:relative;width:calc(33.333% - 30px)}.uppy-size--lg .uppy-Dashboard-Item{height:190px;margin:5px 15px;padding:0;width:calc(25% - 30px)}.uppy-size--xl .uppy-Dashboard-Item{height:210px;padding:0;width:calc(20% - 30px)}.uppy-Dashboard--singleFile .uppy-Dashboard-Item{border-bottom:0;display:flex;flex-direction:column;height:100%;max-width:400px;padding:15px;position:relative;width:100%}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-previewInnerWrap{opacity:.2}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-name{opacity:.7}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='35' height='39' viewBox='0 0 35 39'%3E%3Cpath fill='%2523000' d='M1.708 38.66c1.709 0 3.417-3.417 6.834-3.417s5.125 3.417 8.61 3.417c3.348 0 5.056-3.417 8.473-3.417 4.305 0 5.125 3.417 6.833 3.417.889 0 1.709-.889 1.709-1.709v-19.68C34.167-5.757 0-5.757 0 17.271v19.68c0 .82.888 1.709 1.708 1.709m8.542-17.084a3.383 3.383 0 0 1-3.417-3.416 3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.417 3.417 3.383 3.383 0 0 1-3.417 3.416m13.667 0A3.383 3.383 0 0 1 20.5 18.16a3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.416 3.417 3.383 3.383 0 0 1-3.416 3.416'/%3E%3C/svg%3E");background-position:50% 10px;background-repeat:no-repeat;background-size:25px;content:"";inset:0;opacity:.5;position:absolute;z-index:1005}.uppy-size--md .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:40px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:30%}.uppy-Dashboard-Item-preview{flex-grow:0;flex-shrink:0;height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-Item-preview{height:140px;width:100%}.uppy-size--lg .uppy-Dashboard-Item-preview{height:120px}.uppy-size--xl .uppy-Dashboard-Item-preview{height:140px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview{flex-grow:1;max-height:75%;width:100%}.uppy-Dashboard--singleFile.uppy-size--md .uppy-Dashboard-Item-preview{max-height:100%}.uppy-Dashboard-Item-fileInfoAndButtons{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-inline-end:8px;padding-inline-start:12px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons,.uppy-size--md .uppy-Dashboard-Item-fileInfoAndButtons{align-items:flex-start;padding:9px 0 0}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons{flex-grow:0;width:100%}.uppy-Dashboard-Item-fileInfo{flex-grow:1;flex-shrink:1}.uppy-Dashboard-Item-actionWrapper{flex-grow:0;flex-shrink:0}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-previewInnerWrap:after,.uppy-Dashboard-Item.is-inprogress .uppy-Dashboard-Item-previewInnerWrap:after{display:block}.uppy-Dashboard-Item-errorDetails{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border:none;border-radius:50%;color:#fff;cursor:help;flex-shrink:0;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;width:13px}.uppy-Dashboard-Item-errorDetails:after{line-height:1.3;word-wrap:break-word}.uppy-Dashboard-FileCard{background-color:#fff;border-radius:5px;box-shadow:0 0 10px 4px #0000001a;display:flex;flex-direction:column;height:100%;inset:0;position:absolute;width:100%;z-index:1005}.uppy-Dashboard-FileCard .uppy-DashboardContent-bar{border-top-left-radius:5px;border-top-right-radius:5px}.uppy-Dashboard-FileCard .uppy-Dashboard-FileCard-actions{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.uppy-Dashboard-FileCard-inner{display:flex;flex-direction:column;flex-grow:1;flex-shrink:1;height:100%;min-height:0}.uppy-Dashboard-FileCard-preview{align-items:center;border-bottom:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:1;height:60%;justify-content:center;min-height:0;position:relative}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-preview{background-color:#333;border-bottom:0}.uppy-Dashboard-FileCard-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;box-shadow:0 3px 20px #00000026;flex:0 0 auto;max-height:90%;max-width:90%;-o-object-fit:cover;object-fit:cover}.uppy-Dashboard-FileCard-edit{background-color:#00000080;border-radius:50px;color:#fff;font-size:13px;inset-inline-end:10px;padding:7px 15px;position:absolute;top:10px}.uppy-Dashboard-FileCard-edit:focus{outline:none}.uppy-Dashboard-FileCard-edit::-moz-focus-inner{border:0}.uppy-Dashboard-FileCard-edit:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-FileCard-edit:hover{background-color:#000c}.uppy-Dashboard-FileCard-info{flex-grow:0;flex-shrink:0;height:40%;overflow-y:auto;padding:30px 20px 20px;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-info{background-color:#1f1f1f}.uppy-Dashboard-FileCard-fieldset{border:0;font-size:0;margin:auto auto 12px;max-width:640px;padding:0}.uppy-Dashboard-FileCard-label{color:#525252;display:inline-block;font-size:12px;vertical-align:middle;width:22%}.uppy-size--md .uppy-Dashboard-FileCard-label{font-size:14px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-label{color:#eaeaea}.uppy-Dashboard-FileCard-input{display:inline-block;vertical-align:middle;width:78%}.uppy-Dashboard-FileCard-actions{align-items:center;background-color:#fafafa;border-top:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:0;height:55px;padding:0 15px}.uppy-size--md .uppy-Dashboard-FileCard-actions{height:65px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-actions{background-color:#1f1f1f;border-top:1px solid #333}.uppy-Dashboard-FileCard-actionsBtn{margin-inline-end:10px}.uppy-Informer{bottom:60px;left:0;position:absolute;right:0;text-align:center;z-index:1005}.uppy-Informer span>div{margin-bottom:6px}.uppy-Informer-animated{opacity:0;transform:translateY(350%);transition:all .3s ease-in;z-index:-1000}.uppy-Informer p{background-color:#757575;border-radius:18px;color:#fff;display:inline-block;font-size:12px;font-weight:400;line-height:1.4;margin:0;max-width:90%;padding:6px 15px}.uppy-size--md .uppy-Informer p{font-size:14px;line-height:1.3;max-width:500px;padding:10px 20px}[data-uppy-theme=dark] .uppy-Informer p{background-color:#333}.uppy-Informer p span{background-color:#fff;border-radius:50%;color:#525252;display:inline-block;font-size:10px;height:13px;inset-inline-start:3px;line-height:12px;margin-inline-start:-1px;position:relative;top:-1px;vertical-align:middle;width:13px}.uppy-Informer p span:hover{cursor:help}.uppy-Informer p span:after{line-height:1.3;word-wrap:break-word}.uppy-Root [aria-label][role~=tooltip]{position:relative}.uppy-Root [aria-label][role~=tooltip]:after,.uppy-Root [aria-label][role~=tooltip]:before{backface-visibility:hidden;box-sizing:border-box;opacity:0;pointer-events:none;position:absolute;transform:translateZ(0);transform-origin:top;transition:all var(--microtip-transition-duration,.18s) var(--microtip-transition-easing,ease-in-out) var(--microtip-transition-delay,0s);will-change:transform;z-index:10}.uppy-Root [aria-label][role~=tooltip]:before{background-size:100% auto!important;content:""}.uppy-Root [aria-label][role~=tooltip]:after{background:#111111e6;border-radius:4px;box-sizing:initial;color:#fff;content:attr(aria-label);font-size:var(--microtip-font-size,13px);font-weight:var(--microtip-font-weight,normal);padding:.5em 1em;text-transform:var(--microtip-text-transform,none);white-space:nowrap}.uppy-Root [aria-label][role~=tooltip]:focus:after,.uppy-Root [aria-label][role~=tooltip]:focus:before,.uppy-Root [aria-label][role~=tooltip]:hover:after,.uppy-Root [aria-label][role~=tooltip]:hover:before{opacity:1;pointer-events:auto}.uppy-Root [role~=tooltip][data-microtip-position|=top]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M2.658 0h32.004c-6 0-11.627 12.002-16.002 12.002S8.594 0 2.658 0'/%3E%3C/svg%3E") no-repeat;bottom:100%;height:6px;left:50%;margin-bottom:5px;transform:translate3d(-50%,0,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=top]:after{bottom:100%;left:50%;margin-bottom:11px;transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=top]:hover:before{transform:translate3d(-50%,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:after{bottom:100%;transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:hover:after{transform:translate3d(calc(-100% + 16px),-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:after{bottom:100%;transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:hover:after{transform:translate3d(-16px,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M33.342 12H1.338c6 0 11.627-12.002 16.002-12.002S27.406 12 33.342 12'/%3E%3C/svg%3E") no-repeat;bottom:auto;height:6px;left:50%;margin-bottom:0;margin-top:5px;top:100%;transform:translate3d(-50%,-10px,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:after{left:50%;margin-top:11px;top:100%;transform:translate3d(-50%,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:hover:before{transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:after{top:100%;transform:translate3d(calc(-100% + 16px),-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:hover:after{transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:after{top:100%;transform:translate3d(-16px,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:hover:after{transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:before{inset:50% 100% auto auto;transform:translate3d(10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M0 33.342V1.338c0 6 12.002 11.627 12.002 16.002S0 27.406 0 33.342'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-right:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=left]:after{margin-right:11px}.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:before{bottom:auto;left:100%;top:50%;transform:translate3d(-10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M12 2.658v32.004c0-6-12.002-11.627-12.002-16.002S12 8.594 12 2.658'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-left:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=right]:after{margin-left:11px}.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-size=small]:after{white-space:normal;width:80px}.uppy-Root [role~=tooltip][data-microtip-size=medium]:after{white-space:normal;width:150px}.uppy-Root [role~=tooltip][data-microtip-size=large]:after{white-space:normal;width:260px}.uppy-StatusBar{background-color:#fff;color:#fff;display:flex;font-size:12px;font-weight:400;height:46px;line-height:40px;position:relative;transition:height .2s;z-index:1001}[data-uppy-theme=dark] .uppy-StatusBar{background-color:#1f1f1f}.uppy-StatusBar:before{background-color:#eaeaea;content:"";height:2px;inset:0;position:absolute;width:100%}[data-uppy-theme=dark] .uppy-StatusBar:before{background-color:#757575}.uppy-StatusBar[aria-hidden=true]{height:0;overflow-y:hidden}.uppy-StatusBar.is-complete .uppy-StatusBar-progress{background-color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-progress{background-color:#e32437}.uppy-StatusBar.is-complete .uppy-StatusBar-statusIndicator{color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-statusIndicator{color:#e32437}.uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#fff;border-top:1px solid #eaeaea;height:65px}[data-uppy-theme=dark] .uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#1f1f1f;border-top:1px solid #333}.uppy-StatusBar-progress{background-color:#1269cf;height:2px;position:absolute;transition:background-color,width .3s ease-out;z-index:1001}.uppy-StatusBar-progress.is-indeterminate{animation:uppy-StatusBar-ProgressStripes 1s linear infinite;background-image:linear-gradient(45deg,#0000004d 25%,#0000 0 50%,#0000004d 0 75%,#0000 0,#0000);background-size:64px 64px}@keyframes uppy-StatusBar-ProgressStripes{0%{background-position:0 0}to{background-position:64px 0}}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-progress,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-progress{background-color:#f6a623}.uppy-StatusBar.is-waiting .uppy-StatusBar-progress{display:none}.uppy-StatusBar-content{align-items:center;color:#333;display:flex;height:100%;padding-inline-start:10px;position:relative;text-overflow:ellipsis;white-space:nowrap;z-index:1002}.uppy-size--md .uppy-StatusBar-content{padding-inline-start:15px}[data-uppy-theme=dark] .uppy-StatusBar-content{color:#eaeaea}.uppy-StatusBar-status{display:flex;flex-direction:column;font-weight:400;justify-content:center;line-height:1.4;padding-inline-end:.3em}.uppy-StatusBar-statusPrimary{display:flex;font-weight:500;line-height:1}.uppy-StatusBar-statusPrimary button.uppy-StatusBar-details{margin-left:5px}[data-uppy-theme=dark] .uppy-StatusBar-statusPrimary{color:#eaeaea}.uppy-StatusBar-statusSecondary{color:#757575;display:inline-block;font-size:11px;line-height:1.2;margin-top:1px;white-space:nowrap}[data-uppy-theme=dark] .uppy-StatusBar-statusSecondary{color:#bbb}.uppy-StatusBar-statusSecondaryHint{display:inline-block;line-height:1;margin-inline-end:5px;vertical-align:middle}.uppy-size--md .uppy-StatusBar-statusSecondaryHint{margin-inline-end:8px}.uppy-StatusBar-statusIndicator{color:#525252;margin-inline-end:7px;position:relative;top:1px}.uppy-StatusBar-statusIndicator svg{vertical-align:text-bottom}.uppy-StatusBar-actions{align-items:center;bottom:0;display:flex;inset-inline-end:10px;position:absolute;top:0;z-index:1004}.uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#fafafa;height:100%;padding:0 15px;position:static;width:100%}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#1f1f1f}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:column;height:90px}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:row;height:65px}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:column;justify-content:center}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:row;justify-content:normal}.uppy-StatusBar-actionCircleBtn{cursor:pointer;line-height:1;margin:3px;opacity:.9}.uppy-StatusBar-actionCircleBtn:focus{outline:none}.uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}.uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionCircleBtn:hover{opacity:1}.uppy-StatusBar-actionCircleBtn:focus{border-radius:50%}.uppy-StatusBar-actionCircleBtn svg{vertical-align:bottom}.uppy-StatusBar-actionBtn{color:#1269cf;display:inline-block;font-size:10px;line-height:inherit;vertical-align:middle}.uppy-size--md .uppy-StatusBar-actionBtn{font-size:11px}.uppy-StatusBar-actionBtn--disabled{opacity:.4}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--disabled{opacity:.7}.uppy-StatusBar-actionBtn--retry{background-color:#ff4b23;border-radius:8px;color:#fff;height:16px;line-height:1;margin-inline-end:6px;padding:1px 6px 3px 18px;position:relative}.uppy-StatusBar-actionBtn--retry:focus{outline:none}.uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionBtn--retry:hover{background-color:#f92d00}.uppy-StatusBar-actionBtn--retry svg{inset-inline-start:6px;position:absolute;top:3px}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1bb240;color:#fff;font-size:14px;line-height:1;padding:15px 10px;width:100%}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#189c38}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1c8b37}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#18762f}.uppy-size--md .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{padding:13px 22px;width:auto}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1bb240;cursor:not-allowed}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1c8b37}.uppy-StatusBar:not(.is-waiting) .uppy-StatusBar-actionBtn--upload{background-color:initial;color:#1269cf}.uppy-StatusBar-actionBtn--uploadNewlyAdded{border-radius:3px;padding-inline-end:3px;padding-bottom:1px;padding-inline-start:3px}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}.uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded{display:none}.uppy-StatusBar-actionBtn--done{border-radius:3px;line-height:1;padding:7px 8px}.uppy-StatusBar-actionBtn--done:focus{outline:none}.uppy-StatusBar-actionBtn--done::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--done:hover{color:#0e51a0}.uppy-StatusBar-actionBtn--done:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done:focus{background-color:#333}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done{color:#02baf2}.uppy-size--md .uppy-StatusBar-actionBtn--done{font-size:14px}.uppy-StatusBar-serviceMsg{color:#000;font-size:11px;line-height:1.1;padding-left:10px}.uppy-size--md .uppy-StatusBar-serviceMsg{font-size:14px;padding-left:15px}[data-uppy-theme=dark] .uppy-StatusBar-serviceMsg{color:#eaeaea}.uppy-StatusBar-serviceMsg-ghostsIcon{left:6px;opacity:.5;position:relative;top:2px;vertical-align:text-bottom;width:10px}.uppy-size--md .uppy-StatusBar-serviceMsg-ghostsIcon{left:10px;top:1px;width:15px}.uppy-StatusBar-details{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border-radius:50%;color:#fff;cursor:help;display:inline-block;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;vertical-align:middle;width:13px}.uppy-StatusBar-details:after{line-height:1.3;word-wrap:break-word}.uppy-StatusBar-spinner{animation-duration:1s;animation-iteration-count:infinite;animation-name:uppy-StatusBar-spinnerAnimation;animation-timing-function:linear;fill:#1269cf;margin-inline-end:10px}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-spinner,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-spinner{fill:#f6a623}@keyframes uppy-StatusBar-spinnerAnimation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.uppy-transition-slideDownUp-enter{opacity:.01;transform:translate3d(0,-105%,0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-enter.uppy-transition-slideDownUp-enter-active{opacity:1;transform:translateZ(0)}.uppy-transition-slideDownUp-leave{opacity:1;transform:translateZ(0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-leave.uppy-transition-slideDownUp-leave-active{opacity:.01;transform:translate3d(0,-105%,0)}@keyframes uppy-Dashboard-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes uppy-Dashboard-fadeOut{0%{opacity:1}to{opacity:0}}@keyframes uppy-Dashboard-slideDownAndFadeIn{0%{opacity:0;transform:translate3d(-50%,-70%,0)}to{opacity:1;transform:translate3d(-50%,-50%,0)}}@keyframes uppy-Dashboard-slideDownAndFadeIn--small{0%{opacity:0;transform:translate3d(0,-20%,0)}to{opacity:1;transform:translateZ(0)}}@keyframes uppy-Dashboard-slideUpFadeOut{0%{opacity:1;transform:translate3d(-50%,-50%,0)}to{opacity:0;transform:translate3d(-50%,-70%,0)}}@keyframes uppy-Dashboard-slideUpFadeOut--small{0%{opacity:1;transform:translateZ(0)}to{opacity:0;transform:translate3d(0,-20%,0)}}.uppy-Dashboard--modal{z-index:1001}.uppy-Dashboard--modal[aria-hidden=true]{display:none}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeIn .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeOut .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard-isFixed{height:100vh;overflow:hidden}.uppy-Dashboard--modal .uppy-Dashboard-overlay{background-color:#00000080;inset:0;position:fixed;z-index:1001}.uppy-Dashboard-inner{background-color:#f4f4f4;border:1px solid #eaeaea;border-radius:5px;max-height:100%;max-width:100%;outline:none;position:relative}.uppy-size--md .uppy-Dashboard-inner{min-height:auto}@media only screen and (min-width:820px){.uppy-Dashboard-inner{height:500px;width:650px}}.uppy-Dashboard--modal .uppy-Dashboard-inner{z-index:1002}[data-uppy-theme=dark] .uppy-Dashboard-inner{background-color:#1f1f1f}.uppy-Dashboard--isDisabled .uppy-Dashboard-inner{cursor:not-allowed}.uppy-Dashboard-innerWrap{border-radius:5px;display:flex;flex-direction:column;height:100%;opacity:0;overflow:hidden;position:relative}.uppy-Dashboard--isInnerWrapVisible .uppy-Dashboard-innerWrap{opacity:1}.uppy-Dashboard--isDisabled .uppy-Dashboard-innerWrap{cursor:not-allowed;filter:grayscale(100%);opacity:.6;-webkit-user-select:none;-moz-user-select:none;user-select:none}.uppy-Dashboard--isDisabled .uppy-ProviderIconBg{fill:#9f9f9f}.uppy-Dashboard--isDisabled [aria-disabled],.uppy-Dashboard--isDisabled [disabled]{cursor:not-allowed;pointer-events:none}.uppy-Dashboard--modal .uppy-Dashboard-inner{border:none;inset:35px 15px 15px;position:fixed}@media only screen and (min-width:820px){.uppy-Dashboard--modal .uppy-Dashboard-inner{box-shadow:0 5px 15px 4px #00000026;left:50%;right:auto;top:50%;transform:translate(-50%,-50%)}}.uppy-Dashboard-close{color:#ffffffe6;cursor:pointer;display:block;font-size:27px;inset-inline-end:-2px;position:absolute;top:-33px;z-index:1005}.uppy-Dashboard-close:focus{outline:none}.uppy-Dashboard-close::-moz-focus-inner{border:0}.uppy-Dashboard-close:focus{color:#6eabf2}@media only screen and (min-width:820px){.uppy-Dashboard-close{font-size:35px;inset-inline-end:-35px;top:-10px}}.uppy-Dashboard-serviceMsg{background-color:#fffbf7;border-bottom:1px solid #edd4b9;border-top:1px solid #edd4b9;font-size:12px;font-weight:500;line-height:1.3;padding:12px 0;position:relative;top:-1px;z-index:1004}.uppy-size--md .uppy-Dashboard-serviceMsg{font-size:14px;line-height:1.4}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg{background-color:#1f1f1f;border-bottom:1px solid #333;border-top:1px solid #333;color:#eaeaea}.uppy-Dashboard-serviceMsg-title{display:block;line-height:1;margin-bottom:4px;padding-left:42px}.uppy-Dashboard-serviceMsg-text{padding:0 15px}.uppy-Dashboard-serviceMsg-actionBtn{color:#1269cf;font-size:inherit;font-weight:inherit;vertical-align:initial}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg-actionBtn{color:#02baf2e6}.uppy-Dashboard-serviceMsg-icon{left:15px;position:absolute;top:10px}.uppy-Dashboard-AddFiles{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;position:relative;text-align:center}[data-uppy-drag-drop-supported=true] .uppy-Dashboard-AddFiles{border:1px dashed #dfdfdf;border-radius:3px;height:calc(100% - 14px);margin:7px}.uppy-Dashboard-AddFilesPanel .uppy-Dashboard-AddFiles{border:none;height:calc(100% - 54px)}.uppy-Dashboard--modal .uppy-Dashboard-AddFiles{border-color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles{border-color:#757575}.uppy-Dashboard-AddFiles-info{display:none;margin-top:auto;padding-bottom:15px;padding-top:15px}.uppy-size--height-md .uppy-Dashboard-AddFiles-info{display:block}.uppy-size--md .uppy-Dashboard-AddFiles-info{bottom:25px;left:0;padding-bottom:0;padding-top:30px;position:absolute;right:0}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-info{margin-top:0}.uppy-Dashboard-browse{color:#1269cf;cursor:pointer}.uppy-Dashboard-browse:focus{outline:none}.uppy-Dashboard-browse::-moz-focus-inner{border:0}.uppy-Dashboard-browse:focus,.uppy-Dashboard-browse:hover{border-bottom:1px solid #1269cf}[data-uppy-theme=dark] .uppy-Dashboard-browse{color:#02baf2e6}[data-uppy-theme=dark] .uppy-Dashboard-browse:focus,[data-uppy-theme=dark] .uppy-Dashboard-browse:hover{border-bottom:1px solid #02baf2}.uppy-Dashboard-browseBtn{display:block;font-size:14px;font-weight:500;margin-bottom:5px;margin-top:8px;width:100%}.uppy-size--md .uppy-Dashboard-browseBtn{font-size:15px;margin:15px auto;padding:13px 44px;width:auto}.uppy-Dashboard-AddFiles-list{display:flex;flex:1;flex-direction:column;margin-top:2px;overflow-y:auto;padding:2px 0;width:100%;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-AddFiles-list{flex:none;flex-direction:row;flex-wrap:wrap;justify-content:center;margin-top:15px;max-width:600px;overflow-y:visible;padding-top:0}.uppy-DashboardTab{border-bottom:1px solid #eaeaea;text-align:center;width:100%}[data-uppy-theme=dark] .uppy-DashboardTab{border-bottom:1px solid #333}.uppy-size--md .uppy-DashboardTab{border-bottom:none;display:inline-block;margin-bottom:10px;width:auto}.uppy-DashboardTab-btn{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:initial;color:#525252;cursor:pointer;flex-direction:row;height:100%;justify-content:left;padding:12px 15px;width:100%}.uppy-DashboardTab-btn:focus{outline:none}.uppy-size--md .uppy-DashboardTab-btn{border-radius:5px;flex-direction:column;margin-inline-end:1px;padding:10px 3px;width:86px}[data-uppy-theme=dark] .uppy-DashboardTab-btn{color:#eaeaea}.uppy-DashboardTab-btn::-moz-focus-inner{border:0}.uppy-DashboardTab-btn:hover{background-color:#e9ecef}[data-uppy-theme=dark] .uppy-DashboardTab-btn:hover{background-color:#333}.uppy-DashboardTab-btn:active,.uppy-DashboardTab-btn:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardTab-btn:active,[data-uppy-theme=dark] .uppy-DashboardTab-btn:focus{background-color:#525252}.uppy-DashboardTab-btn svg{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;transition:transform .15s ease-in-out;vertical-align:text-top}.uppy-DashboardTab-inner{align-items:center;background-color:#fff;border-radius:8px;box-shadow:0 1px 1px #0000001a,0 1px 2px #0000001a,0 2px 3px #00000005;display:flex;height:32px;justify-content:center;margin-inline-end:10px;width:32px}.uppy-size--md .uppy-DashboardTab-inner{margin-inline-end:0}[data-uppy-theme=dark] .uppy-DashboardTab-inner{background-color:#323232;box-shadow:0 1px 1px #0003,0 1px 2px #0003,0 2px 3px #00000014}.uppy-DashboardTab-name{font-size:14px;font-weight:400}.uppy-size--md .uppy-DashboardTab-name{font-size:12px;line-height:15px;margin-bottom:0;margin-top:8px}.uppy-DashboardTab-iconMyDevice{color:#1269cf}[data-uppy-theme=dark] .uppy-DashboardTab-iconMyDevice{color:#02baf2}.uppy-DashboardTab-iconBox{color:#0061d5}[data-uppy-theme=dark] .uppy-DashboardTab-iconBox{color:#eaeaea}.uppy-DashboardTab-iconDropbox{color:#0061fe}[data-uppy-theme=dark] .uppy-DashboardTab-iconDropbox{color:#eaeaea}.uppy-DashboardTab-iconUnsplash{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconUnsplash{color:#eaeaea}.uppy-DashboardTab-iconWebdav{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconWebdav{color:#eaeaea}.uppy-DashboardTab-iconScreenRec{color:#2c3e50}[data-uppy-theme=dark] .uppy-DashboardTab-iconScreenRec{color:#eaeaea}.uppy-DashboardTab-iconAudio{color:#8030a3}[data-uppy-theme=dark] .uppy-DashboardTab-iconAudio{color:#bf6ee3}.uppy-Dashboard-input{height:.1px;opacity:0;overflow:hidden;position:absolute;width:.1px;z-index:-1}.uppy-DashboardContent-bar{align-items:center;background-color:#fafafa;border-bottom:1px solid #eaeaea;display:flex;flex-shrink:0;height:40px;justify-content:space-between;padding:0 10px;position:relative;width:100%;z-index:1004}.uppy-size--md .uppy-DashboardContent-bar{height:50px;padding:0 15px}[data-uppy-theme=dark] .uppy-DashboardContent-bar{background-color:#1f1f1f;border-bottom:1px solid #333}.uppy-DashboardContent-title{font-size:12px;font-weight:500;left:0;line-height:40px;margin:auto;max-width:170px;overflow-x:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0;white-space:nowrap;width:100%}.uppy-size--md .uppy-DashboardContent-title{font-size:14px;line-height:50px;max-width:300px}[data-uppy-theme=dark] .uppy-DashboardContent-title{color:#eaeaea}.uppy-DashboardContent-back,.uppy-DashboardContent-save{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-size:12px;font-weight:400;line-height:1;margin:0;margin-inline-start:-6px;padding:7px 6px}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{outline:none}.uppy-DashboardContent-back::-moz-focus-inner,.uppy-DashboardContent-save::-moz-focus-inner{border:0}.uppy-DashboardContent-back:hover,.uppy-DashboardContent-save:hover{color:#0e51a0}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-back:focus,[data-uppy-theme=dark] .uppy-DashboardContent-save:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-back,.uppy-size--md .uppy-DashboardContent-save{font-size:14px}[data-uppy-theme=dark] .uppy-DashboardContent-back,[data-uppy-theme=dark] .uppy-DashboardContent-save{color:#02baf2}.uppy-DashboardContent-addMore{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:500;height:29px;line-height:1;margin:0;margin-inline-end:-5px;padding:7px 8px;width:29px}.uppy-DashboardContent-addMore:focus{outline:none}.uppy-DashboardContent-addMore::-moz-focus-inner{border:0}.uppy-DashboardContent-addMore:hover{color:#0e51a0}.uppy-DashboardContent-addMore:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-addMore:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-addMore{font-size:14px;height:auto;margin-inline-end:-8px;width:auto}[data-uppy-theme=dark] .uppy-DashboardContent-addMore{color:#02baf2}.uppy-DashboardContent-addMore svg{margin-inline-end:4px;vertical-align:initial}.uppy-size--md .uppy-DashboardContent-addMore svg{height:11px;width:11px}.uppy-DashboardContent-addMoreCaption{display:none}.uppy-size--md .uppy-DashboardContent-addMoreCaption{display:inline}.uppy-DashboardContent-panel{background-color:#f5f5f5;flex:1}.uppy-Dashboard-AddFilesPanel,.uppy-DashboardContent-panel{border-radius:5px;display:flex;flex-direction:column;inset:0;overflow:hidden;position:absolute;z-index:1005}.uppy-Dashboard-AddFilesPanel{background:#fafafa;background:linear-gradient(0deg,#fafafa 35%,#fafafad9);box-shadow:0 0 10px 5px #00000026}[data-uppy-theme=dark] .uppy-Dashboard-AddFilesPanel{background-color:#333;background-image:linear-gradient(0deg,#1f1f1f 35%,#1f1f1fd9)}.uppy-Dashboard--isAddFilesPanelVisible .uppy-Dashboard-files{filter:blur(2px)}.uppy-Dashboard-progress{bottom:0;height:12%;left:0;position:absolute;width:100%}.uppy-Dashboard-progressBarContainer.is-active{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1004}.uppy-Dashboard-filesContainer{flex:1;margin:0;overflow-y:hidden;position:relative}.uppy-Dashboard-filesContainer:after{clear:both;content:"";display:table}.uppy-Dashboard-files{flex:1;margin:0;overflow-y:auto;padding:0 0 10px;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-files{padding-top:10px}.uppy-Dashboard--singleFile .uppy-Dashboard-filesInner{align-items:center;display:flex;height:100%;justify-content:center}.uppy-Dashboard-dropFilesHereHint{align-items:center;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%231269CF' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;border:1px dashed #1269cf;border-radius:3px;color:#757575;display:flex;font-size:16px;justify-content:center;inset:7px;padding-top:90px;position:absolute;text-align:center;visibility:hidden;z-index:2000}[data-uppy-theme=dark] .uppy-Dashboard-dropFilesHereHint{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%2302BAF2' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");border-color:#02baf2;color:#bbb}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-dropFilesHereHint{pointer-events:none;visibility:visible}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-files,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-progressindicators,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-serviceMsg,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-DashboardContent-bar{opacity:.15}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-AddFiles{opacity:.03}.uppy-Dashboard-AddFiles-title{color:#000;font-size:17px;font-weight:500;line-height:1.35;margin-bottom:5px;margin-top:15px;padding:0 15px;text-align:inline-start;width:100%}.uppy-size--md .uppy-Dashboard-AddFiles-title{font-size:21px;font-weight:400;margin-top:5px;max-width:480px;padding:0 35px;text-align:center}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-title{text-align:center}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title{color:#eaeaea}.uppy-Dashboard-AddFiles-title button{font-weight:500}.uppy-size--md .uppy-Dashboard-AddFiles-title button{font-weight:400}.uppy-Dashboard-note{color:#757575;font-size:14px;line-height:1.25;margin:auto;max-width:350px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Dashboard-note{line-height:1.35;max-width:600px}[data-uppy-theme=dark] .uppy-Dashboard-note{color:#cfcfcf}a.uppy-Dashboard-poweredBy{color:#939393;display:inline-block;font-size:11px;margin-top:8px;text-align:center;text-decoration:none}.uppy-Dashboard-poweredByIcon{margin-left:1px;margin-right:1px;opacity:.9;position:relative;top:1px;vertical-align:text-top;fill:none;stroke:#939393}.uppy-Dashboard-Item-previewIcon{height:25px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:25px;z-index:100}.uppy-size--md .uppy-Dashboard-Item-previewIcon{height:38px;width:38px}.uppy-Dashboard-Item-previewIcon svg{height:100%;width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIcon{height:100%;max-height:60%;max-width:60%;width:100%}.uppy-Dashboard-Item-previewIconWrap{height:76px;max-height:75%;position:relative}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIconWrap{height:100%;width:100%}.uppy-Dashboard-Item-previewIconBg{filter:drop-shadow(rgba(0,0,0,.1) 0 1px 1px);height:100%;width:100%}.uppy-Dashboard-upload{height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-upload{height:60px;width:60px}.uppy-Dashboard-upload .uppy-c-icon{position:relative;top:1px;width:50%}.uppy-Dashboard-uploadCount{background-color:#1bb240;border-radius:50%;color:#fff;font-size:8px;height:16px;inset-inline-end:-12px;line-height:16px;position:absolute;top:-12px;width:16px}.uppy-size--md .uppy-Dashboard-uploadCount{font-size:9px;height:18px;line-height:18px;width:18px}.uppy-Dashboard-inner{border:none!important;background:transparent!important}.uppy-Dashboard-innerWrap{border-radius:.5rem;overflow:hidden}.uppy-Dashboard-AddFiles{border:2px dashed hsl(var(--border))!important;border-radius:.5rem!important;background:hsl(var(--muted) / .3)!important;transition:all .2s ease}.uppy-Dashboard-AddFiles:hover{border-color:hsl(var(--primary))!important;background:hsl(var(--muted) / .5)!important}.uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important;font-weight:500!important}.uppy-Dashboard-AddFiles-info{color:hsl(var(--muted-foreground))!important}.uppy-Dashboard-browse{color:hsl(var(--primary))!important;font-weight:500!important}.uppy-Dashboard-browse:hover{text-decoration:underline!important}.uppy-Dashboard-files{background:transparent!important}.uppy-Dashboard-Item{border-bottom-color:hsl(var(--border))!important}.uppy-Dashboard-Item-name{color:hsl(var(--foreground))!important}.uppy-Dashboard-Item-status{color:hsl(var(--muted-foreground))!important}.uppy-StatusBar{background:hsl(var(--muted))!important;border-top:1px solid hsl(var(--border))!important}.uppy-StatusBar-progress{background:hsl(var(--primary))!important}.uppy-StatusBar-content{color:hsl(var(--foreground))!important}.uppy-StatusBar-actionBtn--upload{background:hsl(var(--primary))!important;color:hsl(var(--primary-foreground))!important;border-radius:.375rem!important;font-weight:500!important;padding:.5rem 1rem!important}.uppy-StatusBar-actionBtn--upload:hover{background:hsl(var(--primary) / .9)!important}.uppy-Dashboard-note{color:hsl(var(--muted-foreground))!important;font-size:.75rem!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles,.dark .uppy-Dashboard-AddFiles{background:hsl(var(--muted) / .2)!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title,.dark .uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important}[data-uppy-theme=dark] .uppy-StatusBar,.dark .uppy-StatusBar{background:hsl(var(--muted) / .5)!important}.uppy-Dashboard{font-family:inherit!important}.uppy-Dashboard-Item-preview{border-radius:.375rem!important;overflow:hidden}.uppy-Dashboard-Item-action--remove{color:hsl(var(--destructive))!important}.uppy-Dashboard-Item-action--remove:hover{opacity:.8}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{color:hsl(var(--success, 142 76% 36%))!important}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progress{color:hsl(var(--destructive))!important}.uppy-Dashboard-files::-webkit-scrollbar{width:6px}.uppy-Dashboard-files::-webkit-scrollbar-track{background:transparent}.uppy-Dashboard-files::-webkit-scrollbar-thumb{background:hsl(var(--muted-foreground) / .3);border-radius:3px}.uppy-Dashboard-files::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5)}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/assets/markdown-A1ShuLvG.js b/webui/dist/assets/markdown-kUhwkcQP.js similarity index 89% rename from webui/dist/assets/markdown-A1ShuLvG.js rename to webui/dist/assets/markdown-kUhwkcQP.js index 92fb2e43..1d787d15 100644 --- a/webui/dist/assets/markdown-A1ShuLvG.js +++ b/webui/dist/assets/markdown-kUhwkcQP.js @@ -1,4 +1,4 @@ -import{j as gn}from"./router-CWhjJi2n.js";import{g as Oa}from"./react-vendor-Dtc2IqVY.js";function ni(e){const t=[],r=String(e||"");let n=r.indexOf(","),i=0,a=!1;for(;!a;){n===-1&&(n=r.length,a=!0);const l=r.slice(i,n).trim();(l||!a)&&t.push(l),i=n+1,n=r.indexOf(",",i)}return t}function Js(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const eo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,to=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ro={};function ii(e,t){return(ro.jsx?to:eo).test(e)}const no=/[ \t\n\f\r]/g;function io(e){return typeof e=="object"?e.type==="text"?ai(e.value):!1:ai(e)}function ai(e){return e.replace(no,"")===""}class Sr{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}Sr.prototype.normal={};Sr.prototype.property={};Sr.prototype.space=void 0;function qa(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new Sr(r,n,t)}function yr(e){return e.toLowerCase()}class He{constructor(t,r){this.attribute=r,this.property=t}}He.prototype.attribute="";He.prototype.booleanish=!1;He.prototype.boolean=!1;He.prototype.commaOrSpaceSeparated=!1;He.prototype.commaSeparated=!1;He.prototype.defined=!1;He.prototype.mustUseProperty=!1;He.prototype.number=!1;He.prototype.overloadedBoolean=!1;He.prototype.property="";He.prototype.spaceSeparated=!1;He.prototype.space=void 0;let ao=0;const te=qt(),Ae=qt(),Kn=qt(),R=qt(),pe=qt(),Kt=qt(),Ue=qt();function qt(){return 2**++ao}const Zn=Object.freeze(Object.defineProperty({__proto__:null,boolean:te,booleanish:Ae,commaOrSpaceSeparated:Ue,commaSeparated:Kt,number:R,overloadedBoolean:Kn,spaceSeparated:pe},Symbol.toStringTag,{value:"Module"})),vn=Object.keys(Zn);class v0 extends He{constructor(t,r,n,i){let a=-1;if(super(t,r),li(this,"space",i),typeof n=="number")for(;++a4&&r.slice(0,4)==="data"&&co.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(si,mo);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!si.test(a)){let l=a.replace(uo,ho);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=v0}return new i(n,t)}function ho(e){return"-"+e.toLowerCase()}function mo(e){return e.charAt(1).toUpperCase()}const Wa=qa([Ha,lo,$a,Ua,_a],"html"),tn=qa([Ha,so,$a,Ua,_a],"svg");function oi(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function fo(e){return e.join(" ").trim()}var Gt={},yn,ui;function po(){if(ui)return yn;ui=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,s=/^\s+|\s+$/g,o=` +import{j as gn}from"./router-Bz250laD.js";import{g as Oa}from"./react-vendor-BmxF9s7Q.js";function ni(e){const t=[],r=String(e||"");let n=r.indexOf(","),i=0,a=!1;for(;!a;){n===-1&&(n=r.length,a=!0);const l=r.slice(i,n).trim();(l||!a)&&t.push(l),i=n+1,n=r.indexOf(",",i)}return t}function Js(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const eo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,to=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ro={};function ii(e,t){return(ro.jsx?to:eo).test(e)}const no=/[ \t\n\f\r]/g;function io(e){return typeof e=="object"?e.type==="text"?ai(e.value):!1:ai(e)}function ai(e){return e.replace(no,"")===""}class Sr{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}Sr.prototype.normal={};Sr.prototype.property={};Sr.prototype.space=void 0;function qa(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new Sr(r,n,t)}function yr(e){return e.toLowerCase()}class He{constructor(t,r){this.attribute=r,this.property=t}}He.prototype.attribute="";He.prototype.booleanish=!1;He.prototype.boolean=!1;He.prototype.commaOrSpaceSeparated=!1;He.prototype.commaSeparated=!1;He.prototype.defined=!1;He.prototype.mustUseProperty=!1;He.prototype.number=!1;He.prototype.overloadedBoolean=!1;He.prototype.property="";He.prototype.spaceSeparated=!1;He.prototype.space=void 0;let ao=0;const te=qt(),Ae=qt(),Kn=qt(),R=qt(),pe=qt(),Kt=qt(),Ue=qt();function qt(){return 2**++ao}const Zn=Object.freeze(Object.defineProperty({__proto__:null,boolean:te,booleanish:Ae,commaOrSpaceSeparated:Ue,commaSeparated:Kt,number:R,overloadedBoolean:Kn,spaceSeparated:pe},Symbol.toStringTag,{value:"Module"})),vn=Object.keys(Zn);class v0 extends He{constructor(t,r,n,i){let a=-1;if(super(t,r),li(this,"space",i),typeof n=="number")for(;++a4&&r.slice(0,4)==="data"&&co.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(si,mo);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!si.test(a)){let l=a.replace(uo,ho);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=v0}return new i(n,t)}function ho(e){return"-"+e.toLowerCase()}function mo(e){return e.charAt(1).toUpperCase()}const Wa=qa([Ha,lo,$a,Ua,_a],"html"),tn=qa([Ha,so,$a,Ua,_a],"svg");function oi(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function fo(e){return e.join(" ").trim()}var Gt={},yn,ui;function po(){if(ui)return yn;ui=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,s=/^\s+|\s+$/g,o=` `,u="/",h="*",m="",d="comment",p="declaration";function y(M,S){if(typeof M!="string")throw new TypeError("First argument must be a string");if(!M)return[];S=S||{};var z=1,I=1;function V(Y){var q=Y.match(t);q&&(z+=q.length);var ae=Y.lastIndexOf(o);I=~ae?Y.length-ae:I+Y.length}function O(){var Y={line:z,column:I};return function(q){return q.position=new E(Y),U(),q}}function E(Y){this.start=Y,this.end={line:z,column:I},this.source=S.source}E.prototype.content=M;function G(Y){var q=new Error(S.source+":"+z+":"+I+": "+Y);if(q.reason=Y,q.filename=S.source,q.line=z,q.column=I,q.source=M,!S.silent)throw q}function K(Y){var q=Y.exec(M);if(q){var ae=q[0];return V(ae),M=M.slice(ae.length),q}}function U(){K(r)}function D(Y){var q;for(Y=Y||[];q=$();)q!==!1&&Y.push(q);return Y}function $(){var Y=O();if(!(u!=M.charAt(0)||h!=M.charAt(1))){for(var q=2;m!=M.charAt(q)&&(h!=M.charAt(q)||u!=M.charAt(q+1));)++q;if(q+=2,m===M.charAt(q-1))return G("End of comment missing");var ae=M.slice(2,q-2);return I+=2,V(ae),M=M.slice(q),I+=2,Y({type:d,comment:ae})}}function j(){var Y=O(),q=K(n);if(q){if($(),!K(i))return G("property missing ':'");var ae=K(a),fe=Y({type:p,property:w(q[0].replace(e,m)),value:ae?w(ae[0].replace(e,m)):m});return K(l),fe}}function ie(){var Y=[];D(Y);for(var q;q=j();)q!==!1&&(Y.push(q),D(Y));return Y}return U(),ie()}function w(M){return M?M.replace(s,m):m}return yn=y,yn}var ci;function go(){if(ci)return Gt;ci=1;var e=Gt&&Gt.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.default=r;const t=e(po());function r(n,i){let a=null;if(!n||typeof n!="string")return a;const l=(0,t.default)(n),s=typeof i=="function";return l.forEach(o=>{if(o.type!=="declaration")return;const{property:u,value:h}=o;s?i(u,h,o):h&&(a=a||{},a[u]=h)}),a}return Gt}var ur={},hi;function vo(){if(hi)return ur;hi=1,Object.defineProperty(ur,"__esModule",{value:!0}),ur.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(u){return!u||r.test(u)||e.test(u)},l=function(u,h){return h.toUpperCase()},s=function(u,h){return"".concat(h,"-")},o=function(u,h){return h===void 0&&(h={}),a(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(i,s):u=u.replace(n,s),u.replace(t,l))};return ur.camelCase=o,ur}var cr,mi;function yo(){if(mi)return cr;mi=1;var e=cr&&cr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(go()),r=vo();function n(i,a){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(s,o){s&&o&&(l[(0,r.camelCase)(s,a)]=o)}),l}return n.default=n,cr=n,cr}var bo=yo();const xo=Oa(bo),Ya=Xa("end"),y0=Xa("start");function Xa(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function wo(e){const t=y0(e),r=Ya(e);if(t&&r)return{start:t,end:r}}function pr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?fi(e.position):"start"in e||"end"in e?fi(e):"line"in e||"column"in e?Qn(e):""}function Qn(e){return pi(e&&e.line)+":"+pi(e&&e.column)}function fi(e){return Qn(e&&e.start)+"-"+Qn(e&&e.end)}function pi(e){return e&&typeof e=="number"?e:1}class Ee extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},l=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof t=="string"?i=t:!a.cause&&t&&(l=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof n=="string"){const o=n.indexOf(":");o===-1?a.ruleId=n:(a.source=n.slice(0,o),a.ruleId=n.slice(o+1))}if(!a.place&&a.ancestors&&a.ancestors){const o=a.ancestors[a.ancestors.length-1];o&&(a.place=o.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=pr(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ee.prototype.file="";Ee.prototype.name="";Ee.prototype.reason="";Ee.prototype.message="";Ee.prototype.stack="";Ee.prototype.column=void 0;Ee.prototype.line=void 0;Ee.prototype.ancestors=void 0;Ee.prototype.cause=void 0;Ee.prototype.fatal=void 0;Ee.prototype.place=void 0;Ee.prototype.ruleId=void 0;Ee.prototype.source=void 0;const b0={}.hasOwnProperty,ko=new Map,So=/[A-Z]/g,Ao=new Set(["table","tbody","thead","tfoot","tr"]),To=new Set(["td","th"]),Ka="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function zo(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=Fo(r,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");n=No(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?tn:Wa,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Za(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Za(e,t,r){if(t.type==="element")return Mo(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Co(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Do(e,t,r);if(t.type==="mdxjsEsm")return Eo(e,t);if(t.type==="root")return Io(e,t,r);if(t.type==="text")return Bo(e,t)}function Mo(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=tn,e.schema=i),e.ancestors.push(t);const a=Ja(e,t.tagName,!1),l=Lo(e,t);let s=w0(e,t);return Ao.has(t.tagName)&&(s=s.filter(function(o){return typeof o=="string"?!io(o):!0})),Qa(e,l,a,t),x0(l,s),e.ancestors.pop(),e.schema=n,e.create(t,a,l,r)}function Co(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}br(e,t.position)}function Eo(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);br(e,t.position)}function Do(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=tn,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:Ja(e,t.name,!0),l=Ro(e,t),s=w0(e,t);return Qa(e,l,a,t),x0(l,s),e.ancestors.pop(),e.schema=n,e.create(t,a,l,r)}function Io(e,t,r){const n={};return x0(n,w0(e,t)),e.create(t,e.Fragment,n,r)}function Bo(e,t){return t.value}function Qa(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function x0(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function No(e,t,r){return n;function n(i,a,l,s){const u=Array.isArray(l.children)?r:t;return s?u(a,l,s):u(a,l)}}function Fo(e,t){return r;function r(n,i,a,l){const s=Array.isArray(a.children),o=y0(n);return t(i,a,l,s,{columnNumber:o?o.column-1:void 0,fileName:e,lineNumber:o?o.line:void 0},void 0)}}function Lo(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&b0.call(t.properties,i)){const a=Po(e,i,t.properties[i]);if(a){const[l,s]=a;e.tableCellAlignToStyle&&l==="align"&&typeof s=="string"&&To.has(t.tagName)?n=s:r[l]=s}}if(n){const a=r.style||(r.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function Ro(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const a=n.data.estree.body[0];a.type;const l=a.expression;l.type;const s=l.properties[0];s.type,Object.assign(r,e.evaluater.evaluateExpression(s.argument))}else br(e,t.position);else{const i=n.name;let a;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const s=n.value.data.estree.body[0];s.type,a=e.evaluater.evaluateExpression(s.expression)}else br(e,t.position);else a=n.value===null?!0:n.value;r[i]=a}return r}function w0(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:ko;for(;++ni?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)l=Array.from(n),l.unshift(t,r),e.splice(...l);else for(r&&e.splice(t,r);a0?(Ge(e,e.length,0,t),e):t}const vi={}.hasOwnProperty;function tl(e){const t={};let r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function it(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ne=It(/[A-Za-z]/),Ce=It(/[\dA-Za-z]/),Go=It(/[#-'*+\--9=?A-Z^-~]/);function Gr(e){return e!==null&&(e<32||e===127)}const Jn=It(/\d/),Wo=It(/[\dA-Fa-f]/),Yo=It(/[!-/:-@[-`{-~]/);function X(e){return e!==null&&e<-2}function he(e){return e!==null&&(e<0||e===32)}function le(e){return e===-2||e===-1||e===32}const rn=It(new RegExp("\\p{P}|\\p{S}","u")),Ot=It(/\s/);function It(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function tr(e){const t=[];let r=-1,n=0,i=0;for(;++r55295&&a<57344){const s=e.charCodeAt(r+1);a<56320&&s>56319&&s<57344?(l=String.fromCharCode(a,s),i=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(n,r),encodeURIComponent(l)),n=r+i+1,l=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function ne(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(o){return le(o)?(e.enter(r),s(o)):t(o)}function s(o){return le(o)&&a++l))return;const G=t.events.length;let K=G,U,D;for(;K--;)if(t.events[K][0]==="exit"&&t.events[K][1].type==="chunkFlow"){if(U){D=t.events[K][1].end;break}U=!0}for(S(n),E=G;EI;){const O=r[V];t.containerState=O[1],O[0].exit.call(t,e)}r.length=I}function z(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Jo(e,t,r){return ne(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qt(e){if(e===null||he(e)||Ot(e))return 1;if(rn(e))return 2}function nn(e,t,r){const n=[];let i=-1;for(;++i1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const m={...e[n][1].end},d={...e[r][1].start};bi(m,-o),bi(d,o),l={type:o>1?"strongSequence":"emphasisSequence",start:m,end:{...e[n][1].end}},s={type:o>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:d},a={type:o>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:o>1?"strong":"emphasis",start:{...l.start},end:{...s.end}},e[n][1].end={...l.start},e[r][1].start={...s.end},u=[],e[n][1].end.offset-e[n][1].start.offset&&(u=Ke(u,[["enter",e[n][1],t],["exit",e[n][1],t]])),u=Ke(u,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",a,t]]),u=Ke(u,nn(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),u=Ke(u,[["exit",a,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(h=2,u=Ke(u,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,Ge(e,n-1,r-n+3,u),r=n+u.length-h-2;break}}for(r=-1;++r0&&le(E)?ne(e,z,"linePrefix",a+1)(E):z(E)}function z(E){return E===null||X(E)?e.check(xi,w,V)(E):(e.enter("codeFlowValue"),I(E))}function I(E){return E===null||X(E)?(e.exit("codeFlowValue"),z(E)):(e.consume(E),I)}function V(E){return e.exit("codeFenced"),t(E)}function O(E,G,K){let U=0;return D;function D(q){return E.enter("lineEnding"),E.consume(q),E.exit("lineEnding"),$}function $(q){return E.enter("codeFencedFence"),le(q)?ne(E,j,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):j(q)}function j(q){return q===s?(E.enter("codeFencedFenceSequence"),ie(q)):K(q)}function ie(q){return q===s?(U++,E.consume(q),ie):U>=l?(E.exit("codeFencedFenceSequence"),le(q)?ne(E,Y,"whitespace")(q):Y(q)):K(q)}function Y(q){return q===null||X(q)?(E.exit("codeFencedFence"),G(q)):K(q)}}}function hu(e,t,r){const n=this;return i;function i(l){return l===null?r(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return n.parser.lazy[n.now().line]?r(l):t(l)}}const xn={name:"codeIndented",tokenize:fu},mu={partial:!0,tokenize:pu};function fu(e,t,r){const n=this;return i;function i(u){return e.enter("codeIndented"),ne(e,a,"linePrefix",5)(u)}function a(u){const h=n.events[n.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?l(u):r(u)}function l(u){return u===null?o(u):X(u)?e.attempt(mu,l,o)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||X(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),s)}function o(u){return e.exit("codeIndented"),t(u)}}function pu(e,t,r){const n=this;return i;function i(l){return n.parser.lazy[n.now().line]?r(l):X(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):ne(e,a,"linePrefix",5)(l)}function a(l){const s=n.events[n.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(l):X(l)?i(l):r(l)}}const du={name:"codeText",previous:vu,resolve:gu,tokenize:yu};function gu(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n=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 tthis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&hr(this.left,n),a.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),hr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),hr(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=4?t(l):e.interrupt(n.parser.constructs.flow,r,t)(l)}}function sl(e,t,r,n,i,a,l,s,o){const u=o||Number.POSITIVE_INFINITY;let h=0;return m;function m(S){return S===60?(e.enter(n),e.enter(i),e.enter(a),e.consume(S),e.exit(a),d):S===null||S===32||S===41||Gr(S)?r(S):(e.enter(n),e.enter(l),e.enter(s),e.enter("chunkString",{contentType:"string"}),w(S))}function d(S){return S===62?(e.enter(a),e.consume(S),e.exit(a),e.exit(i),e.exit(n),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===62?(e.exit("chunkString"),e.exit(s),d(S)):S===null||S===60||X(S)?r(S):(e.consume(S),S===92?y:p)}function y(S){return S===60||S===62||S===92?(e.consume(S),p):p(S)}function w(S){return!h&&(S===null||S===41||he(S))?(e.exit("chunkString"),e.exit(s),e.exit(l),e.exit(n),t(S)):h999||p===null||p===91||p===93&&!o||p===94&&!s&&"_hiddenFootnoteSupport"in l.parser.constructs?r(p):p===93?(e.exit(a),e.enter(i),e.consume(p),e.exit(i),e.exit(n),t):X(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||X(p)||s++>999?(e.exit("chunkString"),h(p)):(e.consume(p),o||(o=!le(p)),p===92?d:m)}function d(p){return p===91||p===92||p===93?(e.consume(p),s++,m):m(p)}}function ul(e,t,r,n,i,a){let l;return s;function s(d){return d===34||d===39||d===40?(e.enter(n),e.enter(i),e.consume(d),e.exit(i),l=d===40?41:d,o):r(d)}function o(d){return d===l?(e.enter(i),e.consume(d),e.exit(i),e.exit(n),t):(e.enter(a),u(d))}function u(d){return d===l?(e.exit(a),o(l)):d===null?r(d):X(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===l||d===null||X(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?m:h)}function m(d){return d===l||d===92?(e.consume(d),h):h(d)}}function dr(e,t){let r;return n;function n(i){return X(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):le(i)?ne(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const zu={name:"definition",tokenize:Cu},Mu={partial:!0,tokenize:Eu};function Cu(e,t,r){const n=this;let i;return a;function a(p){return e.enter("definition"),l(p)}function l(p){return ol.call(n,e,s,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=it(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),o):r(p)}function o(p){return he(p)?dr(e,u)(p):u(p)}function u(p){return sl(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return e.attempt(Mu,m,m)(p)}function m(p){return le(p)?ne(e,d,"whitespace")(p):d(p)}function d(p){return p===null||X(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function Eu(e,t,r){return n;function n(s){return he(s)?dr(e,i)(s):r(s)}function i(s){return ul(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return le(s)?ne(e,l,"whitespace")(s):l(s)}function l(s){return s===null||X(s)?t(s):r(s)}}const Du={name:"hardBreakEscape",tokenize:Iu};function Iu(e,t,r){return n;function n(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return X(a)?(e.exit("hardBreakEscape"),t(a)):r(a)}}const Bu={name:"headingAtx",resolve:Nu,tokenize:Fu};function Nu(e,t){let r=e.length-2,n=3,i,a;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},a={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Ge(e,n,r-n+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function Fu(e,t,r){let n=0;return i;function i(h){return e.enter("atxHeading"),a(h)}function a(h){return e.enter("atxHeadingSequence"),l(h)}function l(h){return h===35&&n++<6?(e.consume(h),l):h===null||he(h)?(e.exit("atxHeadingSequence"),s(h)):r(h)}function s(h){return h===35?(e.enter("atxHeadingSequence"),o(h)):h===null||X(h)?(e.exit("atxHeading"),t(h)):le(h)?ne(e,s,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function o(h){return h===35?(e.consume(h),o):(e.exit("atxHeadingSequence"),s(h))}function u(h){return h===null||h===35||he(h)?(e.exit("atxHeadingText"),s(h)):(e.consume(h),u)}}const Lu=["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"],ki=["pre","script","style","textarea"],Ru={concrete:!0,name:"htmlFlow",resolveTo:qu,tokenize:Hu},Pu={partial:!0,tokenize:ju},Ou={partial:!0,tokenize:Vu};function qu(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 Hu(e,t,r){const n=this;let i,a,l,s,o;return u;function u(A){return h(A)}function h(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),m}function m(A){return A===33?(e.consume(A),d):A===47?(e.consume(A),a=!0,w):A===63?(e.consume(A),i=3,n.interrupt?t:k):Ne(A)?(e.consume(A),l=String.fromCharCode(A),M):r(A)}function d(A){return A===45?(e.consume(A),i=2,p):A===91?(e.consume(A),i=5,s=0,y):Ne(A)?(e.consume(A),i=4,n.interrupt?t:k):r(A)}function p(A){return A===45?(e.consume(A),n.interrupt?t:k):r(A)}function y(A){const De="CDATA[";return A===De.charCodeAt(s++)?(e.consume(A),s===De.length?n.interrupt?t:j:y):r(A)}function w(A){return Ne(A)?(e.consume(A),l=String.fromCharCode(A),M):r(A)}function M(A){if(A===null||A===47||A===62||he(A)){const De=A===47,Re=l.toLowerCase();return!De&&!a&&ki.includes(Re)?(i=1,n.interrupt?t(A):j(A)):Lu.includes(l.toLowerCase())?(i=6,De?(e.consume(A),S):n.interrupt?t(A):j(A)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(A):a?z(A):I(A))}return A===45||Ce(A)?(e.consume(A),l+=String.fromCharCode(A),M):r(A)}function S(A){return A===62?(e.consume(A),n.interrupt?t:j):r(A)}function z(A){return le(A)?(e.consume(A),z):D(A)}function I(A){return A===47?(e.consume(A),D):A===58||A===95||Ne(A)?(e.consume(A),V):le(A)?(e.consume(A),I):D(A)}function V(A){return A===45||A===46||A===58||A===95||Ce(A)?(e.consume(A),V):O(A)}function O(A){return A===61?(e.consume(A),E):le(A)?(e.consume(A),O):I(A)}function E(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),o=A,G):le(A)?(e.consume(A),E):K(A)}function G(A){return A===o?(e.consume(A),o=null,U):A===null||X(A)?r(A):(e.consume(A),G)}function K(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||he(A)?O(A):(e.consume(A),K)}function U(A){return A===47||A===62||le(A)?I(A):r(A)}function D(A){return A===62?(e.consume(A),$):r(A)}function $(A){return A===null||X(A)?j(A):le(A)?(e.consume(A),$):r(A)}function j(A){return A===45&&i===2?(e.consume(A),ae):A===60&&i===1?(e.consume(A),fe):A===62&&i===4?(e.consume(A),ke):A===63&&i===3?(e.consume(A),k):A===93&&i===5?(e.consume(A),je):X(A)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Pu,be,ie)(A)):A===null||X(A)?(e.exit("htmlFlowData"),ie(A)):(e.consume(A),j)}function ie(A){return e.check(Ou,Y,be)(A)}function Y(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),q}function q(A){return A===null||X(A)?ie(A):(e.enter("htmlFlowData"),j(A))}function ae(A){return A===45?(e.consume(A),k):j(A)}function fe(A){return A===47?(e.consume(A),l="",Me):j(A)}function Me(A){if(A===62){const De=l.toLowerCase();return ki.includes(De)?(e.consume(A),ke):j(A)}return Ne(A)&&l.length<8?(e.consume(A),l+=String.fromCharCode(A),Me):j(A)}function je(A){return A===93?(e.consume(A),k):j(A)}function k(A){return A===62?(e.consume(A),ke):A===45&&i===2?(e.consume(A),k):j(A)}function ke(A){return A===null||X(A)?(e.exit("htmlFlowData"),be(A)):(e.consume(A),ke)}function be(A){return e.exit("htmlFlow"),t(A)}}function Vu(e,t,r){const n=this;return i;function i(l){return X(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):r(l)}function a(l){return n.parser.lazy[n.now().line]?r(l):t(l)}}function ju(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ar,t,r)}}const $u={name:"htmlText",tokenize:Uu};function Uu(e,t,r){const n=this;let i,a,l;return s;function s(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),o}function o(k){return k===33?(e.consume(k),u):k===47?(e.consume(k),O):k===63?(e.consume(k),I):Ne(k)?(e.consume(k),K):r(k)}function u(k){return k===45?(e.consume(k),h):k===91?(e.consume(k),a=0,y):Ne(k)?(e.consume(k),z):r(k)}function h(k){return k===45?(e.consume(k),p):r(k)}function m(k){return k===null?r(k):k===45?(e.consume(k),d):X(k)?(l=m,fe(k)):(e.consume(k),m)}function d(k){return k===45?(e.consume(k),p):m(k)}function p(k){return k===62?ae(k):k===45?d(k):m(k)}function y(k){const ke="CDATA[";return k===ke.charCodeAt(a++)?(e.consume(k),a===ke.length?w:y):r(k)}function w(k){return k===null?r(k):k===93?(e.consume(k),M):X(k)?(l=w,fe(k)):(e.consume(k),w)}function M(k){return k===93?(e.consume(k),S):w(k)}function S(k){return k===62?ae(k):k===93?(e.consume(k),S):w(k)}function z(k){return k===null||k===62?ae(k):X(k)?(l=z,fe(k)):(e.consume(k),z)}function I(k){return k===null?r(k):k===63?(e.consume(k),V):X(k)?(l=I,fe(k)):(e.consume(k),I)}function V(k){return k===62?ae(k):I(k)}function O(k){return Ne(k)?(e.consume(k),E):r(k)}function E(k){return k===45||Ce(k)?(e.consume(k),E):G(k)}function G(k){return X(k)?(l=G,fe(k)):le(k)?(e.consume(k),G):ae(k)}function K(k){return k===45||Ce(k)?(e.consume(k),K):k===47||k===62||he(k)?U(k):r(k)}function U(k){return k===47?(e.consume(k),ae):k===58||k===95||Ne(k)?(e.consume(k),D):X(k)?(l=U,fe(k)):le(k)?(e.consume(k),U):ae(k)}function D(k){return k===45||k===46||k===58||k===95||Ce(k)?(e.consume(k),D):$(k)}function $(k){return k===61?(e.consume(k),j):X(k)?(l=$,fe(k)):le(k)?(e.consume(k),$):U(k)}function j(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(e.consume(k),i=k,ie):X(k)?(l=j,fe(k)):le(k)?(e.consume(k),j):(e.consume(k),Y)}function ie(k){return k===i?(e.consume(k),i=void 0,q):k===null?r(k):X(k)?(l=ie,fe(k)):(e.consume(k),ie)}function Y(k){return k===null||k===34||k===39||k===60||k===61||k===96?r(k):k===47||k===62||he(k)?U(k):(e.consume(k),Y)}function q(k){return k===47||k===62||he(k)?U(k):r(k)}function ae(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):r(k)}function fe(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),Me}function Me(k){return le(k)?ne(e,je,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):je(k)}function je(k){return e.enter("htmlTextData"),l(k)}}const A0={name:"labelEnd",resolveAll:Yu,resolveTo:Xu,tokenize:Ku},_u={tokenize:Zu},Gu={tokenize:Qu},Wu={tokenize:Ju};function Yu(e){let t=-1;const r=[];for(;++t=3&&(u===null||X(u))?(e.exit("thematicBreak"),t(u)):r(u)}function o(u){return u===i?(e.consume(u),n++,o):(e.exit("thematicBreakSequence"),le(u)?ne(e,s,"whitespace")(u):s(u))}}const Pe={continuation:{tokenize:u1},exit:h1,name:"list",tokenize:o1},l1={partial:!0,tokenize:m1},s1={partial:!0,tokenize:c1};function o1(e,t,r){const n=this,i=n.events[n.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return s;function s(p){const y=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Jn(p)){if(n.containerState.type||(n.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check($r,r,u)(p):u(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),o(p)}return r(p)}function o(p){return Jn(p)&&++l<10?(e.consume(p),o):(!n.interrupt||l<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):r(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(Ar,n.interrupt?r:h,e.attempt(l1,d,m))}function h(p){return n.containerState.initialBlankLine=!0,a++,d(p)}function m(p){return le(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),d):r(p)}function d(p){return n.containerState.size=a+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function u1(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(Ar,i,a);function i(s){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ne(e,t,"listItemIndent",n.containerState.size+1)(s)}function a(s){return n.containerState.furtherBlankLines||!le(s)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,l(s)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(s1,t,l)(s))}function l(s){return n.containerState._closeFlow=!0,n.interrupt=void 0,ne(e,e.attempt(Pe,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function c1(e,t,r){const n=this;return ne(e,i,"listItemIndent",n.containerState.size+1);function i(a){const l=n.events[n.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===n.containerState.size?t(a):r(a)}}function h1(e){e.exit(this.containerState.type)}function m1(e,t,r){const n=this;return ne(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const l=n.events[n.events.length-1];return!le(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):r(a)}}const Si={name:"setextUnderline",resolveTo:f1,tokenize:p1};function f1(e,t){let r=e.length,n,i,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!a&&e[r][1].type==="definition"&&(a=r);const l={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",l,t]),e.splice(a+1,0,["exit",e[n][1],t]),e[n][1].end={...e[a][1].end}):e[n][1]=l,e.push(["exit",l,t]),e}function p1(e,t,r){const n=this;let i;return a;function a(u){let h=n.events.length,m;for(;h--;)if(n.events[h][1].type!=="lineEnding"&&n.events[h][1].type!=="linePrefix"&&n.events[h][1].type!=="content"){m=n.events[h][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||m)?(e.enter("setextHeadingLine"),i=u,l(u)):r(u)}function l(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),le(u)?ne(e,o,"lineSuffix")(u):o(u))}function o(u){return u===null||X(u)?(e.exit("setextHeadingLine"),t(u)):r(u)}}const d1={tokenize:g1};function g1(e){const t=this,r=e.attempt(Ar,n,e.attempt(this.parser.constructs.flowInitial,i,ne(e,e.attempt(this.parser.constructs.flow,i,e.attempt(wu,i)),"linePrefix")));return r;function n(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const v1={resolveAll:hl()},y1=cl("string"),b1=cl("text");function cl(e){return{resolveAll:hl(e==="text"?x1:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],a=r.attempt(i,l,s);return l;function l(h){return u(h)?a(h):s(h)}function s(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),o}function o(h){return u(h)?(r.exit("data"),a(h)):(r.consume(h),o)}function u(h){if(h===null)return!0;const m=i[h];let d=-1;if(m)for(;++d-1){const s=l[0];typeof s=="string"?l[0]=s.slice(n):l.shift()}a>0&&l.push(e[i].slice(0,a))}return l}function N1(e,t){let r=-1;const n=[];let i;for(;++r0){const rt=ee.tokenStack[ee.tokenStack.length-1];(rt[1]||Ti).call(ee,void 0,rt[0])}for(H.position={start:At(B.length>0?B[0][1].start:{line:1,column:1,offset:0}),end:At(B.length>0?B[B.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce15?u="…"+s.slice(i-15,i):u=s.slice(0,i);var h;a+15":">","<":"<",'"':""","'":"'"},Im=/[&><"']/g;function Bm(e){return String(e).replace(Im,t=>Dm[t])}var Gl=function e(t){return t.type==="ordgroup"||t.type==="color"?t.body.length===1?e(t.body[0]):t:t.type==="font"?e(t.body):t},Nm=function(t){var r=Gl(t);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},Fm=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t},Lm=function(t){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(t);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},ue={deflt:Mm,escape:Bm,hyphenate:Em,getBaseElem:Gl,isCharacterBox:Nm,protocolFromUrl:Lm},Ur={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand ",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function Rm(e){if(e.default)return e.default;var t=e.type,r=Array.isArray(t)?t[0]:t;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class L0{constructor(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var r in Ur)if(Ur.hasOwnProperty(r)){var n=Ur[r];this[r]=t[r]!==void 0?n.processor?n.processor(t[r]):t[r]:Rm(n)}}reportNonstrict(t,r,n){var i=this.strict;if(typeof i=="function"&&(i=i(t,r,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new L("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+t+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]"))}}useStrictBehavior(t,r,n){var i=this.strict;if(typeof i=="function")try{i=i(t,r,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]")),!1)}isTrusted(t){if(t.url&&!t.protocol){var r=ue.protocolFromUrl(t.url);if(r==null)return!1;t.protocol=r}var n=typeof this.trust=="function"?this.trust(t):this.trust;return!!n}}class Tt{constructor(t,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=r,this.cramped=n}sup(){return lt[Pm[this.id]]}sub(){return lt[Om[this.id]]}fracNum(){return lt[qm[this.id]]}fracDen(){return lt[Hm[this.id]]}cramp(){return lt[Vm[this.id]]}text(){return lt[jm[this.id]]}isTight(){return this.size>=2}}var R0=0,Kr=1,Zt=2,vt=3,wr=4,Ze=5,Jt=6,Fe=7,lt=[new Tt(R0,0,!1),new Tt(Kr,0,!0),new Tt(Zt,1,!1),new Tt(vt,1,!0),new Tt(wr,2,!1),new Tt(Ze,2,!0),new Tt(Jt,3,!1),new Tt(Fe,3,!0)],Pm=[wr,Ze,wr,Ze,Jt,Fe,Jt,Fe],Om=[Ze,Ze,Ze,Ze,Fe,Fe,Fe,Fe],qm=[Zt,vt,wr,Ze,Jt,Fe,Jt,Fe],Hm=[vt,vt,Ze,Ze,Fe,Fe,Fe,Fe],Vm=[Kr,Kr,vt,vt,Ze,Ze,Fe,Fe],jm=[R0,Kr,Zt,vt,Zt,vt,Zt,vt],Q={DISPLAY:lt[R0],TEXT:lt[Zt],SCRIPT:lt[wr],SCRIPTSCRIPT:lt[Jt]},l0=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function $m(e){for(var t=0;t=i[0]&&e<=i[1])return r.name}return null}var _r=[];l0.forEach(e=>e.blocks.forEach(t=>_r.push(...t)));function Wl(e){for(var t=0;t<_r.length;t+=2)if(e>=_r[t]&&e<=_r[t+1])return!0;return!1}var Yt=80,Um=function(t,r){return"M95,"+(622+t+r)+` +`)),p+=h.move(m),d(),p}function n(a,l,s){let o=a.value||"",u=1;for(t||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(o);)u++;const h="$".repeat(u);/[^ \r\n]/.test(o)&&(/^[ \r\n]/.test(o)&&/[ \r\n]$/.test(o)||/^\$|\$$/.test(o))&&(o=" "+o+" ");let m=-1;for(;++mu&&(u=h):h&&(u!==void 0&&u>-1&&o.push(` +`.repeat(u)||" "),u=-1,o.push(h))}return o.join("")}function Kl(e,t,r){return e.type==="element"?Zm(e,t,r):e.type==="text"?r.whitespace==="normal"?Zl(e,r):Qm(e):[]}function Zm(e,t,r){const n=Ql(e,r),i=e.children||[];let a=-1,l=[];if(Xm(e))return l;let s,o;for(s0(e)||ra(e)&&Qi(t,e,ra)?o=` +`:Ym(e)?(s=2,o=2):Xl(e)&&(s=1,o=1);++a15?u="…"+s.slice(i-15,i):u=s.slice(0,i);var h;a+15":">","<":"<",'"':""","'":"'"},of=/[&><"']/g;function uf(e){return String(e).replace(of,t=>sf[t])}var Jl=function e(t){return t.type==="ordgroup"||t.type==="color"?t.body.length===1?e(t.body[0]):t:t.type==="font"?e(t.body):t},cf=function(t){var r=Jl(t);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},hf=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t},mf=function(t){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(t);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},ue={deflt:nf,escape:uf,hyphenate:lf,getBaseElem:Jl,isCharacterBox:cf,protocolFromUrl:mf},Ur={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand ",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function ff(e){if(e.default)return e.default;var t=e.type,r=Array.isArray(t)?t[0]:t;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class R0{constructor(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var r in Ur)if(Ur.hasOwnProperty(r)){var n=Ur[r];this[r]=t[r]!==void 0?n.processor?n.processor(t[r]):t[r]:ff(n)}}reportNonstrict(t,r,n){var i=this.strict;if(typeof i=="function"&&(i=i(t,r,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new L("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+t+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]"))}}useStrictBehavior(t,r,n){var i=this.strict;if(typeof i=="function")try{i=i(t,r,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]")),!1)}isTrusted(t){if(t.url&&!t.protocol){var r=ue.protocolFromUrl(t.url);if(r==null)return!1;t.protocol=r}var n=typeof this.trust=="function"?this.trust(t):this.trust;return!!n}}class Tt{constructor(t,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=r,this.cramped=n}sup(){return lt[pf[this.id]]}sub(){return lt[df[this.id]]}fracNum(){return lt[gf[this.id]]}fracDen(){return lt[vf[this.id]]}cramp(){return lt[yf[this.id]]}text(){return lt[bf[this.id]]}isTight(){return this.size>=2}}var P0=0,Kr=1,Zt=2,vt=3,wr=4,Ze=5,Jt=6,Fe=7,lt=[new Tt(P0,0,!1),new Tt(Kr,0,!0),new Tt(Zt,1,!1),new Tt(vt,1,!0),new Tt(wr,2,!1),new Tt(Ze,2,!0),new Tt(Jt,3,!1),new Tt(Fe,3,!0)],pf=[wr,Ze,wr,Ze,Jt,Fe,Jt,Fe],df=[Ze,Ze,Ze,Ze,Fe,Fe,Fe,Fe],gf=[Zt,vt,wr,Ze,Jt,Fe,Jt,Fe],vf=[vt,vt,Ze,Ze,Fe,Fe,Fe,Fe],yf=[Kr,Kr,vt,vt,Ze,Ze,Fe,Fe],bf=[P0,Kr,Zt,vt,Zt,vt,Zt,vt],Q={DISPLAY:lt[P0],TEXT:lt[Zt],SCRIPT:lt[wr],SCRIPTSCRIPT:lt[Jt]},o0=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function xf(e){for(var t=0;t=i[0]&&e<=i[1])return r.name}return null}var _r=[];o0.forEach(e=>e.blocks.forEach(t=>_r.push(...t)));function es(e){for(var t=0;t<_r.length;t+=2)if(e>=_r[t]&&e<=_r[t+1])return!0;return!1}var Yt=80,wf=function(t,r){return"M95,"+(622+t+r)+` c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 @@ -41,7 +43,7 @@ c5.3,-9.3,12,-14,20,-14 H400000v`+(40+t)+`H845.2724 s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z -M`+(834+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},_m=function(t,r){return"M263,"+(601+t+r)+`c0.7,0,18,39.7,52,119 +M`+(834+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},kf=function(t,r){return"M263,"+(601+t+r)+`c0.7,0,18,39.7,52,119 c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 c340,-704.7,510.7,-1060.3,512,-1067 l`+t/2.084+" -"+t+` @@ -51,7 +53,7 @@ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5, c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z -M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},Gm=function(t,r){return"M983 "+(10+t+r)+` +M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},Sf=function(t,r){return"M983 "+(10+t+r)+` l`+t/3.13+" -"+t+` c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+` H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 @@ -60,7 +62,7 @@ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 c53.7,-170.3,84.5,-266.8,92.5,-289.5z -M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},Wm=function(t,r){return"M424,"+(2398+t+r)+` +M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},Af=function(t,r){return"M424,"+(2398+t+r)+` c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 @@ -70,18 +72,18 @@ v`+(40+t)+`H1014.6 s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+r+` -h400000v`+(40+t)+"h-400000z"},Ym=function(t,r){return"M473,"+(2713+t+r)+` +h400000v`+(40+t)+"h-400000z"},Tf=function(t,r){return"M473,"+(2713+t+r)+` c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+` c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7 s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, -606zM`+(1001+t)+" "+r+"h400000v"+(40+t)+"H1017.7z"},Xm=function(t){var r=t/2;return"M400000 "+t+" H0 L"+r+" 0 l65 45 L145 "+(t-80)+" H400000z"},Km=function(t,r,n){var i=n-54-r-t;return"M702 "+(t+r)+"H400000"+(40+t)+` +606zM`+(1001+t)+" "+r+"h400000v"+(40+t)+"H1017.7z"},zf=function(t){var r=t/2;return"M400000 "+t+" H0 L"+r+" 0 l65 45 L145 "+(t-80)+" H400000z"},Mf=function(t,r,n){var i=n-54-r-t;return"M702 "+(t+r)+"H400000"+(40+t)+` H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 `+r+"H400000v"+(40+t)+"H742z"},Zm=function(t,r,n){r=1e3*r;var i="";switch(t){case"sqrtMain":i=Um(r,Yt);break;case"sqrtSize1":i=_m(r,Yt);break;case"sqrtSize2":i=Gm(r,Yt);break;case"sqrtSize3":i=Wm(r,Yt);break;case"sqrtSize4":i=Ym(r,Yt);break;case"sqrtTall":i=Km(r,Yt,n)}return i},Qm=function(t,r){switch(t){case"⎜":return"M291 0 H417 V"+r+" H291z M291 0 H417 V"+r+" H291z";case"∣":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z";case"∥":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z"+("M367 0 H410 V"+r+" H367z M367 0 H410 V"+r+" H367z");case"⎟":return"M457 0 H583 V"+r+" H457z M457 0 H583 V"+r+" H457z";case"⎢":return"M319 0 H403 V"+r+" H319z M319 0 H403 V"+r+" H319z";case"⎥":return"M263 0 H347 V"+r+" H263z M263 0 H347 V"+r+" H263z";case"⎪":return"M384 0 H504 V"+r+" H384z M384 0 H504 V"+r+" H384z";case"⏐":return"M312 0 H355 V"+r+" H312z M312 0 H355 V"+r+" H312z";case"‖":return"M257 0 H300 V"+r+" H257z M257 0 H300 V"+r+" H257z"+("M478 0 H521 V"+r+" H478z M478 0 H521 V"+r+" H478z");default:return""}},Xi={doubleleftarrow:`M262 157 +219 661 l218 661zM702 `+r+"H400000v"+(40+t)+"H742z"},Cf=function(t,r,n){r=1e3*r;var i="";switch(t){case"sqrtMain":i=wf(r,Yt);break;case"sqrtSize1":i=kf(r,Yt);break;case"sqrtSize2":i=Sf(r,Yt);break;case"sqrtSize3":i=Af(r,Yt);break;case"sqrtSize4":i=Tf(r,Yt);break;case"sqrtTall":i=Mf(r,Yt,n)}return i},Ef=function(t,r){switch(t){case"⎜":return"M291 0 H417 V"+r+" H291z M291 0 H417 V"+r+" H291z";case"∣":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z";case"∥":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z"+("M367 0 H410 V"+r+" H367z M367 0 H410 V"+r+" H367z");case"⎟":return"M457 0 H583 V"+r+" H457z M457 0 H583 V"+r+" H457z";case"⎢":return"M319 0 H403 V"+r+" H319z M319 0 H403 V"+r+" H319z";case"⎥":return"M263 0 H347 V"+r+" H263z M263 0 H347 V"+r+" H263z";case"⎪":return"M384 0 H504 V"+r+" H384z M384 0 H504 V"+r+" H384z";case"⏐":return"M312 0 H355 V"+r+" H312z M312 0 H355 V"+r+" H312z";case"‖":return"M257 0 H300 V"+r+" H257z M257 0 H300 V"+r+" H257z"+("M478 0 H521 V"+r+" H478z M478 0 H521 V"+r+" H478z");default:return""}},na={doubleleftarrow:`M262 157 l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 @@ -256,7 +258,7 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z` c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},Jm=function(t,r){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 h347 v-84 +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},Df=function(t,r){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 h347 v-84 H403z M403 1759 V0 H319 V1759 v`+r+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v1759 H0 v84 H347z M347 1759 V0 H263 V1759 v`+r+" v1759 h84z";case"vert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 @@ -284,12 +286,10 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6 c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Mr{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),r=0;rr.toText();return this.children.map(t).join("")}}var st={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Fr={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Ki={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function ef(e,t){st[e]=t}function P0(e,t,r){if(!st[t])throw new Error("Font metrics not found for font: "+t+".");var n=e.charCodeAt(0),i=st[t][n];if(!i&&e[0]in Ki&&(n=Ki[e[0]].charCodeAt(0),i=st[t][n]),!i&&r==="text"&&Wl(n)&&(i=st[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var Fn={};function tf(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!Fn[t]){var r=Fn[t]={cssEmPerMu:Fr.quad[t]/18};for(var n in Fr)Fr.hasOwnProperty(n)&&(r[n]=Fr[n][t])}return Fn[t]}var rf=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Zi=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Qi=function(t,r){return r.size<2?t:rf[t-1][r.size-1]};class gt{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||gt.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=Zi[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return new gt(r)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:Qi(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:Zi[t-1]})}havingBaseStyle(t){t=t||this.style.text();var r=Qi(gt.BASESIZE,t);return this.size===r&&this.textSize===gt.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==gt.BASESIZE?["sizing","reset-size"+this.size,"size"+gt.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=tf(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}gt.BASESIZE=6;var s0={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},nf={ex:!0,em:!0,mu:!0},Yl=function(t){return typeof t!="string"&&(t=t.unit),t in s0||t in nf||t==="ex"},ye=function(t,r){var n;if(t.unit in s0)n=s0[t.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(t.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var i;if(r.style.isTight()?i=r.havingStyle(r.style.text()):i=r,t.unit==="ex")n=i.fontMetrics().xHeight;else if(t.unit==="em")n=i.fontMetrics().quad;else throw new L("Invalid unit: '"+t.unit+"'");i!==r&&(n*=i.sizeMultiplier/r.sizeMultiplier)}return Math.min(t.number*n,r.maxSize)},P=function(t){return+t.toFixed(4)+"em"},Ct=function(t){return t.filter(r=>r).join(" ")},Xl=function(t,r,n){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var i=r.getColor();i&&(this.style.color=i)}},Kl=function(t){var r=document.createElement(t);r.className=Ct(this.classes);for(var n in this.style)this.style.hasOwnProperty(n)&&(r.style[n]=this.style[n]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&r.setAttribute(i,this.attributes[i]);for(var a=0;a/=\x00-\x1f]/,Zl=function(t){var r="<"+t;this.classes.length&&(r+=' class="'+ue.escape(Ct(this.classes))+'"');var n="";for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=ue.hyphenate(i)+":"+this.style[i]+";");n&&(r+=' style="'+ue.escape(n)+'"');for(var a in this.attributes)if(this.attributes.hasOwnProperty(a)){if(af.test(a))throw new L("Invalid attribute name '"+a+"'");r+=" "+a+'="'+ue.escape(this.attributes[a])+'"'}r+=">";for(var l=0;l",r};class Cr{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,Xl.call(this,t,n,i),this.children=r||[]}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return Kl.call(this,"span")}toMarkup(){return Zl.call(this,"span")}}class O0{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Xl.call(this,r,i),this.children=n||[],this.setAttribute("href",t)}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return Kl.call(this,"a")}toMarkup(){return Zl.call(this,"a")}}class lf{constructor(t,r,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=t,this.classes=["mord"],this.style=n}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(var r in this.style)this.style.hasOwnProperty(r)&&(t.style[r]=this.style[r]);return t}toMarkup(){var t=''+ue.escape(this.alt)+'0&&(r=document.createElement("span"),r.style.marginRight=P(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=Ct(this.classes));for(var n in this.style)this.style.hasOwnProperty(n)&&(r=r||document.createElement("span"),r.style[n]=this.style[n]);return r?(r.appendChild(t),r):t}toMarkup(){var t=!1,r="0&&(n+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=ue.hyphenate(i)+":"+this.style[i]+";");n&&(t=!0,r+=' style="'+ue.escape(n)+'"');var a=ue.escape(this.text);return t?(r+=">",r+=a,r+="",r):a}}class bt{constructor(t,r){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=r||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"svg");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&r.setAttribute(n,this.attributes[n]);for(var i=0;i':''}}class o0{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"line");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var t=" but got "+String(e)+".")}var uf={bin:1,close:1,inner:1,open:1,punct:1,rel:1},cf={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},de={math:{},text:{}};function c(e,t,r,n,i,a){de[e][i]={font:t,group:r,replace:n},a&&n&&(de[e][n]=de[e][i])}var f="math",N="text",g="main",b="ams",ge="accent-token",W="bin",Le="close",rr="inner",Z="mathord",Te="op-token",Ye="open",sn="punct",x="rel",St="spacing",T="textord";c(f,g,x,"≡","\\equiv",!0);c(f,g,x,"≺","\\prec",!0);c(f,g,x,"≻","\\succ",!0);c(f,g,x,"∼","\\sim",!0);c(f,g,x,"⊥","\\perp");c(f,g,x,"⪯","\\preceq",!0);c(f,g,x,"⪰","\\succeq",!0);c(f,g,x,"≃","\\simeq",!0);c(f,g,x,"∣","\\mid",!0);c(f,g,x,"≪","\\ll",!0);c(f,g,x,"≫","\\gg",!0);c(f,g,x,"≍","\\asymp",!0);c(f,g,x,"∥","\\parallel");c(f,g,x,"⋈","\\bowtie",!0);c(f,g,x,"⌣","\\smile",!0);c(f,g,x,"⊑","\\sqsubseteq",!0);c(f,g,x,"⊒","\\sqsupseteq",!0);c(f,g,x,"≐","\\doteq",!0);c(f,g,x,"⌢","\\frown",!0);c(f,g,x,"∋","\\ni",!0);c(f,g,x,"∝","\\propto",!0);c(f,g,x,"⊢","\\vdash",!0);c(f,g,x,"⊣","\\dashv",!0);c(f,g,x,"∋","\\owns");c(f,g,sn,".","\\ldotp");c(f,g,sn,"⋅","\\cdotp");c(f,g,T,"#","\\#");c(N,g,T,"#","\\#");c(f,g,T,"&","\\&");c(N,g,T,"&","\\&");c(f,g,T,"ℵ","\\aleph",!0);c(f,g,T,"∀","\\forall",!0);c(f,g,T,"ℏ","\\hbar",!0);c(f,g,T,"∃","\\exists",!0);c(f,g,T,"∇","\\nabla",!0);c(f,g,T,"♭","\\flat",!0);c(f,g,T,"ℓ","\\ell",!0);c(f,g,T,"♮","\\natural",!0);c(f,g,T,"♣","\\clubsuit",!0);c(f,g,T,"℘","\\wp",!0);c(f,g,T,"♯","\\sharp",!0);c(f,g,T,"♢","\\diamondsuit",!0);c(f,g,T,"ℜ","\\Re",!0);c(f,g,T,"♡","\\heartsuit",!0);c(f,g,T,"ℑ","\\Im",!0);c(f,g,T,"♠","\\spadesuit",!0);c(f,g,T,"§","\\S",!0);c(N,g,T,"§","\\S");c(f,g,T,"¶","\\P",!0);c(N,g,T,"¶","\\P");c(f,g,T,"†","\\dag");c(N,g,T,"†","\\dag");c(N,g,T,"†","\\textdagger");c(f,g,T,"‡","\\ddag");c(N,g,T,"‡","\\ddag");c(N,g,T,"‡","\\textdaggerdbl");c(f,g,Le,"⎱","\\rmoustache",!0);c(f,g,Ye,"⎰","\\lmoustache",!0);c(f,g,Le,"⟯","\\rgroup",!0);c(f,g,Ye,"⟮","\\lgroup",!0);c(f,g,W,"∓","\\mp",!0);c(f,g,W,"⊖","\\ominus",!0);c(f,g,W,"⊎","\\uplus",!0);c(f,g,W,"⊓","\\sqcap",!0);c(f,g,W,"∗","\\ast");c(f,g,W,"⊔","\\sqcup",!0);c(f,g,W,"◯","\\bigcirc",!0);c(f,g,W,"∙","\\bullet",!0);c(f,g,W,"‡","\\ddagger");c(f,g,W,"≀","\\wr",!0);c(f,g,W,"⨿","\\amalg");c(f,g,W,"&","\\And");c(f,g,x,"⟵","\\longleftarrow",!0);c(f,g,x,"⇐","\\Leftarrow",!0);c(f,g,x,"⟸","\\Longleftarrow",!0);c(f,g,x,"⟶","\\longrightarrow",!0);c(f,g,x,"⇒","\\Rightarrow",!0);c(f,g,x,"⟹","\\Longrightarrow",!0);c(f,g,x,"↔","\\leftrightarrow",!0);c(f,g,x,"⟷","\\longleftrightarrow",!0);c(f,g,x,"⇔","\\Leftrightarrow",!0);c(f,g,x,"⟺","\\Longleftrightarrow",!0);c(f,g,x,"↦","\\mapsto",!0);c(f,g,x,"⟼","\\longmapsto",!0);c(f,g,x,"↗","\\nearrow",!0);c(f,g,x,"↩","\\hookleftarrow",!0);c(f,g,x,"↪","\\hookrightarrow",!0);c(f,g,x,"↘","\\searrow",!0);c(f,g,x,"↼","\\leftharpoonup",!0);c(f,g,x,"⇀","\\rightharpoonup",!0);c(f,g,x,"↙","\\swarrow",!0);c(f,g,x,"↽","\\leftharpoondown",!0);c(f,g,x,"⇁","\\rightharpoondown",!0);c(f,g,x,"↖","\\nwarrow",!0);c(f,g,x,"⇌","\\rightleftharpoons",!0);c(f,b,x,"≮","\\nless",!0);c(f,b,x,"","\\@nleqslant");c(f,b,x,"","\\@nleqq");c(f,b,x,"⪇","\\lneq",!0);c(f,b,x,"≨","\\lneqq",!0);c(f,b,x,"","\\@lvertneqq");c(f,b,x,"⋦","\\lnsim",!0);c(f,b,x,"⪉","\\lnapprox",!0);c(f,b,x,"⊀","\\nprec",!0);c(f,b,x,"⋠","\\npreceq",!0);c(f,b,x,"⋨","\\precnsim",!0);c(f,b,x,"⪹","\\precnapprox",!0);c(f,b,x,"≁","\\nsim",!0);c(f,b,x,"","\\@nshortmid");c(f,b,x,"∤","\\nmid",!0);c(f,b,x,"⊬","\\nvdash",!0);c(f,b,x,"⊭","\\nvDash",!0);c(f,b,x,"⋪","\\ntriangleleft");c(f,b,x,"⋬","\\ntrianglelefteq",!0);c(f,b,x,"⊊","\\subsetneq",!0);c(f,b,x,"","\\@varsubsetneq");c(f,b,x,"⫋","\\subsetneqq",!0);c(f,b,x,"","\\@varsubsetneqq");c(f,b,x,"≯","\\ngtr",!0);c(f,b,x,"","\\@ngeqslant");c(f,b,x,"","\\@ngeqq");c(f,b,x,"⪈","\\gneq",!0);c(f,b,x,"≩","\\gneqq",!0);c(f,b,x,"","\\@gvertneqq");c(f,b,x,"⋧","\\gnsim",!0);c(f,b,x,"⪊","\\gnapprox",!0);c(f,b,x,"⊁","\\nsucc",!0);c(f,b,x,"⋡","\\nsucceq",!0);c(f,b,x,"⋩","\\succnsim",!0);c(f,b,x,"⪺","\\succnapprox",!0);c(f,b,x,"≆","\\ncong",!0);c(f,b,x,"","\\@nshortparallel");c(f,b,x,"∦","\\nparallel",!0);c(f,b,x,"⊯","\\nVDash",!0);c(f,b,x,"⋫","\\ntriangleright");c(f,b,x,"⋭","\\ntrianglerighteq",!0);c(f,b,x,"","\\@nsupseteqq");c(f,b,x,"⊋","\\supsetneq",!0);c(f,b,x,"","\\@varsupsetneq");c(f,b,x,"⫌","\\supsetneqq",!0);c(f,b,x,"","\\@varsupsetneqq");c(f,b,x,"⊮","\\nVdash",!0);c(f,b,x,"⪵","\\precneqq",!0);c(f,b,x,"⪶","\\succneqq",!0);c(f,b,x,"","\\@nsubseteqq");c(f,b,W,"⊴","\\unlhd");c(f,b,W,"⊵","\\unrhd");c(f,b,x,"↚","\\nleftarrow",!0);c(f,b,x,"↛","\\nrightarrow",!0);c(f,b,x,"⇍","\\nLeftarrow",!0);c(f,b,x,"⇏","\\nRightarrow",!0);c(f,b,x,"↮","\\nleftrightarrow",!0);c(f,b,x,"⇎","\\nLeftrightarrow",!0);c(f,b,x,"△","\\vartriangle");c(f,b,T,"ℏ","\\hslash");c(f,b,T,"▽","\\triangledown");c(f,b,T,"◊","\\lozenge");c(f,b,T,"Ⓢ","\\circledS");c(f,b,T,"®","\\circledR");c(N,b,T,"®","\\circledR");c(f,b,T,"∡","\\measuredangle",!0);c(f,b,T,"∄","\\nexists");c(f,b,T,"℧","\\mho");c(f,b,T,"Ⅎ","\\Finv",!0);c(f,b,T,"⅁","\\Game",!0);c(f,b,T,"‵","\\backprime");c(f,b,T,"▲","\\blacktriangle");c(f,b,T,"▼","\\blacktriangledown");c(f,b,T,"■","\\blacksquare");c(f,b,T,"⧫","\\blacklozenge");c(f,b,T,"★","\\bigstar");c(f,b,T,"∢","\\sphericalangle",!0);c(f,b,T,"∁","\\complement",!0);c(f,b,T,"ð","\\eth",!0);c(N,g,T,"ð","ð");c(f,b,T,"╱","\\diagup");c(f,b,T,"╲","\\diagdown");c(f,b,T,"□","\\square");c(f,b,T,"□","\\Box");c(f,b,T,"◊","\\Diamond");c(f,b,T,"¥","\\yen",!0);c(N,b,T,"¥","\\yen",!0);c(f,b,T,"✓","\\checkmark",!0);c(N,b,T,"✓","\\checkmark");c(f,b,T,"ℶ","\\beth",!0);c(f,b,T,"ℸ","\\daleth",!0);c(f,b,T,"ℷ","\\gimel",!0);c(f,b,T,"ϝ","\\digamma",!0);c(f,b,T,"ϰ","\\varkappa");c(f,b,Ye,"┌","\\@ulcorner",!0);c(f,b,Le,"┐","\\@urcorner",!0);c(f,b,Ye,"└","\\@llcorner",!0);c(f,b,Le,"┘","\\@lrcorner",!0);c(f,b,x,"≦","\\leqq",!0);c(f,b,x,"⩽","\\leqslant",!0);c(f,b,x,"⪕","\\eqslantless",!0);c(f,b,x,"≲","\\lesssim",!0);c(f,b,x,"⪅","\\lessapprox",!0);c(f,b,x,"≊","\\approxeq",!0);c(f,b,W,"⋖","\\lessdot");c(f,b,x,"⋘","\\lll",!0);c(f,b,x,"≶","\\lessgtr",!0);c(f,b,x,"⋚","\\lesseqgtr",!0);c(f,b,x,"⪋","\\lesseqqgtr",!0);c(f,b,x,"≑","\\doteqdot");c(f,b,x,"≓","\\risingdotseq",!0);c(f,b,x,"≒","\\fallingdotseq",!0);c(f,b,x,"∽","\\backsim",!0);c(f,b,x,"⋍","\\backsimeq",!0);c(f,b,x,"⫅","\\subseteqq",!0);c(f,b,x,"⋐","\\Subset",!0);c(f,b,x,"⊏","\\sqsubset",!0);c(f,b,x,"≼","\\preccurlyeq",!0);c(f,b,x,"⋞","\\curlyeqprec",!0);c(f,b,x,"≾","\\precsim",!0);c(f,b,x,"⪷","\\precapprox",!0);c(f,b,x,"⊲","\\vartriangleleft");c(f,b,x,"⊴","\\trianglelefteq");c(f,b,x,"⊨","\\vDash",!0);c(f,b,x,"⊪","\\Vvdash",!0);c(f,b,x,"⌣","\\smallsmile");c(f,b,x,"⌢","\\smallfrown");c(f,b,x,"≏","\\bumpeq",!0);c(f,b,x,"≎","\\Bumpeq",!0);c(f,b,x,"≧","\\geqq",!0);c(f,b,x,"⩾","\\geqslant",!0);c(f,b,x,"⪖","\\eqslantgtr",!0);c(f,b,x,"≳","\\gtrsim",!0);c(f,b,x,"⪆","\\gtrapprox",!0);c(f,b,W,"⋗","\\gtrdot");c(f,b,x,"⋙","\\ggg",!0);c(f,b,x,"≷","\\gtrless",!0);c(f,b,x,"⋛","\\gtreqless",!0);c(f,b,x,"⪌","\\gtreqqless",!0);c(f,b,x,"≖","\\eqcirc",!0);c(f,b,x,"≗","\\circeq",!0);c(f,b,x,"≜","\\triangleq",!0);c(f,b,x,"∼","\\thicksim");c(f,b,x,"≈","\\thickapprox");c(f,b,x,"⫆","\\supseteqq",!0);c(f,b,x,"⋑","\\Supset",!0);c(f,b,x,"⊐","\\sqsupset",!0);c(f,b,x,"≽","\\succcurlyeq",!0);c(f,b,x,"⋟","\\curlyeqsucc",!0);c(f,b,x,"≿","\\succsim",!0);c(f,b,x,"⪸","\\succapprox",!0);c(f,b,x,"⊳","\\vartriangleright");c(f,b,x,"⊵","\\trianglerighteq");c(f,b,x,"⊩","\\Vdash",!0);c(f,b,x,"∣","\\shortmid");c(f,b,x,"∥","\\shortparallel");c(f,b,x,"≬","\\between",!0);c(f,b,x,"⋔","\\pitchfork",!0);c(f,b,x,"∝","\\varpropto");c(f,b,x,"◀","\\blacktriangleleft");c(f,b,x,"∴","\\therefore",!0);c(f,b,x,"∍","\\backepsilon");c(f,b,x,"▶","\\blacktriangleright");c(f,b,x,"∵","\\because",!0);c(f,b,x,"⋘","\\llless");c(f,b,x,"⋙","\\gggtr");c(f,b,W,"⊲","\\lhd");c(f,b,W,"⊳","\\rhd");c(f,b,x,"≂","\\eqsim",!0);c(f,g,x,"⋈","\\Join");c(f,b,x,"≑","\\Doteq",!0);c(f,b,W,"∔","\\dotplus",!0);c(f,b,W,"∖","\\smallsetminus");c(f,b,W,"⋒","\\Cap",!0);c(f,b,W,"⋓","\\Cup",!0);c(f,b,W,"⩞","\\doublebarwedge",!0);c(f,b,W,"⊟","\\boxminus",!0);c(f,b,W,"⊞","\\boxplus",!0);c(f,b,W,"⋇","\\divideontimes",!0);c(f,b,W,"⋉","\\ltimes",!0);c(f,b,W,"⋊","\\rtimes",!0);c(f,b,W,"⋋","\\leftthreetimes",!0);c(f,b,W,"⋌","\\rightthreetimes",!0);c(f,b,W,"⋏","\\curlywedge",!0);c(f,b,W,"⋎","\\curlyvee",!0);c(f,b,W,"⊝","\\circleddash",!0);c(f,b,W,"⊛","\\circledast",!0);c(f,b,W,"⋅","\\centerdot");c(f,b,W,"⊺","\\intercal",!0);c(f,b,W,"⋒","\\doublecap");c(f,b,W,"⋓","\\doublecup");c(f,b,W,"⊠","\\boxtimes",!0);c(f,b,x,"⇢","\\dashrightarrow",!0);c(f,b,x,"⇠","\\dashleftarrow",!0);c(f,b,x,"⇇","\\leftleftarrows",!0);c(f,b,x,"⇆","\\leftrightarrows",!0);c(f,b,x,"⇚","\\Lleftarrow",!0);c(f,b,x,"↞","\\twoheadleftarrow",!0);c(f,b,x,"↢","\\leftarrowtail",!0);c(f,b,x,"↫","\\looparrowleft",!0);c(f,b,x,"⇋","\\leftrightharpoons",!0);c(f,b,x,"↶","\\curvearrowleft",!0);c(f,b,x,"↺","\\circlearrowleft",!0);c(f,b,x,"↰","\\Lsh",!0);c(f,b,x,"⇈","\\upuparrows",!0);c(f,b,x,"↿","\\upharpoonleft",!0);c(f,b,x,"⇃","\\downharpoonleft",!0);c(f,g,x,"⊶","\\origof",!0);c(f,g,x,"⊷","\\imageof",!0);c(f,b,x,"⊸","\\multimap",!0);c(f,b,x,"↭","\\leftrightsquigarrow",!0);c(f,b,x,"⇉","\\rightrightarrows",!0);c(f,b,x,"⇄","\\rightleftarrows",!0);c(f,b,x,"↠","\\twoheadrightarrow",!0);c(f,b,x,"↣","\\rightarrowtail",!0);c(f,b,x,"↬","\\looparrowright",!0);c(f,b,x,"↷","\\curvearrowright",!0);c(f,b,x,"↻","\\circlearrowright",!0);c(f,b,x,"↱","\\Rsh",!0);c(f,b,x,"⇊","\\downdownarrows",!0);c(f,b,x,"↾","\\upharpoonright",!0);c(f,b,x,"⇂","\\downharpoonright",!0);c(f,b,x,"⇝","\\rightsquigarrow",!0);c(f,b,x,"⇝","\\leadsto");c(f,b,x,"⇛","\\Rrightarrow",!0);c(f,b,x,"↾","\\restriction");c(f,g,T,"‘","`");c(f,g,T,"$","\\$");c(N,g,T,"$","\\$");c(N,g,T,"$","\\textdollar");c(f,g,T,"%","\\%");c(N,g,T,"%","\\%");c(f,g,T,"_","\\_");c(N,g,T,"_","\\_");c(N,g,T,"_","\\textunderscore");c(f,g,T,"∠","\\angle",!0);c(f,g,T,"∞","\\infty",!0);c(f,g,T,"′","\\prime");c(f,g,T,"△","\\triangle");c(f,g,T,"Γ","\\Gamma",!0);c(f,g,T,"Δ","\\Delta",!0);c(f,g,T,"Θ","\\Theta",!0);c(f,g,T,"Λ","\\Lambda",!0);c(f,g,T,"Ξ","\\Xi",!0);c(f,g,T,"Π","\\Pi",!0);c(f,g,T,"Σ","\\Sigma",!0);c(f,g,T,"Υ","\\Upsilon",!0);c(f,g,T,"Φ","\\Phi",!0);c(f,g,T,"Ψ","\\Psi",!0);c(f,g,T,"Ω","\\Omega",!0);c(f,g,T,"A","Α");c(f,g,T,"B","Β");c(f,g,T,"E","Ε");c(f,g,T,"Z","Ζ");c(f,g,T,"H","Η");c(f,g,T,"I","Ι");c(f,g,T,"K","Κ");c(f,g,T,"M","Μ");c(f,g,T,"N","Ν");c(f,g,T,"O","Ο");c(f,g,T,"P","Ρ");c(f,g,T,"T","Τ");c(f,g,T,"X","Χ");c(f,g,T,"¬","\\neg",!0);c(f,g,T,"¬","\\lnot");c(f,g,T,"⊤","\\top");c(f,g,T,"⊥","\\bot");c(f,g,T,"∅","\\emptyset");c(f,b,T,"∅","\\varnothing");c(f,g,Z,"α","\\alpha",!0);c(f,g,Z,"β","\\beta",!0);c(f,g,Z,"γ","\\gamma",!0);c(f,g,Z,"δ","\\delta",!0);c(f,g,Z,"ϵ","\\epsilon",!0);c(f,g,Z,"ζ","\\zeta",!0);c(f,g,Z,"η","\\eta",!0);c(f,g,Z,"θ","\\theta",!0);c(f,g,Z,"ι","\\iota",!0);c(f,g,Z,"κ","\\kappa",!0);c(f,g,Z,"λ","\\lambda",!0);c(f,g,Z,"μ","\\mu",!0);c(f,g,Z,"ν","\\nu",!0);c(f,g,Z,"ξ","\\xi",!0);c(f,g,Z,"ο","\\omicron",!0);c(f,g,Z,"π","\\pi",!0);c(f,g,Z,"ρ","\\rho",!0);c(f,g,Z,"σ","\\sigma",!0);c(f,g,Z,"τ","\\tau",!0);c(f,g,Z,"υ","\\upsilon",!0);c(f,g,Z,"ϕ","\\phi",!0);c(f,g,Z,"χ","\\chi",!0);c(f,g,Z,"ψ","\\psi",!0);c(f,g,Z,"ω","\\omega",!0);c(f,g,Z,"ε","\\varepsilon",!0);c(f,g,Z,"ϑ","\\vartheta",!0);c(f,g,Z,"ϖ","\\varpi",!0);c(f,g,Z,"ϱ","\\varrho",!0);c(f,g,Z,"ς","\\varsigma",!0);c(f,g,Z,"φ","\\varphi",!0);c(f,g,W,"∗","*",!0);c(f,g,W,"+","+");c(f,g,W,"−","-",!0);c(f,g,W,"⋅","\\cdot",!0);c(f,g,W,"∘","\\circ",!0);c(f,g,W,"÷","\\div",!0);c(f,g,W,"±","\\pm",!0);c(f,g,W,"×","\\times",!0);c(f,g,W,"∩","\\cap",!0);c(f,g,W,"∪","\\cup",!0);c(f,g,W,"∖","\\setminus",!0);c(f,g,W,"∧","\\land");c(f,g,W,"∨","\\lor");c(f,g,W,"∧","\\wedge",!0);c(f,g,W,"∨","\\vee",!0);c(f,g,T,"√","\\surd");c(f,g,Ye,"⟨","\\langle",!0);c(f,g,Ye,"∣","\\lvert");c(f,g,Ye,"∥","\\lVert");c(f,g,Le,"?","?");c(f,g,Le,"!","!");c(f,g,Le,"⟩","\\rangle",!0);c(f,g,Le,"∣","\\rvert");c(f,g,Le,"∥","\\rVert");c(f,g,x,"=","=");c(f,g,x,":",":");c(f,g,x,"≈","\\approx",!0);c(f,g,x,"≅","\\cong",!0);c(f,g,x,"≥","\\ge");c(f,g,x,"≥","\\geq",!0);c(f,g,x,"←","\\gets");c(f,g,x,">","\\gt",!0);c(f,g,x,"∈","\\in",!0);c(f,g,x,"","\\@not");c(f,g,x,"⊂","\\subset",!0);c(f,g,x,"⊃","\\supset",!0);c(f,g,x,"⊆","\\subseteq",!0);c(f,g,x,"⊇","\\supseteq",!0);c(f,b,x,"⊈","\\nsubseteq",!0);c(f,b,x,"⊉","\\nsupseteq",!0);c(f,g,x,"⊨","\\models");c(f,g,x,"←","\\leftarrow",!0);c(f,g,x,"≤","\\le");c(f,g,x,"≤","\\leq",!0);c(f,g,x,"<","\\lt",!0);c(f,g,x,"→","\\rightarrow",!0);c(f,g,x,"→","\\to");c(f,b,x,"≱","\\ngeq",!0);c(f,b,x,"≰","\\nleq",!0);c(f,g,St," ","\\ ");c(f,g,St," ","\\space");c(f,g,St," ","\\nobreakspace");c(N,g,St," ","\\ ");c(N,g,St," "," ");c(N,g,St," ","\\space");c(N,g,St," ","\\nobreakspace");c(f,g,St,null,"\\nobreak");c(f,g,St,null,"\\allowbreak");c(f,g,sn,",",",");c(f,g,sn,";",";");c(f,b,W,"⊼","\\barwedge",!0);c(f,b,W,"⊻","\\veebar",!0);c(f,g,W,"⊙","\\odot",!0);c(f,g,W,"⊕","\\oplus",!0);c(f,g,W,"⊗","\\otimes",!0);c(f,g,T,"∂","\\partial",!0);c(f,g,W,"⊘","\\oslash",!0);c(f,b,W,"⊚","\\circledcirc",!0);c(f,b,W,"⊡","\\boxdot",!0);c(f,g,W,"△","\\bigtriangleup");c(f,g,W,"▽","\\bigtriangledown");c(f,g,W,"†","\\dagger");c(f,g,W,"⋄","\\diamond");c(f,g,W,"⋆","\\star");c(f,g,W,"◃","\\triangleleft");c(f,g,W,"▹","\\triangleright");c(f,g,Ye,"{","\\{");c(N,g,T,"{","\\{");c(N,g,T,"{","\\textbraceleft");c(f,g,Le,"}","\\}");c(N,g,T,"}","\\}");c(N,g,T,"}","\\textbraceright");c(f,g,Ye,"{","\\lbrace");c(f,g,Le,"}","\\rbrace");c(f,g,Ye,"[","\\lbrack",!0);c(N,g,T,"[","\\lbrack",!0);c(f,g,Le,"]","\\rbrack",!0);c(N,g,T,"]","\\rbrack",!0);c(f,g,Ye,"(","\\lparen",!0);c(f,g,Le,")","\\rparen",!0);c(N,g,T,"<","\\textless",!0);c(N,g,T,">","\\textgreater",!0);c(f,g,Ye,"⌊","\\lfloor",!0);c(f,g,Le,"⌋","\\rfloor",!0);c(f,g,Ye,"⌈","\\lceil",!0);c(f,g,Le,"⌉","\\rceil",!0);c(f,g,T,"\\","\\backslash");c(f,g,T,"∣","|");c(f,g,T,"∣","\\vert");c(N,g,T,"|","\\textbar",!0);c(f,g,T,"∥","\\|");c(f,g,T,"∥","\\Vert");c(N,g,T,"∥","\\textbardbl");c(N,g,T,"~","\\textasciitilde");c(N,g,T,"\\","\\textbackslash");c(N,g,T,"^","\\textasciicircum");c(f,g,x,"↑","\\uparrow",!0);c(f,g,x,"⇑","\\Uparrow",!0);c(f,g,x,"↓","\\downarrow",!0);c(f,g,x,"⇓","\\Downarrow",!0);c(f,g,x,"↕","\\updownarrow",!0);c(f,g,x,"⇕","\\Updownarrow",!0);c(f,g,Te,"∐","\\coprod");c(f,g,Te,"⋁","\\bigvee");c(f,g,Te,"⋀","\\bigwedge");c(f,g,Te,"⨄","\\biguplus");c(f,g,Te,"⋂","\\bigcap");c(f,g,Te,"⋃","\\bigcup");c(f,g,Te,"∫","\\int");c(f,g,Te,"∫","\\intop");c(f,g,Te,"∬","\\iint");c(f,g,Te,"∭","\\iiint");c(f,g,Te,"∏","\\prod");c(f,g,Te,"∑","\\sum");c(f,g,Te,"⨂","\\bigotimes");c(f,g,Te,"⨁","\\bigoplus");c(f,g,Te,"⨀","\\bigodot");c(f,g,Te,"∮","\\oint");c(f,g,Te,"∯","\\oiint");c(f,g,Te,"∰","\\oiiint");c(f,g,Te,"⨆","\\bigsqcup");c(f,g,Te,"∫","\\smallint");c(N,g,rr,"…","\\textellipsis");c(f,g,rr,"…","\\mathellipsis");c(N,g,rr,"…","\\ldots",!0);c(f,g,rr,"…","\\ldots",!0);c(f,g,rr,"⋯","\\@cdots",!0);c(f,g,rr,"⋱","\\ddots",!0);c(f,g,T,"⋮","\\varvdots");c(N,g,T,"⋮","\\varvdots");c(f,g,ge,"ˊ","\\acute");c(f,g,ge,"ˋ","\\grave");c(f,g,ge,"¨","\\ddot");c(f,g,ge,"~","\\tilde");c(f,g,ge,"ˉ","\\bar");c(f,g,ge,"˘","\\breve");c(f,g,ge,"ˇ","\\check");c(f,g,ge,"^","\\hat");c(f,g,ge,"⃗","\\vec");c(f,g,ge,"˙","\\dot");c(f,g,ge,"˚","\\mathring");c(f,g,Z,"","\\@imath");c(f,g,Z,"","\\@jmath");c(f,g,T,"ı","ı");c(f,g,T,"ȷ","ȷ");c(N,g,T,"ı","\\i",!0);c(N,g,T,"ȷ","\\j",!0);c(N,g,T,"ß","\\ss",!0);c(N,g,T,"æ","\\ae",!0);c(N,g,T,"œ","\\oe",!0);c(N,g,T,"ø","\\o",!0);c(N,g,T,"Æ","\\AE",!0);c(N,g,T,"Œ","\\OE",!0);c(N,g,T,"Ø","\\O",!0);c(N,g,ge,"ˊ","\\'");c(N,g,ge,"ˋ","\\`");c(N,g,ge,"ˆ","\\^");c(N,g,ge,"˜","\\~");c(N,g,ge,"ˉ","\\=");c(N,g,ge,"˘","\\u");c(N,g,ge,"˙","\\.");c(N,g,ge,"¸","\\c");c(N,g,ge,"˚","\\r");c(N,g,ge,"ˇ","\\v");c(N,g,ge,"¨",'\\"');c(N,g,ge,"˝","\\H");c(N,g,ge,"◯","\\textcircled");var Ql={"--":!0,"---":!0,"``":!0,"''":!0};c(N,g,T,"–","--",!0);c(N,g,T,"–","\\textendash");c(N,g,T,"—","---",!0);c(N,g,T,"—","\\textemdash");c(N,g,T,"‘","`",!0);c(N,g,T,"‘","\\textquoteleft");c(N,g,T,"’","'",!0);c(N,g,T,"’","\\textquoteright");c(N,g,T,"“","``",!0);c(N,g,T,"“","\\textquotedblleft");c(N,g,T,"”","''",!0);c(N,g,T,"”","\\textquotedblright");c(f,g,T,"°","\\degree",!0);c(N,g,T,"°","\\degree");c(N,g,T,"°","\\textdegree",!0);c(f,g,T,"£","\\pounds");c(f,g,T,"£","\\mathsterling",!0);c(N,g,T,"£","\\pounds");c(N,g,T,"£","\\textsterling",!0);c(f,b,T,"✠","\\maltese");c(N,b,T,"✠","\\maltese");var ea='0123456789/@."';for(var Ln=0;Ln0)return nt(a,u,i,r,l.concat(h));if(o){var m,d;if(o==="boldsymbol"){var p=ff(a,i,r,l,n);m=p.fontName,d=[p.fontClass]}else s?(m=ts[o].fontName,d=[o]):(m=Or(o,r.fontWeight,r.fontShape),d=[o,r.fontWeight,r.fontShape]);if(on(a,m,i).metrics)return nt(a,m,i,r,l.concat(d));if(Ql.hasOwnProperty(a)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w{if(Ct(e.classes)!==Ct(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(e.classes.length===1){var r=e.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n in e.style)if(e.style.hasOwnProperty(n)&&e.style[n]!==t.style[n])return!1;for(var i in t.style)if(t.style.hasOwnProperty(i)&&e.style[i]!==t.style[i])return!1;return!0},gf=e=>{for(var t=0;tr&&(r=l.height),l.depth>n&&(n=l.depth),l.maxFontSize>i&&(i=l.maxFontSize)}t.height=r,t.depth=n,t.maxFontSize=i},Oe=function(t,r,n,i){var a=new Cr(t,r,n,i);return q0(a),a},Jl=(e,t,r,n)=>new Cr(e,t,r,n),vf=function(t,r,n){var i=Oe([t],[],r);return i.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),i.style.borderBottomWidth=P(i.height),i.maxFontSize=1,i},yf=function(t,r,n,i){var a=new O0(t,r,n,i);return q0(a),a},es=function(t){var r=new Mr(t);return q0(r),r},bf=function(t,r){return t instanceof Mr?Oe([],[t],r):t},xf=function(t){if(t.positionType==="individualShift"){for(var r=t.children,n=[r[0]],i=-r[0].shift-r[0].elem.depth,a=i,l=1;l{var r=Oe(["mspace"],[],t),n=ye(e,t);return r.style.marginRight=P(n),r},Or=function(t,r,n){var i="";switch(t){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=t}var a;return r==="textbf"&&n==="textit"?a="BoldItalic":r==="textbf"?a="Bold":r==="textit"?a="Italic":a="Regular",i+"-"+a},ts={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},rs={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Sf=function(t,r){var[n,i,a]=rs[t],l=new Et(n),s=new bt([l],{width:P(i),height:P(a),style:"width:"+P(i),viewBox:"0 0 "+1e3*i+" "+1e3*a,preserveAspectRatio:"xMinYMin"}),o=Jl(["overlay"],[s],r);return o.height=a,o.style.height=P(a),o.style.width=P(i),o},C={fontMap:ts,makeSymbol:nt,mathsym:mf,makeSpan:Oe,makeSvgSpan:Jl,makeLineSpan:vf,makeAnchor:yf,makeFragment:es,wrapFragment:bf,makeVList:wf,makeOrd:pf,makeGlue:kf,staticSvg:Sf,svgData:rs,tryCombineChars:gf},ve={number:3,unit:"mu"},Pt={number:4,unit:"mu"},dt={number:5,unit:"mu"},Af={mord:{mop:ve,mbin:Pt,mrel:dt,minner:ve},mop:{mord:ve,mop:ve,mrel:dt,minner:ve},mbin:{mord:Pt,mop:Pt,mopen:Pt,minner:Pt},mrel:{mord:dt,mop:dt,mopen:dt,minner:dt},mopen:{},mclose:{mop:ve,mbin:Pt,mrel:dt,minner:ve},mpunct:{mord:ve,mop:ve,mrel:dt,mopen:ve,mclose:ve,mpunct:ve,minner:ve},minner:{mord:ve,mop:ve,mbin:Pt,mrel:dt,mopen:ve,mpunct:ve,minner:ve}},Tf={mord:{mop:ve},mop:{mord:ve,mop:ve},mbin:{},mrel:{},mopen:{},mclose:{mop:ve},mpunct:{},minner:{mop:ve}},ns={},Qr={},Jr={};function _(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:l}=e,s={type:t,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},o=0;o{var M=w.classes[0],S=y.classes[0];M==="mbin"&&Mf.includes(S)?w.classes[0]="mord":S==="mbin"&&zf.includes(M)&&(y.classes[0]="mord")},{node:m},d,p),aa(a,(y,w)=>{var M=c0(w),S=c0(y),z=M&&S?y.hasClass("mtight")?Tf[M][S]:Af[M][S]:null;if(z)return C.makeGlue(z,u)},{node:m},d,p),a},aa=function e(t,r,n,i,a){i&&t.push(i);for(var l=0;ld=>{t.splice(m+1,0,d),l++})(l)}i&&t.pop()},is=function(t){return t instanceof Mr||t instanceof O0||t instanceof Cr&&t.hasClass("enclosing")?t:null},Df=function e(t,r){var n=is(t);if(n){var i=n.children;if(i.length){if(r==="right")return e(i[i.length-1],"right");if(r==="left")return e(i[0],"left")}}return t},c0=function(t,r){return t?(r&&(t=Df(t,r)),Ef[t.classes[0]]||null):null},kr=function(t,r){var n=["nulldelimiter"].concat(t.baseSizingClasses());return xt(r.concat(n))},oe=function(t,r,n){if(!t)return xt();if(Qr[t.type]){var i=Qr[t.type](t,r);if(n&&r.size!==n.size){i=xt(r.sizingClasses(n),[i],r);var a=r.sizeMultiplier/n.sizeMultiplier;i.height*=a,i.depth*=a}return i}else throw new L("Got group of unknown type: '"+t.type+"'")};function qr(e,t){var r=xt(["base"],e,t),n=xt(["strut"]);return n.style.height=P(r.height+r.depth),r.depth&&(n.style.verticalAlign=P(-r.depth)),r.children.unshift(n),r}function h0(e,t){var r=null;e.length===1&&e[0].type==="tag"&&(r=e[0].tag,e=e[0].body);var n=ze(e,t,"root"),i;n.length===2&&n[1].hasClass("tag")&&(i=n.pop());for(var a=[],l=[],s=0;s0&&(a.push(qr(l,t)),l=[]),a.push(n[s]));l.length>0&&a.push(qr(l,t));var u;r?(u=qr(ze(r,t,!0)),u.classes=["tag"],a.push(u)):i&&a.push(i);var h=xt(["katex-html"],a);if(h.setAttribute("aria-hidden","true"),u){var m=u.children[0];m.style.height=P(h.height+h.depth),h.depth&&(m.style.verticalAlign=P(-h.depth))}return h}function as(e){return new Mr(e)}class _e{constructor(t,r,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(t,r){this.attributes[t]=r}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);this.classes.length>0&&(t.className=Ct(this.classes));for(var n=0;n0&&(t+=' class ="'+ue.escape(Ct(this.classes))+'"'),t+=">";for(var n=0;n",t}toText(){return this.children.map(t=>t.toText()).join("")}}class ot{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return ue.escape(this.toText())}toText(){return this.text}}class If{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character="  ":t>=-.05556&&t<=-.05555?this.character=" ⁣":t>=-.1667&&t<=-.1666?this.character=" ⁣":t>=-.2223&&t<=-.2222?this.character=" ⁣":t>=-.2778&&t<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",P(this.width)),t}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var F={MathNode:_e,TextNode:ot,SpaceNode:If,newDocumentFragment:as},Je=function(t,r,n){return de[r][t]&&de[r][t].replace&&t.charCodeAt(0)!==55349&&!(Ql.hasOwnProperty(t)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(t=de[r][t].replace),new F.TextNode(t)},H0=function(t){return t.length===1?t[0]:new F.MathNode("mrow",t)},V0=function(t,r){if(r.fontFamily==="texttt")return"monospace";if(r.fontFamily==="textsf")return r.fontShape==="textit"&&r.fontWeight==="textbf"?"sans-serif-bold-italic":r.fontShape==="textit"?"sans-serif-italic":r.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(r.fontShape==="textit"&&r.fontWeight==="textbf")return"bold-italic";if(r.fontShape==="textit")return"italic";if(r.fontWeight==="textbf")return"bold";var n=r.font;if(!n||n==="mathnormal")return null;var i=t.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return t.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var a=t.text;if(["\\imath","\\jmath"].includes(a))return null;de[i][a]&&de[i][a].replace&&(a=de[i][a].replace);var l=C.fontMap[n].fontName;return P0(a,l,i)?C.fontMap[n].variant:null};function qn(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof ot&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var r=e.children[0];return r instanceof ot&&r.text===","}else return!1}var Ve=function(t,r,n){if(t.length===1){var i=me(t[0],r);return n&&i instanceof _e&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var a=[],l,s=0;s=1&&(l.type==="mn"||qn(l))){var u=o.children[0];u instanceof _e&&u.type==="mn"&&(u.children=[...l.children,...u.children],a.pop())}else if(l.type==="mi"&&l.children.length===1){var h=l.children[0];if(h instanceof ot&&h.text==="̸"&&(o.type==="mo"||o.type==="mi"||o.type==="mn")){var m=o.children[0];m instanceof ot&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),a.pop())}}}a.push(o),l=o}return a},Dt=function(t,r,n){return H0(Ve(t,r,n))},me=function(t,r){if(!t)return new F.MathNode("mrow");if(Jr[t.type]){var n=Jr[t.type](t,r);return n}else throw new L("Got group of unknown type: '"+t.type+"'")};function la(e,t,r,n,i){var a=Ve(e,r),l;a.length===1&&a[0]instanceof _e&&["mrow","mtable"].includes(a[0].type)?l=a[0]:l=new F.MathNode("mrow",a);var s=new F.MathNode("annotation",[new F.TextNode(t)]);s.setAttribute("encoding","application/x-tex");var o=new F.MathNode("semantics",[l,s]),u=new F.MathNode("math",[o]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&u.setAttribute("display","block");var h=i?"katex":"katex-mathml";return C.makeSpan([h],[u])}var ls=function(t){return new gt({style:t.displayMode?Q.DISPLAY:Q.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},ss=function(t,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),t=C.makeSpan(n,[t])}return t},Bf=function(t,r,n){var i=ls(n),a;if(n.output==="mathml")return la(t,r,i,n.displayMode,!0);if(n.output==="html"){var l=h0(t,i);a=C.makeSpan(["katex"],[l])}else{var s=la(t,r,i,n.displayMode,!1),o=h0(t,i);a=C.makeSpan(["katex"],[s,o])}return ss(a,n)},Nf=function(t,r,n){var i=ls(n),a=h0(t,i),l=C.makeSpan(["katex"],[a]);return ss(l,n)},Ff={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Lf=function(t){var r=new F.MathNode("mo",[new F.TextNode(Ff[t.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},Rf={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Pf=function(t){return t.type==="ordgroup"?t.body.length:1},Of=function(t,r){function n(){var s=4e5,o=t.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(o)){var u=t,h=Pf(u.base),m,d,p;if(h>5)o==="widehat"||o==="widecheck"?(m=420,s=2364,p=.42,d=o+"4"):(m=312,s=2340,p=.34,d="tilde4");else{var y=[1,1,2,2,3,3][h];o==="widehat"||o==="widecheck"?(s=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],p=[0,.24,.3,.3,.36,.42][y],d=o+y):(s=[0,600,1033,2339,2340][y],m=[0,260,286,306,312][y],p=[0,.26,.286,.3,.306,.34][y],d="tilde"+y)}var w=new Et(d),M=new bt([w],{width:"100%",height:P(p),viewBox:"0 0 "+s+" "+m,preserveAspectRatio:"none"});return{span:C.makeSvgSpan([],[M],r),minWidth:0,height:p}}else{var S=[],z=Rf[o],[I,V,O]=z,E=O/1e3,G=I.length,K,U;if(G===1){var D=z[3];K=["hide-tail"],U=[D]}else if(G===2)K=["halfarrow-left","halfarrow-right"],U=["xMinYMin","xMaxYMin"];else if(G===3)K=["brace-left","brace-center","brace-right"],U=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+G+" children.");for(var $=0;$0&&(i.style.minWidth=P(a)),i},qf=function(t,r,n,i,a){var l,s=t.height+t.depth+n+i;if(/fbox|color|angl/.test(r)){if(l=C.makeSpan(["stretchy",r],[],a),r==="fbox"){var o=a.color&&a.getColor();o&&(l.style.borderColor=o)}}else{var u=[];/^[bx]cancel$/.test(r)&&u.push(new o0({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&u.push(new o0({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new bt(u,{width:"100%",height:P(s)});l=C.makeSvgSpan([],[h],a)}return l.height=s,l.style.height=P(s),l},wt={encloseSpan:qf,mathMLnode:Lf,svgSpan:Of};function re(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function j0(e){var t=un(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function un(e){return e&&(e.type==="atom"||cf.hasOwnProperty(e.type))?e:null}var $0=(e,t)=>{var r,n,i;e&&e.type==="supsub"?(n=re(e.base,"accent"),r=n.base,e.base=r,i=of(oe(e,t)),e.base=n):(n=re(e,"accent"),r=n.base);var a=oe(r,t.havingCrampedStyle()),l=n.isShifty&&ue.isCharacterBox(r),s=0;if(l){var o=ue.getBaseElem(r),u=oe(o,t.havingCrampedStyle());s=Ji(u).skew}var h=n.label==="\\c",m=h?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),d;if(n.isStretchy)d=wt.svgSpan(n,t),d=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:d,wrapperClasses:["svg-align"],wrapperStyle:s>0?{width:"calc(100% - "+P(2*s)+")",marginLeft:P(2*s)}:void 0}]},t);else{var p,y;n.label==="\\vec"?(p=C.staticSvg("vec",t),y=C.svgData.vec[1]):(p=C.makeOrd({mode:n.mode,text:n.label},t,"textord"),p=Ji(p),p.italic=0,y=p.width,h&&(m+=p.depth)),d=C.makeSpan(["accent-body"],[p]);var w=n.label==="\\textcircled";w&&(d.classes.push("accent-full"),m=a.height);var M=s;w||(M-=y/2),d.style.left=P(M),n.label==="\\textcircled"&&(d.style.top=".2em"),d=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-m},{type:"elem",elem:d}]},t)}var S=C.makeSpan(["mord","accent"],[d],t);return i?(i.children[0]=S,i.height=Math.max(S.height,i.height),i.classes[0]="mord",i):S},os=(e,t)=>{var r=e.isStretchy?wt.mathMLnode(e.label):new F.MathNode("mo",[Je(e.label,e.mode)]),n=new F.MathNode("mover",[me(e.base,t),r]);return n.setAttribute("accent","true"),n},Hf=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));_({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var r=en(t[0]),n=!Hf.test(e.funcName),i=!n||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:i,base:r}},htmlBuilder:$0,mathmlBuilder:os});_({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var r=t[0],n=e.parser.mode;return n==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:$0,mathmlBuilder:os});_({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:i}},htmlBuilder:(e,t)=>{var r=oe(e.base,t),n=wt.svgSpan(e,t),i=e.label==="\\utilde"?.12:0,a=C.makeVList({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:r}]},t);return C.makeSpan(["mord","accentunder"],[a],t)},mathmlBuilder:(e,t)=>{var r=wt.mathMLnode(e.label),n=new F.MathNode("munder",[me(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});var Hr=e=>{var t=new F.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};_({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n,funcName:i}=e;return{type:"xArrow",mode:n.mode,label:i,body:t[0],below:r[0]}},htmlBuilder(e,t){var r=t.style,n=t.havingStyle(r.sup()),i=C.wrapFragment(oe(e.body,n,t),t),a=e.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(a+"-arrow-pad");var l;e.below&&(n=t.havingStyle(r.sub()),l=C.wrapFragment(oe(e.below,n,t),t),l.classes.push(a+"-arrow-pad"));var s=wt.svgSpan(e,t),o=-t.fontMetrics().axisHeight+.5*s.height,u=-t.fontMetrics().axisHeight-.5*s.height-.111;(i.depth>.25||e.label==="\\xleftequilibrium")&&(u-=i.depth);var h;if(l){var m=-t.fontMetrics().axisHeight+l.height+.5*s.height+.111;h=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:s,shift:o},{type:"elem",elem:l,shift:m}]},t)}else h=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:s,shift:o}]},t);return h.children[0].children[0].children[1].classes.push("svg-align"),C.makeSpan(["mrel","x-arrow"],[h],t)},mathmlBuilder(e,t){var r=wt.mathMLnode(e.label);r.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(e.body){var i=Hr(me(e.body,t));if(e.below){var a=Hr(me(e.below,t));n=new F.MathNode("munderover",[r,a,i])}else n=new F.MathNode("mover",[r,i])}else if(e.below){var l=Hr(me(e.below,t));n=new F.MathNode("munder",[r,l])}else n=Hr(),n=new F.MathNode("mover",[r,n]);return n}});var Vf=C.makeSpan;function us(e,t){var r=ze(e.body,t,!0);return Vf([e.mclass],r,t)}function cs(e,t){var r,n=Ve(e.body,t);return e.mclass==="minner"?r=new F.MathNode("mpadded",n):e.mclass==="mord"?e.isCharacterBox?(r=n[0],r.type="mi"):r=new F.MathNode("mi",n):(e.isCharacterBox?(r=n[0],r.type="mo"):r=new F.MathNode("mo",n),e.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}_({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:we(i),isCharacterBox:ue.isCharacterBox(i)}},htmlBuilder:us,mathmlBuilder:cs});var cn=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};_({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:r}=e;return{type:"mclass",mode:r.mode,mclass:cn(t[0]),body:we(t[1]),isCharacterBox:ue.isCharacterBox(t[1])}}});_({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:r,funcName:n}=e,i=t[1],a=t[0],l;n!=="\\stackrel"?l=cn(i):l="mrel";var s={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:we(i)},o={type:"supsub",mode:a.mode,base:s,sup:n==="\\underset"?null:a,sub:n==="\\underset"?a:null};return{type:"mclass",mode:r.mode,mclass:l,body:[o],isCharacterBox:ue.isCharacterBox(o)}},htmlBuilder:us,mathmlBuilder:cs});_({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"pmb",mode:r.mode,mclass:cn(t[0]),body:we(t[0])}},htmlBuilder(e,t){var r=ze(e.body,t,!0),n=C.makeSpan([e.mclass],r,t);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(e,t){var r=Ve(e.body,t),n=new F.MathNode("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var jf={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},sa=()=>({type:"styling",body:[],mode:"math",style:"display"}),oa=e=>e.type==="textord"&&e.text==="@",$f=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function Uf(e,t,r){var n=jf[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var i=r.callFunction("\\\\cdleft",[t[0]],[]),a={type:"atom",text:n,mode:"math",family:"rel"},l=r.callFunction("\\Big",[a],[]),s=r.callFunction("\\\\cdright",[t[1]],[]),o={type:"ordgroup",mode:"math",body:[i,l,s]};return r.callFunction("\\\\cdparent",[o],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function _f(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if(r==="&"||r==="\\\\")e.consume();else if(r==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new L("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var n=[],i=[n],a=0;a-1))if("<>AV".indexOf(u)>-1)for(var m=0;m<2;m++){for(var d=!0,p=o+1;pAV=|." after @',l[o]);var y=Uf(u,h,e),w={type:"styling",body:[y],mode:"math",style:"display"};n.push(w),s=sa()}a%2===0?n.push(s):n.shift(),n=[],i.push(n)}e.gullet.endGroup(),e.gullet.endGroup();var M=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:M,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}_({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder(e,t){var r=t.havingStyle(t.style.sup()),n=C.wrapFragment(oe(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=P(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(e,t){var r=new F.MathNode("mrow",[me(e.label,t)]);return r=new F.MathNode("mpadded",[r]),r.setAttribute("width","0"),e.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new F.MathNode("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});_({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:r}=e;return{type:"cdlabelparent",mode:r.mode,fragment:t[0]}},htmlBuilder(e,t){var r=C.wrapFragment(oe(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(e,t){return new F.MathNode("mrow",[me(e.fragment,t)])}});_({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:r}=e,n=re(t[0],"ordgroup"),i=n.body,a="",l=0;l=1114111)throw new L("\\@char with invalid code point "+a);return o<=65535?u=String.fromCharCode(o):(o-=65536,u=String.fromCharCode((o>>10)+55296,(o&1023)+56320)),{type:"textord",mode:r.mode,text:u}}});var hs=(e,t)=>{var r=ze(e.body,t.withColor(e.color),!1);return C.makeFragment(r)},ms=(e,t)=>{var r=Ve(e.body,t.withColor(e.color)),n=new F.MathNode("mstyle",r);return n.setAttribute("mathcolor",e.color),n};_({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:r}=e,n=re(t[0],"color-token").color,i=t[1];return{type:"color",mode:r.mode,color:n,body:we(i)}},htmlBuilder:hs,mathmlBuilder:ms});_({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:r,breakOnTokenText:n}=e,i=re(t[0],"color-token").color;r.gullet.macros.set("\\current@color",i);var a=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:i,body:a}},htmlBuilder:hs,mathmlBuilder:ms});_({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,r){var{parser:n}=e,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,a=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:a,size:i&&re(i,"size").value}},htmlBuilder(e,t){var r=C.makeSpan(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=P(ye(e.size,t)))),r},mathmlBuilder(e,t){var r=new F.MathNode("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",P(ye(e.size,t)))),r}});var m0={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},fs=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new L("Expected a control sequence",e);return t},Gf=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},ps=(e,t,r,n)=>{var i=e.gullet.macros.get(r.text);i==null&&(r.noexpand=!0,i={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,i,n)};_({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:r}=e;t.consumeSpaces();var n=t.fetch();if(m0[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=m0[n.text]),re(t.parseFunction(),"internal");throw new L("Invalid token after macro prefix",n)}});_({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=t.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new L("Expected a control sequence",n);for(var a=0,l,s=[[]];t.gullet.future().text!=="{";)if(n=t.gullet.popToken(),n.text==="#"){if(t.gullet.future().text==="{"){l=t.gullet.future(),s[a].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new L('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==a+1)throw new L('Argument number "'+n.text+'" out of order');a++,s.push([])}else{if(n.text==="EOF")throw new L("Expected a macro definition");s[a].push(n.text)}var{tokens:o}=t.gullet.consumeArg();return l&&o.unshift(l),(r==="\\edef"||r==="\\xdef")&&(o=t.gullet.expandTokens(o),o.reverse()),t.gullet.macros.set(i,{tokens:o,numArgs:a,delimiters:s},r===m0[r]),{type:"internal",mode:t.mode}}});_({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=fs(t.gullet.popToken());t.gullet.consumeSpaces();var i=Gf(t);return ps(t,n,i,r==="\\\\globallet"),{type:"internal",mode:t.mode}}});_({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=fs(t.gullet.popToken()),i=t.gullet.popToken(),a=t.gullet.popToken();return ps(t,n,a,r==="\\\\globalfuture"),t.gullet.pushToken(a),t.gullet.pushToken(i),{type:"internal",mode:t.mode}}});var fr=function(t,r,n){var i=de.math[t]&&de.math[t].replace,a=P0(i||t,r,n);if(!a)throw new Error("Unsupported symbol "+t+" and font size "+r+".");return a},U0=function(t,r,n,i){var a=n.havingBaseStyle(r),l=C.makeSpan(i.concat(a.sizingClasses(n)),[t],n),s=a.sizeMultiplier/n.sizeMultiplier;return l.height*=s,l.depth*=s,l.maxFontSize=a.sizeMultiplier,l},ds=function(t,r,n){var i=r.havingBaseStyle(n),a=(1-r.sizeMultiplier/i.sizeMultiplier)*r.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=P(a),t.height-=a,t.depth+=a},Wf=function(t,r,n,i,a,l){var s=C.makeSymbol(t,"Main-Regular",a,i),o=U0(s,r,i,l);return n&&ds(o,i,r),o},Yf=function(t,r,n,i){return C.makeSymbol(t,"Size"+r+"-Regular",n,i)},gs=function(t,r,n,i,a,l){var s=Yf(t,r,a,i),o=U0(C.makeSpan(["delimsizing","size"+r],[s],i),Q.TEXT,i,l);return n&&ds(o,i,Q.TEXT),o},Hn=function(t,r,n){var i;r==="Size1-Regular"?i="delim-size1":i="delim-size4";var a=C.makeSpan(["delimsizinginner",i],[C.makeSpan([],[C.makeSymbol(t,r,n)])]);return{type:"elem",elem:a}},Vn=function(t,r,n){var i=st["Size4-Regular"][t.charCodeAt(0)]?st["Size4-Regular"][t.charCodeAt(0)][4]:st["Size1-Regular"][t.charCodeAt(0)][4],a=new Et("inner",Qm(t,Math.round(1e3*r))),l=new bt([a],{width:P(i),height:P(r),style:"width:"+P(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),s=C.makeSvgSpan([],[l],n);return s.height=r,s.style.height=P(r),s.style.width=P(i),{type:"elem",elem:s}},f0=.008,Vr={type:"kern",size:-1*f0},Xf=["|","\\lvert","\\rvert","\\vert"],Kf=["\\|","\\lVert","\\rVert","\\Vert"],vs=function(t,r,n,i,a,l){var s,o,u,h,m="",d=0;s=u=h=t,o=null;var p="Size1-Regular";t==="\\uparrow"?u=h="⏐":t==="\\Uparrow"?u=h="‖":t==="\\downarrow"?s=u="⏐":t==="\\Downarrow"?s=u="‖":t==="\\updownarrow"?(s="\\uparrow",u="⏐",h="\\downarrow"):t==="\\Updownarrow"?(s="\\Uparrow",u="‖",h="\\Downarrow"):Xf.includes(t)?(u="∣",m="vert",d=333):Kf.includes(t)?(u="∥",m="doublevert",d=556):t==="["||t==="\\lbrack"?(s="⎡",u="⎢",h="⎣",p="Size4-Regular",m="lbrack",d=667):t==="]"||t==="\\rbrack"?(s="⎤",u="⎥",h="⎦",p="Size4-Regular",m="rbrack",d=667):t==="\\lfloor"||t==="⌊"?(u=s="⎢",h="⎣",p="Size4-Regular",m="lfloor",d=667):t==="\\lceil"||t==="⌈"?(s="⎡",u=h="⎢",p="Size4-Regular",m="lceil",d=667):t==="\\rfloor"||t==="⌋"?(u=s="⎥",h="⎦",p="Size4-Regular",m="rfloor",d=667):t==="\\rceil"||t==="⌉"?(s="⎤",u=h="⎥",p="Size4-Regular",m="rceil",d=667):t==="("||t==="\\lparen"?(s="⎛",u="⎜",h="⎝",p="Size4-Regular",m="lparen",d=875):t===")"||t==="\\rparen"?(s="⎞",u="⎟",h="⎠",p="Size4-Regular",m="rparen",d=875):t==="\\{"||t==="\\lbrace"?(s="⎧",o="⎨",h="⎩",u="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(s="⎫",o="⎬",h="⎭",u="⎪",p="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(s="⎧",h="⎩",u="⎪",p="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(s="⎫",h="⎭",u="⎪",p="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(s="⎧",h="⎭",u="⎪",p="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(s="⎫",h="⎩",u="⎪",p="Size4-Regular");var y=fr(s,p,a),w=y.height+y.depth,M=fr(u,p,a),S=M.height+M.depth,z=fr(h,p,a),I=z.height+z.depth,V=0,O=1;if(o!==null){var E=fr(o,p,a);V=E.height+E.depth,O=2}var G=w+I+V,K=Math.max(0,Math.ceil((r-G)/(O*S))),U=G+K*O*S,D=i.fontMetrics().axisHeight;n&&(D*=i.sizeMultiplier);var $=U/2-D,j=[];if(m.length>0){var ie=U-w-I,Y=Math.round(U*1e3),q=Jm(m,Math.round(ie*1e3)),ae=new Et(m,q),fe=(d/1e3).toFixed(3)+"em",Me=(Y/1e3).toFixed(3)+"em",je=new bt([ae],{width:fe,height:Me,viewBox:"0 0 "+d+" "+Y}),k=C.makeSvgSpan([],[je],i);k.height=Y/1e3,k.style.width=fe,k.style.height=Me,j.push({type:"elem",elem:k})}else{if(j.push(Hn(h,p,a)),j.push(Vr),o===null){var ke=U-w-I+2*f0;j.push(Vn(u,ke,i))}else{var be=(U-w-I-V)/2+2*f0;j.push(Vn(u,be,i)),j.push(Vr),j.push(Hn(o,p,a)),j.push(Vr),j.push(Vn(u,be,i))}j.push(Vr),j.push(Hn(s,p,a))}var A=i.havingBaseStyle(Q.TEXT),De=C.makeVList({positionType:"bottom",positionData:$,children:j},A);return U0(C.makeSpan(["delimsizing","mult"],[De],A),Q.TEXT,i,l)},jn=80,$n=.08,Un=function(t,r,n,i,a){var l=Zm(t,i,n),s=new Et(t,l),o=new bt([s],{width:"400em",height:P(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return C.makeSvgSpan(["hide-tail"],[o],a)},Zf=function(t,r){var n=r.havingBaseSizing(),i=ws("\\surd",t*n.sizeMultiplier,xs,n),a=n.sizeMultiplier,l=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),s,o=0,u=0,h=0,m;return i.type==="small"?(h=1e3+1e3*l+jn,t<1?a=1:t<1.4&&(a=.7),o=(1+l+$n)/a,u=(1+l)/a,s=Un("sqrtMain",o,h,l,r),s.style.minWidth="0.853em",m=.833/a):i.type==="large"?(h=(1e3+jn)*vr[i.size],u=(vr[i.size]+l)/a,o=(vr[i.size]+l+$n)/a,s=Un("sqrtSize"+i.size,o,h,l,r),s.style.minWidth="1.02em",m=1/a):(o=t+l+$n,u=t+l,h=Math.floor(1e3*t+l)+jn,s=Un("sqrtTall",o,h,l,r),s.style.minWidth="0.742em",m=1.056),s.height=u,s.style.height=P(o),{span:s,advanceWidth:m,ruleWidth:(r.fontMetrics().sqrtRuleThickness+l)*a}},ys=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Qf=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],bs=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],vr=[0,1.2,1.8,2.4,3],Jf=function(t,r,n,i,a){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),ys.includes(t)||bs.includes(t))return gs(t,r,!1,n,i,a);if(Qf.includes(t))return vs(t,vr[r],!1,n,i,a);throw new L("Illegal delimiter: '"+t+"'")},e2=[{type:"small",style:Q.SCRIPTSCRIPT},{type:"small",style:Q.SCRIPT},{type:"small",style:Q.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],t2=[{type:"small",style:Q.SCRIPTSCRIPT},{type:"small",style:Q.SCRIPT},{type:"small",style:Q.TEXT},{type:"stack"}],xs=[{type:"small",style:Q.SCRIPTSCRIPT},{type:"small",style:Q.SCRIPT},{type:"small",style:Q.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],r2=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},ws=function(t,r,n,i){for(var a=Math.min(2,3-i.style.size),l=a;lr)return n[l]}return n[n.length-1]},ks=function(t,r,n,i,a,l){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var s;bs.includes(t)?s=e2:ys.includes(t)?s=xs:s=t2;var o=ws(t,r,s,i);return o.type==="small"?Wf(t,o.style,n,i,a,l):o.type==="large"?gs(t,o.size,n,i,a,l):vs(t,r,n,i,a,l)},n2=function(t,r,n,i,a,l){var s=i.fontMetrics().axisHeight*i.sizeMultiplier,o=901,u=5/i.fontMetrics().ptPerEm,h=Math.max(r-s,n+s),m=Math.max(h/500*o,2*h-u);return ks(t,m,!0,i,a,l)},yt={sqrtImage:Zf,sizedDelim:Jf,sizeToMaxHeight:vr,customSizedDelim:ks,leftRightDelim:n2},ua={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},i2=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function hn(e,t){var r=un(e);if(r&&i2.includes(r.text))return r;throw r?new L("Invalid delimiter '"+r.text+"' after '"+t.funcName+"'",e):new L("Invalid delimiter type '"+e.type+"'",e)}_({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var r=hn(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:ua[e.funcName].size,mclass:ua[e.funcName].mclass,delim:r.text}},htmlBuilder:(e,t)=>e.delim==="."?C.makeSpan([e.mclass]):yt.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Je(e.delim,e.mode));var r=new F.MathNode("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=P(yt.sizeToMaxHeight[e.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});function ca(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}_({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=e.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new L("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:hn(t[0],e).text,color:r}}});_({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=hn(t[0],e),n=e.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var a=re(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:r.text,right:a.delim,rightColor:a.color}},htmlBuilder:(e,t)=>{ca(e);for(var r=ze(e.body,t,!0,["mopen","mclose"]),n=0,i=0,a=!1,l=0;l{ca(e);var r=Ve(e.body,t);if(e.left!=="."){var n=new F.MathNode("mo",[Je(e.left,e.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(e.right!=="."){var i=new F.MathNode("mo",[Je(e.right,e.mode)]);i.setAttribute("fence","true"),e.rightColor&&i.setAttribute("mathcolor",e.rightColor),r.push(i)}return H0(r)}});_({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=hn(t[0],e);if(!e.parser.leftrightDepth)throw new L("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},htmlBuilder:(e,t)=>{var r;if(e.delim===".")r=kr(t,[]);else{r=yt.sizedDelim(e.delim,1,t,e.mode,[]);var n={delim:e.delim,options:t};r.isMiddle=n}return r},mathmlBuilder:(e,t)=>{var r=e.delim==="\\vert"||e.delim==="|"?Je("|","text"):Je(e.delim,e.mode),n=new F.MathNode("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var _0=(e,t)=>{var r=C.wrapFragment(oe(e.body,t),t),n=e.label.slice(1),i=t.sizeMultiplier,a,l=0,s=ue.isCharacterBox(e.body);if(n==="sout")a=C.makeSpan(["stretchy","sout"]),a.height=t.fontMetrics().defaultRuleThickness/i,l=-.5*t.fontMetrics().xHeight;else if(n==="phase"){var o=ye({number:.6,unit:"pt"},t),u=ye({number:.35,unit:"ex"},t),h=t.havingBaseSizing();i=i/h.sizeMultiplier;var m=r.height+r.depth+o+u;r.style.paddingLeft=P(m/2+o);var d=Math.floor(1e3*m*i),p=Xm(d),y=new bt([new Et("phase",p)],{width:"400em",height:P(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});a=C.makeSvgSpan(["hide-tail"],[y],t),a.style.height=P(m),l=r.depth+o+u}else{/cancel/.test(n)?s||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var w=0,M=0,S=0;/box/.test(n)?(S=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),w=t.fontMetrics().fboxsep+(n==="colorbox"?0:S),M=w):n==="angl"?(S=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),w=4*S,M=Math.max(0,.25-r.depth)):(w=s?.2:0,M=w),a=wt.encloseSpan(r,n,w,M,t),/fbox|boxed|fcolorbox/.test(n)?(a.style.borderStyle="solid",a.style.borderWidth=P(S)):n==="angl"&&S!==.049&&(a.style.borderTopWidth=P(S),a.style.borderRightWidth=P(S)),l=r.depth+M,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var z;if(e.backgroundColor)z=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:l},{type:"elem",elem:r,shift:0}]},t);else{var I=/cancel|phase/.test(n)?["svg-align"]:[];z=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:a,shift:l,wrapperClasses:I}]},t)}return/cancel/.test(n)&&(z.height=r.height,z.depth=r.depth),/cancel/.test(n)&&!s?C.makeSpan(["mord","cancel-lap"],[z],t):C.makeSpan(["mord"],[z],t)},G0=(e,t)=>{var r=0,n=new F.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[me(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),e.label==="\\fcolorbox"){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+i+"em solid "+String(e.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n};_({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=re(t[0],"color-token").color,l=t[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:a,body:l}},htmlBuilder:_0,mathmlBuilder:G0});_({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=re(t[0],"color-token").color,l=re(t[1],"color-token").color,s=t[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:l,borderColor:a,body:s}},htmlBuilder:_0,mathmlBuilder:G0});_({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\fbox",body:t[0]}}});_({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:_0,mathmlBuilder:G0});_({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\angl",body:t[0]}}});var Ss={};function ct(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:l}=e,s={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},o=0;o{var t=e.parser.settings;if(!t.displayMode)throw new L("{"+e.envName+"} can be used only in display mode.")};function W0(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Bt(e,t,r){var{hskipBeforeAndAfter:n,addJot:i,cols:a,arraystretch:l,colSeparationType:s,autoTag:o,singleRow:u,emptySingleRow:h,maxNumCols:m,leqno:d}=t;if(e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),!l){var p=e.gullet.expandMacroAsText("\\arraystretch");if(p==null)l=1;else if(l=parseFloat(p),!l||l<0)throw new L("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var y=[],w=[y],M=[],S=[],z=o!=null?[]:void 0;function I(){o&&e.gullet.macros.set("\\@eqnsw","1",!0)}function V(){z&&(e.gullet.macros.get("\\df@tag")?(z.push(e.subparse([new We("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):z.push(!!o&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(I(),S.push(ha(e));;){var O=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),O={type:"ordgroup",mode:e.mode,body:O},r&&(O={type:"styling",mode:e.mode,style:r,body:[O]}),y.push(O);var E=e.fetch().text;if(E==="&"){if(m&&y.length===m){if(u||s)throw new L("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(E==="\\end"){V(),y.length===1&&O.type==="styling"&&O.body[0].body.length===0&&(w.length>1||!h)&&w.pop(),S.length0&&(I+=.25),u.push({pos:I,isDashed:Ut[Nt]})}for(V(l[0]),n=0;n0&&($+=z,G<$&&(G=$),$=0)),t.addJot&&(G+=w),K.height=E,K.depth=G,I+=E,K.pos=I,I+=G+$,o[n]=K,V(l[n+1])}var j=I/2+r.fontMetrics().axisHeight,ie=t.cols||[],Y=[],q,ae,fe=[];if(t.tags&&t.tags.some(Ut=>Ut))for(n=0;n=s)){var Xe=void 0;(i>0||t.hskipBeforeAndAfter)&&(Xe=ue.deflt(be.pregap,d),Xe!==0&&(q=C.makeSpan(["arraycolsep"],[]),q.style.width=P(Xe),Y.push(q)));var Ie=[];for(n=0;n0){for(var pn=C.makeLineSpan("hline",r,h),dn=C.makeLineSpan("hdashline",r,h),ir=[{type:"elem",elem:o,shift:0}];u.length>0;){var ar=u.pop(),lr=ar.pos-j;ar.isDashed?ir.push({type:"elem",elem:dn,shift:lr}):ir.push({type:"elem",elem:pn,shift:lr})}o=C.makeVList({positionType:"individualShift",children:ir},r)}if(fe.length===0)return C.makeSpan(["mord"],[o],r);var $t=C.makeVList({positionType:"individualShift",children:fe},r);return $t=C.makeSpan(["tag"],[$t],r),C.makeFragment([o,$t])},a2={c:"center ",l:"left ",r:"right "},mt=function(t,r){for(var n=[],i=new F.MathNode("mtd",[],["mtr-glue"]),a=new F.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var y=t.cols,w="",M=!1,S=0,z=y.length;y[0].type==="separator"&&(d+="top ",S=1),y[y.length-1].type==="separator"&&(d+="bottom ",z-=1);for(var I=S;I0?"left ":"",d+=K[K.length-1].length>0?"right ":"";for(var U=1;U-1?"alignat":"align",a=t.envName==="split",l=Bt(t.parser,{cols:n,addJot:!0,autoTag:a?void 0:W0(t.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:a?2:void 0,leqno:t.parser.settings.leqno},"display"),s,o=0,u={type:"ordgroup",mode:t.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){for(var h="",m=0;m0&&p&&(M=1),n[y]={type:"align",align:w,pregap:M,postgap:0}}return l.colSeparationType=p?"align":"alignat",l};ct({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var r=un(t[0]),n=r?[t[0]]:re(t[0],"ordgroup").body,i=n.map(function(l){var s=j0(l),o=s.text;if("lcr".indexOf(o)!==-1)return{type:"align",align:o};if(o==="|")return{type:"separator",separator:"|"};if(o===":")return{type:"separator",separator:":"};throw new L("Unknown column alignment: "+o,l)}),a={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Bt(e.parser,a,Y0(e.envName))},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(e.envName.charAt(e.envName.length-1)==="*"){var i=e.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,"lcr".indexOf(r)===-1)throw new L("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:r}]}}var a=Bt(e.parser,n,Y0(e.envName)),l=Math.max(0,...a.body.map(s=>s.length));return a.cols=new Array(l).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},r=Bt(e.parser,t,"script");return r.colSeparationType="small",r},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var r=un(t[0]),n=r?[t[0]]:re(t[0],"ordgroup").body,i=n.map(function(l){var s=j0(l),o=s.text;if("lc".indexOf(o)!==-1)return{type:"align",align:o};throw new L("Unknown column alignment: "+o,l)});if(i.length>1)throw new L("{subarray} can contain only one column");var a={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(a=Bt(e.parser,a,"script"),a.body.length>0&&a.body[0].length>1)throw new L("{subarray} can contain only one column");return a},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=Bt(e.parser,t,Y0(e.envName));return{type:"leftright",mode:e.mode,body:[r],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Ts,htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&mn(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:W0(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Ts,htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){mn(e);var t={autoTag:W0(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["CD"],props:{numArgs:0},handler(e){return mn(e),_f(e.parser)},htmlBuilder:ht,mathmlBuilder:mt});v("\\nonumber","\\gdef\\@eqnsw{0}");v("\\notag","\\nonumber");_({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new L(e.funcName+" valid only within array environment")}});var ma=Ss;_({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];if(i.type!=="ordgroup")throw new L("Invalid environment name",i);for(var a="",l=0;l{var r=e.font,n=t.withFont(r);return oe(e.body,n)},Ms=(e,t)=>{var r=e.font,n=t.withFont(r);return me(e.body,n)},fa={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};_({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=en(t[0]),a=n;return a in fa&&(a=fa[a]),{type:"font",mode:r.mode,font:a.slice(1),body:i}},htmlBuilder:zs,mathmlBuilder:Ms});_({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:r}=e,n=t[0],i=ue.isCharacterBox(n);return{type:"mclass",mode:r.mode,mclass:cn(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:i}}});_({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n,breakOnTokenText:i}=e,{mode:a}=r,l=r.parseExpression(!0,i),s="math"+n.slice(1);return{type:"font",mode:a,font:s,body:{type:"ordgroup",mode:r.mode,body:l}}},htmlBuilder:zs,mathmlBuilder:Ms});var Cs=(e,t)=>{var r=t;return e==="display"?r=r.id>=Q.SCRIPT.id?r.text():Q.DISPLAY:e==="text"&&r.size===Q.DISPLAY.size?r=Q.TEXT:e==="script"?r=Q.SCRIPT:e==="scriptscript"&&(r=Q.SCRIPTSCRIPT),r},X0=(e,t)=>{var r=Cs(e.size,t.style),n=r.fracNum(),i=r.fracDen(),a;a=t.havingStyle(n);var l=oe(e.numer,a,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,o=3.5/t.fontMetrics().ptPerEm;l.height=l.height0?y=3*d:y=7*d,w=t.fontMetrics().denom1):(m>0?(p=t.fontMetrics().num2,y=d):(p=t.fontMetrics().num3,y=3*d),w=t.fontMetrics().denom2);var M;if(h){var z=t.fontMetrics().axisHeight;p-l.depth-(z+.5*m){var r=new F.MathNode("mfrac",[me(e.numer,t),me(e.denom,t)]);if(!e.hasBarLine)r.setAttribute("linethickness","0px");else if(e.barSize){var n=ye(e.barSize,t);r.setAttribute("linethickness",P(n))}var i=Cs(e.size,t.style);if(i.size!==t.style.size){r=new F.MathNode("mstyle",[r]);var a=i.size===Q.DISPLAY.size?"true":"false";r.setAttribute("displaystyle",a),r.setAttribute("scriptlevel","0")}if(e.leftDelim!=null||e.rightDelim!=null){var l=[];if(e.leftDelim!=null){var s=new F.MathNode("mo",[new F.TextNode(e.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),l.push(s)}if(l.push(r),e.rightDelim!=null){var o=new F.MathNode("mo",[new F.TextNode(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),l.push(o)}return H0(l)}return r};_({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=t[1],l,s=null,o=null,u="auto";switch(n){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,s="(",o=")";break;case"\\\\bracefrac":l=!1,s="\\{",o="\\}";break;case"\\\\brackfrac":l=!1,s="[",o="]";break;default:throw new Error("Unrecognized genfrac command")}switch(n){case"\\dfrac":case"\\dbinom":u="display";break;case"\\tfrac":case"\\tbinom":u="text";break}return{type:"genfrac",mode:r.mode,continued:!1,numer:i,denom:a,hasBarLine:l,leftDelim:s,rightDelim:o,size:u,barSize:null}},htmlBuilder:X0,mathmlBuilder:K0});_({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=t[1];return{type:"genfrac",mode:r.mode,continued:!0,numer:i,denom:a,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});_({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:r,token:n}=e,i;switch(r){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:i,token:n}}});var pa=["display","text","script","scriptscript"],da=function(t){var r=null;return t.length>0&&(r=t,r=r==="."?null:r),r};_({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:r}=e,n=t[4],i=t[5],a=en(t[0]),l=a.type==="atom"&&a.family==="open"?da(a.text):null,s=en(t[1]),o=s.type==="atom"&&s.family==="close"?da(s.text):null,u=re(t[2],"size"),h,m=null;u.isBlank?h=!0:(m=u.value,h=m.number>0);var d="auto",p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var y=re(p.body[0],"textord");d=pa[Number(y.text)]}}else p=re(p,"textord"),d=pa[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:h,barSize:m,leftDelim:l,rightDelim:o,size:d}},htmlBuilder:X0,mathmlBuilder:K0});_({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:r,funcName:n,token:i}=e;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:re(t[0],"size").value,token:i}}});_({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=Fm(re(t[1],"infix").size),l=t[2],s=a.number>0;return{type:"genfrac",mode:r.mode,numer:i,denom:l,continued:!1,hasBarLine:s,barSize:a,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:X0,mathmlBuilder:K0});var Es=(e,t)=>{var r=t.style,n,i;e.type==="supsub"?(n=e.sup?oe(e.sup,t.havingStyle(r.sup()),t):oe(e.sub,t.havingStyle(r.sub()),t),i=re(e.base,"horizBrace")):i=re(e,"horizBrace");var a=oe(i.base,t.havingBaseStyle(Q.DISPLAY)),l=wt.svgSpan(i,t),s;if(i.isOver?(s=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:l}]},t),s.children[0].children[0].children[1].classes.push("svg-align")):(s=C.makeVList({positionType:"bottom",positionData:a.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:a}]},t),s.children[0].children[0].children[0].classes.push("svg-align")),n){var o=C.makeSpan(["mord",i.isOver?"mover":"munder"],[s],t);i.isOver?s=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.2},{type:"elem",elem:n}]},t):s=C.makeVList({positionType:"bottom",positionData:o.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:o}]},t)}return C.makeSpan(["mord",i.isOver?"mover":"munder"],[s],t)},l2=(e,t)=>{var r=wt.mathMLnode(e.label);return new F.MathNode(e.isOver?"mover":"munder",[me(e.base,t),r])};_({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"horizBrace",mode:r.mode,label:n,isOver:/^\\over/.test(n),base:t[0]}},htmlBuilder:Es,mathmlBuilder:l2});_({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[1],i=re(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:r.mode,href:i,body:we(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var r=ze(e.body,t,!1);return C.makeAnchor(e.href,[],r,t)},mathmlBuilder:(e,t)=>{var r=Dt(e.body,t);return r instanceof _e||(r=new _e("mrow",[r])),r.setAttribute("href",e.href),r}});_({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=re(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var i=[],a=0;a{var{parser:r,funcName:n,token:i}=e,a=re(t[0],"raw").string,l=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var s,o={};switch(n){case"\\htmlClass":o.class=a,s={command:"\\htmlClass",class:a};break;case"\\htmlId":o.id=a,s={command:"\\htmlId",id:a};break;case"\\htmlStyle":o.style=a,s={command:"\\htmlStyle",style:a};break;case"\\htmlData":{for(var u=a.split(","),h=0;h{var r=ze(e.body,t,!1),n=["enclosing"];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/));var i=C.makeSpan(n,r,t);for(var a in e.attributes)a!=="class"&&e.attributes.hasOwnProperty(a)&&i.setAttribute(a,e.attributes[a]);return i},mathmlBuilder:(e,t)=>Dt(e.body,t)});_({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"htmlmathml",mode:r.mode,html:we(t[0]),mathml:we(t[1])}},htmlBuilder:(e,t)=>{var r=ze(e.html,t,!1);return C.makeFragment(r)},mathmlBuilder:(e,t)=>Dt(e.mathml,t)});var _n=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new L("Invalid size: '"+t+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!Yl(n))throw new L("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};_({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,r)=>{var{parser:n}=e,i={number:0,unit:"em"},a={number:.9,unit:"em"},l={number:0,unit:"em"},s="";if(r[0])for(var o=re(r[0],"raw").string,u=o.split(","),h=0;h{var r=ye(e.height,t),n=0;e.totalheight.number>0&&(n=ye(e.totalheight,t)-r);var i=0;e.width.number>0&&(i=ye(e.width,t));var a={height:P(r+n)};i>0&&(a.width=P(i)),n>0&&(a.verticalAlign=P(-n));var l=new lf(e.src,e.alt,a);return l.height=r,l.depth=n,l},mathmlBuilder:(e,t)=>{var r=new F.MathNode("mglyph",[]);r.setAttribute("alt",e.alt);var n=ye(e.height,t),i=0;if(e.totalheight.number>0&&(i=ye(e.totalheight,t)-n,r.setAttribute("valign",P(-i))),r.setAttribute("height",P(n+i)),e.width.number>0){var a=ye(e.width,t);r.setAttribute("width",P(a))}return r.setAttribute("src",e.src),r}});_({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=re(t[0],"size");if(r.settings.strict){var a=n[1]==="m",l=i.value.unit==="mu";a?(l||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):l&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:i.value}},htmlBuilder(e,t){return C.makeGlue(e.dimension,t)},mathmlBuilder(e,t){var r=ye(e.dimension,t);return new F.SpaceNode(r)}});_({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:i}},htmlBuilder:(e,t)=>{var r;e.alignment==="clap"?(r=C.makeSpan([],[oe(e.body,t)]),r=C.makeSpan(["inner"],[r],t)):r=C.makeSpan(["inner"],[oe(e.body,t)]);var n=C.makeSpan(["fix"],[]),i=C.makeSpan([e.alignment],[r,n],t),a=C.makeSpan(["strut"]);return a.style.height=P(i.height+i.depth),i.depth&&(a.style.verticalAlign=P(-i.depth)),i.children.unshift(a),i=C.makeSpan(["thinbox"],[i],t),C.makeSpan(["mord","vbox"],[i],t)},mathmlBuilder:(e,t)=>{var r=new F.MathNode("mpadded",[me(e.body,t)]);if(e.alignment!=="rlap"){var n=e.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});_({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:r,parser:n}=e,i=n.mode;n.switchMode("math");var a=r==="\\("?"\\)":"$",l=n.parseExpression(!1,a);return n.expect(a),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",body:l}}});_({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new L("Mismatched "+e.funcName)}});var ga=(e,t)=>{switch(t.style.size){case Q.DISPLAY.size:return e.display;case Q.TEXT.size:return e.text;case Q.SCRIPT.size:return e.script;case Q.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};_({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"mathchoice",mode:r.mode,display:we(t[0]),text:we(t[1]),script:we(t[2]),scriptscript:we(t[3])}},htmlBuilder:(e,t)=>{var r=ga(e,t),n=ze(r,t,!1);return C.makeFragment(n)},mathmlBuilder:(e,t)=>{var r=ga(e,t);return Dt(r,t)}});var Ds=(e,t,r,n,i,a,l)=>{e=C.makeSpan([],[e]);var s=r&&ue.isCharacterBox(r),o,u;if(t){var h=oe(t,n.havingStyle(i.sup()),n);u={elem:h,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-h.depth)}}if(r){var m=oe(r,n.havingStyle(i.sub()),n);o={elem:m,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-m.height)}}var d;if(u&&o){var p=n.fontMetrics().bigOpSpacing5+o.elem.height+o.elem.depth+o.kern+e.depth+l;d=C.makeVList({positionType:"bottom",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:o.elem,marginLeft:P(-a)},{type:"kern",size:o.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:P(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(o){var y=e.height-l;d=C.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:o.elem,marginLeft:P(-a)},{type:"kern",size:o.kern},{type:"elem",elem:e}]},n)}else if(u){var w=e.depth+l;d=C.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:P(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else return e;var M=[d];if(o&&a!==0&&!s){var S=C.makeSpan(["mspace"],[],n);S.style.marginRight=P(a),M.unshift(S)}return C.makeSpan(["mop","op-limits"],M,n)},Is=["\\smallint"],nr=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=re(e.base,"op"),i=!0):a=re(e,"op");var l=t.style,s=!1;l.size===Q.DISPLAY.size&&a.symbol&&!Is.includes(a.name)&&(s=!0);var o;if(a.symbol){var u=s?"Size2-Regular":"Size1-Regular",h="";if((a.name==="\\oiint"||a.name==="\\oiiint")&&(h=a.name.slice(1),a.name=h==="oiint"?"\\iint":"\\iiint"),o=C.makeSymbol(a.name,u,"math",t,["mop","op-symbol",s?"large-op":"small-op"]),h.length>0){var m=o.italic,d=C.staticSvg(h+"Size"+(s?"2":"1"),t);o=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:d,shift:s?.08:0}]},t),a.name="\\"+h,o.classes.unshift("mop"),o.italic=m}}else if(a.body){var p=ze(a.body,t,!0);p.length===1&&p[0]instanceof Qe?(o=p[0],o.classes[0]="mop"):o=C.makeSpan(["mop"],p,t)}else{for(var y=[],w=1;w{var r;if(e.symbol)r=new _e("mo",[Je(e.name,e.mode)]),Is.includes(e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new _e("mo",Ve(e.body,t));else{r=new _e("mi",[new ot(e.name.slice(1))]);var n=new _e("mo",[Je("⁡","text")]);e.parentIsSupSub?r=new _e("mrow",[r,n]):r=as([r,n])}return r},s2={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};_({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=n;return i.length===1&&(i=s2[i]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:nr,mathmlBuilder:Er});_({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:we(n)}},htmlBuilder:nr,mathmlBuilder:Er});var o2={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};_({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:nr,mathmlBuilder:Er});_({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:nr,mathmlBuilder:Er});_({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e,n=r;return n.length===1&&(n=o2[n]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:nr,mathmlBuilder:Er});var Bs=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=re(e.base,"operatorname"),i=!0):a=re(e,"operatorname");var l;if(a.body.length>0){for(var s=a.body.map(m=>{var d=m.text;return typeof d=="string"?{type:"textord",mode:m.mode,text:d}:m}),o=ze(s,t.withFont("mathrm"),!0),u=0;u{for(var r=Ve(e.body,t.withFont("mathrm")),n=!0,i=0;ih.toText()).join("");r=[new F.TextNode(s)]}var o=new F.MathNode("mi",r);o.setAttribute("mathvariant","normal");var u=new F.MathNode("mo",[Je("⁡","text")]);return e.parentIsSupSub?new F.MathNode("mrow",[o,u]):F.newDocumentFragment([o,u])};_({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"operatorname",mode:r.mode,body:we(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Bs,mathmlBuilder:u2});v("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Ht({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?C.makeFragment(ze(e.body,t,!1)):C.makeSpan(["mord"],ze(e.body,t,!0),t)},mathmlBuilder(e,t){return Dt(e.body,t,!0)}});_({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:r}=e,n=t[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(e,t){var r=oe(e.body,t.havingCrampedStyle()),n=C.makeLineSpan("overline-line",t),i=t.fontMetrics().defaultRuleThickness,a=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]},t);return C.makeSpan(["mord","overline"],[a],t)},mathmlBuilder(e,t){var r=new F.MathNode("mo",[new F.TextNode("‾")]);r.setAttribute("stretchy","true");var n=new F.MathNode("mover",[me(e.body,t),r]);return n.setAttribute("accent","true"),n}});_({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"phantom",mode:r.mode,body:we(n)}},htmlBuilder:(e,t)=>{var r=ze(e.body,t.withPhantom(),!1);return C.makeFragment(r)},mathmlBuilder:(e,t)=>{var r=Ve(e.body,t);return new F.MathNode("mphantom",r)}});_({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"hphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>{var r=C.makeSpan([],[oe(e.body,t.withPhantom())]);if(r.height=0,r.depth=0,r.children)for(var n=0;n{var r=Ve(we(e.body),t),n=new F.MathNode("mphantom",r),i=new F.MathNode("mpadded",[n]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});_({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>{var r=C.makeSpan(["inner"],[oe(e.body,t.withPhantom())]),n=C.makeSpan(["fix"],[]);return C.makeSpan(["mord","rlap"],[r,n],t)},mathmlBuilder:(e,t)=>{var r=Ve(we(e.body),t),n=new F.MathNode("mphantom",r),i=new F.MathNode("mpadded",[n]);return i.setAttribute("width","0px"),i}});_({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e,n=re(t[0],"size").value,i=t[1];return{type:"raisebox",mode:r.mode,dy:n,body:i}},htmlBuilder(e,t){var r=oe(e.body,t),n=ye(e.dy,t);return C.makeVList({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]},t)},mathmlBuilder(e,t){var r=new F.MathNode("mpadded",[me(e.body,t)]),n=e.dy.number+e.dy.unit;return r.setAttribute("voffset",n),r}});_({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});_({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,r){var{parser:n}=e,i=r[0],a=re(t[0],"size"),l=re(t[1],"size");return{type:"rule",mode:n.mode,shift:i&&re(i,"size").value,width:a.value,height:l.value}},htmlBuilder(e,t){var r=C.makeSpan(["mord","rule"],[],t),n=ye(e.width,t),i=ye(e.height,t),a=e.shift?ye(e.shift,t):0;return r.style.borderRightWidth=P(n),r.style.borderTopWidth=P(i),r.style.bottom=P(a),r.width=n,r.height=i+a,r.depth=-a,r.maxFontSize=i*1.125*t.sizeMultiplier,r},mathmlBuilder(e,t){var r=ye(e.width,t),n=ye(e.height,t),i=e.shift?ye(e.shift,t):0,a=t.color&&t.getColor()||"black",l=new F.MathNode("mspace");l.setAttribute("mathbackground",a),l.setAttribute("width",P(r)),l.setAttribute("height",P(n));var s=new F.MathNode("mpadded",[l]);return i>=0?s.setAttribute("height",P(i)):(s.setAttribute("height",P(i)),s.setAttribute("depth",P(-i))),s.setAttribute("voffset",P(i)),s}});function Ns(e,t,r){for(var n=ze(e,t,!1),i=t.sizeMultiplier/r.sizeMultiplier,a=0;a{var r=t.havingSize(e.size);return Ns(e.body,r,t)};_({type:"sizing",names:va,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!1,r);return{type:"sizing",mode:i.mode,size:va.indexOf(n)+1,body:a}},htmlBuilder:c2,mathmlBuilder:(e,t)=>{var r=t.havingSize(e.size),n=Ve(e.body,r),i=new F.MathNode("mstyle",n);return i.setAttribute("mathsize",P(r.sizeMultiplier)),i}});_({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,r)=>{var{parser:n}=e,i=!1,a=!1,l=r[0]&&re(r[0],"ordgroup");if(l)for(var s="",o=0;o{var r=C.makeSpan([],[oe(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0,r.children))for(var n=0;n{var r=new F.MathNode("mpadded",[me(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});_({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n}=e,i=r[0],a=t[0];return{type:"sqrt",mode:n.mode,body:a,index:i}},htmlBuilder(e,t){var r=oe(e.body,t.havingCrampedStyle());r.height===0&&(r.height=t.fontMetrics().xHeight),r=C.wrapFragment(r,t);var n=t.fontMetrics(),i=n.defaultRuleThickness,a=i;t.style.idr.height+r.depth+l&&(l=(l+m-r.height-r.depth)/2);var d=o.height-r.height-l-u;r.style.paddingLeft=P(h);var p=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+d)},{type:"elem",elem:o},{type:"kern",size:u}]},t);if(e.index){var y=t.havingStyle(Q.SCRIPTSCRIPT),w=oe(e.index,y,t),M=.6*(p.height-p.depth),S=C.makeVList({positionType:"shift",positionData:-M,children:[{type:"elem",elem:w}]},t),z=C.makeSpan(["root"],[S]);return C.makeSpan(["mord","sqrt"],[z,p],t)}else return C.makeSpan(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:r,index:n}=e;return n?new F.MathNode("mroot",[me(r,t),me(n,t)]):new F.MathNode("msqrt",[me(r,t)])}});var ya={display:Q.DISPLAY,text:Q.TEXT,script:Q.SCRIPT,scriptscript:Q.SCRIPTSCRIPT};_({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!0,r),l=n.slice(1,n.length-5);return{type:"styling",mode:i.mode,style:l,body:a}},htmlBuilder(e,t){var r=ya[e.style],n=t.havingStyle(r).withFont("");return Ns(e.body,n,t)},mathmlBuilder(e,t){var r=ya[e.style],n=t.havingStyle(r),i=Ve(e.body,n),a=new F.MathNode("mstyle",i),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},s=l[e.style];return a.setAttribute("scriptlevel",s[0]),a.setAttribute("displaystyle",s[1]),a}});var h2=function(t,r){var n=t.base;if(n)if(n.type==="op"){var i=n.limits&&(r.style.size===Q.DISPLAY.size||n.alwaysHandleSupSub);return i?nr:null}else if(n.type==="operatorname"){var a=n.alwaysHandleSupSub&&(r.style.size===Q.DISPLAY.size||n.limits);return a?Bs:null}else{if(n.type==="accent")return ue.isCharacterBox(n.base)?$0:null;if(n.type==="horizBrace"){var l=!t.sub;return l===n.isOver?Es:null}else return null}else return null};Ht({type:"supsub",htmlBuilder(e,t){var r=h2(e,t);if(r)return r(e,t);var{base:n,sup:i,sub:a}=e,l=oe(n,t),s,o,u=t.fontMetrics(),h=0,m=0,d=n&&ue.isCharacterBox(n);if(i){var p=t.havingStyle(t.style.sup());s=oe(i,p,t),d||(h=l.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(a){var y=t.havingStyle(t.style.sub());o=oe(a,y,t),d||(m=l.depth+y.fontMetrics().subDrop*y.sizeMultiplier/t.sizeMultiplier)}var w;t.style===Q.DISPLAY?w=u.sup1:t.style.cramped?w=u.sup3:w=u.sup2;var M=t.sizeMultiplier,S=P(.5/u.ptPerEm/M),z=null;if(o){var I=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");(l instanceof Qe||I)&&(z=P(-l.italic))}var V;if(s&&o){h=Math.max(h,w,s.depth+.25*u.xHeight),m=Math.max(m,u.sub2);var O=u.defaultRuleThickness,E=4*O;if(h-s.depth-(o.height-m)0&&(h+=G,m-=G)}var K=[{type:"elem",elem:o,shift:m,marginRight:S,marginLeft:z},{type:"elem",elem:s,shift:-h,marginRight:S}];V=C.makeVList({positionType:"individualShift",children:K},t)}else if(o){m=Math.max(m,u.sub1,o.height-.8*u.xHeight);var U=[{type:"elem",elem:o,marginLeft:z,marginRight:S}];V=C.makeVList({positionType:"shift",positionData:m,children:U},t)}else if(s)h=Math.max(h,w,s.depth+.25*u.xHeight),V=C.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:s,marginRight:S}]},t);else throw new Error("supsub must have either sup or sub.");var D=c0(l,"right")||"mord";return C.makeSpan([D],[l,C.makeSpan(["msupsub"],[V])],t)},mathmlBuilder(e,t){var r=!1,n,i;e.base&&e.base.type==="horizBrace"&&(i=!!e.sup,i===e.base.isOver&&(r=!0,n=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var a=[me(e.base,t)];e.sub&&a.push(me(e.sub,t)),e.sup&&a.push(me(e.sup,t));var l;if(r)l=n?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===Q.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===Q.DISPLAY||u.limits)?l="munderover":l="msubsup"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(t.style===Q.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||t.style===Q.DISPLAY)?l="munder":l="msub"}else{var s=e.base;s&&s.type==="op"&&s.limits&&(t.style===Q.DISPLAY||s.alwaysHandleSupSub)||s&&s.type==="operatorname"&&s.alwaysHandleSupSub&&(s.limits||t.style===Q.DISPLAY)?l="mover":l="msup"}return new F.MathNode(l,a)}});Ht({type:"atom",htmlBuilder(e,t){return C.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var r=new F.MathNode("mo",[Je(e.text,e.mode)]);if(e.family==="bin"){var n=V0(e,t);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else e.family==="punct"?r.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&r.setAttribute("stretchy","false");return r}});var Fs={mi:"italic",mn:"normal",mtext:"normal"};Ht({type:"mathord",htmlBuilder(e,t){return C.makeOrd(e,t,"mathord")},mathmlBuilder(e,t){var r=new F.MathNode("mi",[Je(e.text,e.mode,t)]),n=V0(e,t)||"italic";return n!==Fs[r.type]&&r.setAttribute("mathvariant",n),r}});Ht({type:"textord",htmlBuilder(e,t){return C.makeOrd(e,t,"textord")},mathmlBuilder(e,t){var r=Je(e.text,e.mode,t),n=V0(e,t)||"normal",i;return e.mode==="text"?i=new F.MathNode("mtext",[r]):/[0-9]/.test(e.text)?i=new F.MathNode("mn",[r]):e.text==="\\prime"?i=new F.MathNode("mo",[r]):i=new F.MathNode("mi",[r]),n!==Fs[i.type]&&i.setAttribute("mathvariant",n),i}});var Gn={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Wn={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Ht({type:"spacing",htmlBuilder(e,t){if(Wn.hasOwnProperty(e.text)){var r=Wn[e.text].className||"";if(e.mode==="text"){var n=C.makeOrd(e,t,"textord");return n.classes.push(r),n}else return C.makeSpan(["mspace",r],[C.mathsym(e.text,e.mode,t)],t)}else{if(Gn.hasOwnProperty(e.text))return C.makeSpan(["mspace",Gn[e.text]],[],t);throw new L('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var r;if(Wn.hasOwnProperty(e.text))r=new F.MathNode("mtext",[new F.TextNode(" ")]);else{if(Gn.hasOwnProperty(e.text))return new F.MathNode("mspace");throw new L('Unknown type of space "'+e.text+'"')}return r}});var ba=()=>{var e=new F.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Ht({type:"tag",mathmlBuilder(e,t){var r=new F.MathNode("mtable",[new F.MathNode("mtr",[ba(),new F.MathNode("mtd",[Dt(e.body,t)]),ba(),new F.MathNode("mtd",[Dt(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});var xa={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},wa={"\\textbf":"textbf","\\textmd":"textmd"},m2={"\\textit":"textit","\\textup":"textup"},ka=(e,t)=>{var r=e.font;if(r){if(xa[r])return t.withTextFontFamily(xa[r]);if(wa[r])return t.withTextFontWeight(wa[r]);if(r==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(m2[r])};_({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"text",mode:r.mode,body:we(i),font:n}},htmlBuilder(e,t){var r=ka(e,t),n=ze(e.body,r,!0);return C.makeSpan(["mord","text"],n,r)},mathmlBuilder(e,t){var r=ka(e,t);return Dt(e.body,r)}});_({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"underline",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=oe(e.body,t),n=C.makeLineSpan("underline-line",t),i=t.fontMetrics().defaultRuleThickness,a=C.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r}]},t);return C.makeSpan(["mord","underline"],[a],t)},mathmlBuilder(e,t){var r=new F.MathNode("mo",[new F.TextNode("‾")]);r.setAttribute("stretchy","true");var n=new F.MathNode("munder",[me(e.body,t),r]);return n.setAttribute("accentunder","true"),n}});_({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"vcenter",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=oe(e.body,t),n=t.fontMetrics().axisHeight,i=.5*(r.height-n-(r.depth+n));return C.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:r}]},t)},mathmlBuilder(e,t){return new F.MathNode("mpadded",[me(e.body,t)],["vcenter"])}});_({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,r){throw new L("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var r=Sa(e),n=[],i=t.havingStyle(t.style.text()),a=0;ae.body.replace(/ /g,e.star?"␣":" "),Mt=ns,Ls=`[ \r - ]`,f2="\\\\[a-zA-Z@]+",p2="\\\\[^\uD800-\uDFFF]",d2="("+f2+")"+Ls+"*",g2=`\\\\( +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Mr{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),r=0;rr.toText();return this.children.map(t).join("")}}var st={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Fr={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},ia={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function If(e,t){st[e]=t}function O0(e,t,r){if(!st[t])throw new Error("Font metrics not found for font: "+t+".");var n=e.charCodeAt(0),i=st[t][n];if(!i&&e[0]in ia&&(n=ia[e[0]].charCodeAt(0),i=st[t][n]),!i&&r==="text"&&es(n)&&(i=st[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var Ln={};function Bf(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!Ln[t]){var r=Ln[t]={cssEmPerMu:Fr.quad[t]/18};for(var n in Fr)Fr.hasOwnProperty(n)&&(r[n]=Fr[n][t])}return Ln[t]}var Nf=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],aa=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],la=function(t,r){return r.size<2?t:Nf[t-1][r.size-1]};class gt{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||gt.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=aa[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return new gt(r)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:la(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:aa[t-1]})}havingBaseStyle(t){t=t||this.style.text();var r=la(gt.BASESIZE,t);return this.size===r&&this.textSize===gt.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==gt.BASESIZE?["sizing","reset-size"+this.size,"size"+gt.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Bf(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}gt.BASESIZE=6;var u0={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Ff={ex:!0,em:!0,mu:!0},ts=function(t){return typeof t!="string"&&(t=t.unit),t in u0||t in Ff||t==="ex"},ye=function(t,r){var n;if(t.unit in u0)n=u0[t.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(t.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var i;if(r.style.isTight()?i=r.havingStyle(r.style.text()):i=r,t.unit==="ex")n=i.fontMetrics().xHeight;else if(t.unit==="em")n=i.fontMetrics().quad;else throw new L("Invalid unit: '"+t.unit+"'");i!==r&&(n*=i.sizeMultiplier/r.sizeMultiplier)}return Math.min(t.number*n,r.maxSize)},P=function(t){return+t.toFixed(4)+"em"},Ct=function(t){return t.filter(r=>r).join(" ")},rs=function(t,r,n){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var i=r.getColor();i&&(this.style.color=i)}},ns=function(t){var r=document.createElement(t);r.className=Ct(this.classes);for(var n in this.style)this.style.hasOwnProperty(n)&&(r.style[n]=this.style[n]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&r.setAttribute(i,this.attributes[i]);for(var a=0;a/=\x00-\x1f]/,is=function(t){var r="<"+t;this.classes.length&&(r+=' class="'+ue.escape(Ct(this.classes))+'"');var n="";for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=ue.hyphenate(i)+":"+this.style[i]+";");n&&(r+=' style="'+ue.escape(n)+'"');for(var a in this.attributes)if(this.attributes.hasOwnProperty(a)){if(Lf.test(a))throw new L("Invalid attribute name '"+a+"'");r+=" "+a+'="'+ue.escape(this.attributes[a])+'"'}r+=">";for(var l=0;l",r};class Cr{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,rs.call(this,t,n,i),this.children=r||[]}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return ns.call(this,"span")}toMarkup(){return is.call(this,"span")}}class q0{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,rs.call(this,r,i),this.children=n||[],this.setAttribute("href",t)}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return ns.call(this,"a")}toMarkup(){return is.call(this,"a")}}class Rf{constructor(t,r,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=t,this.classes=["mord"],this.style=n}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(var r in this.style)this.style.hasOwnProperty(r)&&(t.style[r]=this.style[r]);return t}toMarkup(){var t=''+ue.escape(this.alt)+'0&&(r=document.createElement("span"),r.style.marginRight=P(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=Ct(this.classes));for(var n in this.style)this.style.hasOwnProperty(n)&&(r=r||document.createElement("span"),r.style[n]=this.style[n]);return r?(r.appendChild(t),r):t}toMarkup(){var t=!1,r="0&&(n+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=ue.hyphenate(i)+":"+this.style[i]+";");n&&(t=!0,r+=' style="'+ue.escape(n)+'"');var a=ue.escape(this.text);return t?(r+=">",r+=a,r+="",r):a}}class bt{constructor(t,r){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=r||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"svg");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&r.setAttribute(n,this.attributes[n]);for(var i=0;i':''}}class c0{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"line");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var t=" but got "+String(e)+".")}var qf={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Hf={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},de={math:{},text:{}};function c(e,t,r,n,i,a){de[e][i]={font:t,group:r,replace:n},a&&n&&(de[e][n]=de[e][i])}var f="math",N="text",g="main",b="ams",ge="accent-token",W="bin",Le="close",rr="inner",Z="mathord",Te="op-token",Ye="open",sn="punct",x="rel",St="spacing",T="textord";c(f,g,x,"≡","\\equiv",!0);c(f,g,x,"≺","\\prec",!0);c(f,g,x,"≻","\\succ",!0);c(f,g,x,"∼","\\sim",!0);c(f,g,x,"⊥","\\perp");c(f,g,x,"⪯","\\preceq",!0);c(f,g,x,"⪰","\\succeq",!0);c(f,g,x,"≃","\\simeq",!0);c(f,g,x,"∣","\\mid",!0);c(f,g,x,"≪","\\ll",!0);c(f,g,x,"≫","\\gg",!0);c(f,g,x,"≍","\\asymp",!0);c(f,g,x,"∥","\\parallel");c(f,g,x,"⋈","\\bowtie",!0);c(f,g,x,"⌣","\\smile",!0);c(f,g,x,"⊑","\\sqsubseteq",!0);c(f,g,x,"⊒","\\sqsupseteq",!0);c(f,g,x,"≐","\\doteq",!0);c(f,g,x,"⌢","\\frown",!0);c(f,g,x,"∋","\\ni",!0);c(f,g,x,"∝","\\propto",!0);c(f,g,x,"⊢","\\vdash",!0);c(f,g,x,"⊣","\\dashv",!0);c(f,g,x,"∋","\\owns");c(f,g,sn,".","\\ldotp");c(f,g,sn,"⋅","\\cdotp");c(f,g,T,"#","\\#");c(N,g,T,"#","\\#");c(f,g,T,"&","\\&");c(N,g,T,"&","\\&");c(f,g,T,"ℵ","\\aleph",!0);c(f,g,T,"∀","\\forall",!0);c(f,g,T,"ℏ","\\hbar",!0);c(f,g,T,"∃","\\exists",!0);c(f,g,T,"∇","\\nabla",!0);c(f,g,T,"♭","\\flat",!0);c(f,g,T,"ℓ","\\ell",!0);c(f,g,T,"♮","\\natural",!0);c(f,g,T,"♣","\\clubsuit",!0);c(f,g,T,"℘","\\wp",!0);c(f,g,T,"♯","\\sharp",!0);c(f,g,T,"♢","\\diamondsuit",!0);c(f,g,T,"ℜ","\\Re",!0);c(f,g,T,"♡","\\heartsuit",!0);c(f,g,T,"ℑ","\\Im",!0);c(f,g,T,"♠","\\spadesuit",!0);c(f,g,T,"§","\\S",!0);c(N,g,T,"§","\\S");c(f,g,T,"¶","\\P",!0);c(N,g,T,"¶","\\P");c(f,g,T,"†","\\dag");c(N,g,T,"†","\\dag");c(N,g,T,"†","\\textdagger");c(f,g,T,"‡","\\ddag");c(N,g,T,"‡","\\ddag");c(N,g,T,"‡","\\textdaggerdbl");c(f,g,Le,"⎱","\\rmoustache",!0);c(f,g,Ye,"⎰","\\lmoustache",!0);c(f,g,Le,"⟯","\\rgroup",!0);c(f,g,Ye,"⟮","\\lgroup",!0);c(f,g,W,"∓","\\mp",!0);c(f,g,W,"⊖","\\ominus",!0);c(f,g,W,"⊎","\\uplus",!0);c(f,g,W,"⊓","\\sqcap",!0);c(f,g,W,"∗","\\ast");c(f,g,W,"⊔","\\sqcup",!0);c(f,g,W,"◯","\\bigcirc",!0);c(f,g,W,"∙","\\bullet",!0);c(f,g,W,"‡","\\ddagger");c(f,g,W,"≀","\\wr",!0);c(f,g,W,"⨿","\\amalg");c(f,g,W,"&","\\And");c(f,g,x,"⟵","\\longleftarrow",!0);c(f,g,x,"⇐","\\Leftarrow",!0);c(f,g,x,"⟸","\\Longleftarrow",!0);c(f,g,x,"⟶","\\longrightarrow",!0);c(f,g,x,"⇒","\\Rightarrow",!0);c(f,g,x,"⟹","\\Longrightarrow",!0);c(f,g,x,"↔","\\leftrightarrow",!0);c(f,g,x,"⟷","\\longleftrightarrow",!0);c(f,g,x,"⇔","\\Leftrightarrow",!0);c(f,g,x,"⟺","\\Longleftrightarrow",!0);c(f,g,x,"↦","\\mapsto",!0);c(f,g,x,"⟼","\\longmapsto",!0);c(f,g,x,"↗","\\nearrow",!0);c(f,g,x,"↩","\\hookleftarrow",!0);c(f,g,x,"↪","\\hookrightarrow",!0);c(f,g,x,"↘","\\searrow",!0);c(f,g,x,"↼","\\leftharpoonup",!0);c(f,g,x,"⇀","\\rightharpoonup",!0);c(f,g,x,"↙","\\swarrow",!0);c(f,g,x,"↽","\\leftharpoondown",!0);c(f,g,x,"⇁","\\rightharpoondown",!0);c(f,g,x,"↖","\\nwarrow",!0);c(f,g,x,"⇌","\\rightleftharpoons",!0);c(f,b,x,"≮","\\nless",!0);c(f,b,x,"","\\@nleqslant");c(f,b,x,"","\\@nleqq");c(f,b,x,"⪇","\\lneq",!0);c(f,b,x,"≨","\\lneqq",!0);c(f,b,x,"","\\@lvertneqq");c(f,b,x,"⋦","\\lnsim",!0);c(f,b,x,"⪉","\\lnapprox",!0);c(f,b,x,"⊀","\\nprec",!0);c(f,b,x,"⋠","\\npreceq",!0);c(f,b,x,"⋨","\\precnsim",!0);c(f,b,x,"⪹","\\precnapprox",!0);c(f,b,x,"≁","\\nsim",!0);c(f,b,x,"","\\@nshortmid");c(f,b,x,"∤","\\nmid",!0);c(f,b,x,"⊬","\\nvdash",!0);c(f,b,x,"⊭","\\nvDash",!0);c(f,b,x,"⋪","\\ntriangleleft");c(f,b,x,"⋬","\\ntrianglelefteq",!0);c(f,b,x,"⊊","\\subsetneq",!0);c(f,b,x,"","\\@varsubsetneq");c(f,b,x,"⫋","\\subsetneqq",!0);c(f,b,x,"","\\@varsubsetneqq");c(f,b,x,"≯","\\ngtr",!0);c(f,b,x,"","\\@ngeqslant");c(f,b,x,"","\\@ngeqq");c(f,b,x,"⪈","\\gneq",!0);c(f,b,x,"≩","\\gneqq",!0);c(f,b,x,"","\\@gvertneqq");c(f,b,x,"⋧","\\gnsim",!0);c(f,b,x,"⪊","\\gnapprox",!0);c(f,b,x,"⊁","\\nsucc",!0);c(f,b,x,"⋡","\\nsucceq",!0);c(f,b,x,"⋩","\\succnsim",!0);c(f,b,x,"⪺","\\succnapprox",!0);c(f,b,x,"≆","\\ncong",!0);c(f,b,x,"","\\@nshortparallel");c(f,b,x,"∦","\\nparallel",!0);c(f,b,x,"⊯","\\nVDash",!0);c(f,b,x,"⋫","\\ntriangleright");c(f,b,x,"⋭","\\ntrianglerighteq",!0);c(f,b,x,"","\\@nsupseteqq");c(f,b,x,"⊋","\\supsetneq",!0);c(f,b,x,"","\\@varsupsetneq");c(f,b,x,"⫌","\\supsetneqq",!0);c(f,b,x,"","\\@varsupsetneqq");c(f,b,x,"⊮","\\nVdash",!0);c(f,b,x,"⪵","\\precneqq",!0);c(f,b,x,"⪶","\\succneqq",!0);c(f,b,x,"","\\@nsubseteqq");c(f,b,W,"⊴","\\unlhd");c(f,b,W,"⊵","\\unrhd");c(f,b,x,"↚","\\nleftarrow",!0);c(f,b,x,"↛","\\nrightarrow",!0);c(f,b,x,"⇍","\\nLeftarrow",!0);c(f,b,x,"⇏","\\nRightarrow",!0);c(f,b,x,"↮","\\nleftrightarrow",!0);c(f,b,x,"⇎","\\nLeftrightarrow",!0);c(f,b,x,"△","\\vartriangle");c(f,b,T,"ℏ","\\hslash");c(f,b,T,"▽","\\triangledown");c(f,b,T,"◊","\\lozenge");c(f,b,T,"Ⓢ","\\circledS");c(f,b,T,"®","\\circledR");c(N,b,T,"®","\\circledR");c(f,b,T,"∡","\\measuredangle",!0);c(f,b,T,"∄","\\nexists");c(f,b,T,"℧","\\mho");c(f,b,T,"Ⅎ","\\Finv",!0);c(f,b,T,"⅁","\\Game",!0);c(f,b,T,"‵","\\backprime");c(f,b,T,"▲","\\blacktriangle");c(f,b,T,"▼","\\blacktriangledown");c(f,b,T,"■","\\blacksquare");c(f,b,T,"⧫","\\blacklozenge");c(f,b,T,"★","\\bigstar");c(f,b,T,"∢","\\sphericalangle",!0);c(f,b,T,"∁","\\complement",!0);c(f,b,T,"ð","\\eth",!0);c(N,g,T,"ð","ð");c(f,b,T,"╱","\\diagup");c(f,b,T,"╲","\\diagdown");c(f,b,T,"□","\\square");c(f,b,T,"□","\\Box");c(f,b,T,"◊","\\Diamond");c(f,b,T,"¥","\\yen",!0);c(N,b,T,"¥","\\yen",!0);c(f,b,T,"✓","\\checkmark",!0);c(N,b,T,"✓","\\checkmark");c(f,b,T,"ℶ","\\beth",!0);c(f,b,T,"ℸ","\\daleth",!0);c(f,b,T,"ℷ","\\gimel",!0);c(f,b,T,"ϝ","\\digamma",!0);c(f,b,T,"ϰ","\\varkappa");c(f,b,Ye,"┌","\\@ulcorner",!0);c(f,b,Le,"┐","\\@urcorner",!0);c(f,b,Ye,"└","\\@llcorner",!0);c(f,b,Le,"┘","\\@lrcorner",!0);c(f,b,x,"≦","\\leqq",!0);c(f,b,x,"⩽","\\leqslant",!0);c(f,b,x,"⪕","\\eqslantless",!0);c(f,b,x,"≲","\\lesssim",!0);c(f,b,x,"⪅","\\lessapprox",!0);c(f,b,x,"≊","\\approxeq",!0);c(f,b,W,"⋖","\\lessdot");c(f,b,x,"⋘","\\lll",!0);c(f,b,x,"≶","\\lessgtr",!0);c(f,b,x,"⋚","\\lesseqgtr",!0);c(f,b,x,"⪋","\\lesseqqgtr",!0);c(f,b,x,"≑","\\doteqdot");c(f,b,x,"≓","\\risingdotseq",!0);c(f,b,x,"≒","\\fallingdotseq",!0);c(f,b,x,"∽","\\backsim",!0);c(f,b,x,"⋍","\\backsimeq",!0);c(f,b,x,"⫅","\\subseteqq",!0);c(f,b,x,"⋐","\\Subset",!0);c(f,b,x,"⊏","\\sqsubset",!0);c(f,b,x,"≼","\\preccurlyeq",!0);c(f,b,x,"⋞","\\curlyeqprec",!0);c(f,b,x,"≾","\\precsim",!0);c(f,b,x,"⪷","\\precapprox",!0);c(f,b,x,"⊲","\\vartriangleleft");c(f,b,x,"⊴","\\trianglelefteq");c(f,b,x,"⊨","\\vDash",!0);c(f,b,x,"⊪","\\Vvdash",!0);c(f,b,x,"⌣","\\smallsmile");c(f,b,x,"⌢","\\smallfrown");c(f,b,x,"≏","\\bumpeq",!0);c(f,b,x,"≎","\\Bumpeq",!0);c(f,b,x,"≧","\\geqq",!0);c(f,b,x,"⩾","\\geqslant",!0);c(f,b,x,"⪖","\\eqslantgtr",!0);c(f,b,x,"≳","\\gtrsim",!0);c(f,b,x,"⪆","\\gtrapprox",!0);c(f,b,W,"⋗","\\gtrdot");c(f,b,x,"⋙","\\ggg",!0);c(f,b,x,"≷","\\gtrless",!0);c(f,b,x,"⋛","\\gtreqless",!0);c(f,b,x,"⪌","\\gtreqqless",!0);c(f,b,x,"≖","\\eqcirc",!0);c(f,b,x,"≗","\\circeq",!0);c(f,b,x,"≜","\\triangleq",!0);c(f,b,x,"∼","\\thicksim");c(f,b,x,"≈","\\thickapprox");c(f,b,x,"⫆","\\supseteqq",!0);c(f,b,x,"⋑","\\Supset",!0);c(f,b,x,"⊐","\\sqsupset",!0);c(f,b,x,"≽","\\succcurlyeq",!0);c(f,b,x,"⋟","\\curlyeqsucc",!0);c(f,b,x,"≿","\\succsim",!0);c(f,b,x,"⪸","\\succapprox",!0);c(f,b,x,"⊳","\\vartriangleright");c(f,b,x,"⊵","\\trianglerighteq");c(f,b,x,"⊩","\\Vdash",!0);c(f,b,x,"∣","\\shortmid");c(f,b,x,"∥","\\shortparallel");c(f,b,x,"≬","\\between",!0);c(f,b,x,"⋔","\\pitchfork",!0);c(f,b,x,"∝","\\varpropto");c(f,b,x,"◀","\\blacktriangleleft");c(f,b,x,"∴","\\therefore",!0);c(f,b,x,"∍","\\backepsilon");c(f,b,x,"▶","\\blacktriangleright");c(f,b,x,"∵","\\because",!0);c(f,b,x,"⋘","\\llless");c(f,b,x,"⋙","\\gggtr");c(f,b,W,"⊲","\\lhd");c(f,b,W,"⊳","\\rhd");c(f,b,x,"≂","\\eqsim",!0);c(f,g,x,"⋈","\\Join");c(f,b,x,"≑","\\Doteq",!0);c(f,b,W,"∔","\\dotplus",!0);c(f,b,W,"∖","\\smallsetminus");c(f,b,W,"⋒","\\Cap",!0);c(f,b,W,"⋓","\\Cup",!0);c(f,b,W,"⩞","\\doublebarwedge",!0);c(f,b,W,"⊟","\\boxminus",!0);c(f,b,W,"⊞","\\boxplus",!0);c(f,b,W,"⋇","\\divideontimes",!0);c(f,b,W,"⋉","\\ltimes",!0);c(f,b,W,"⋊","\\rtimes",!0);c(f,b,W,"⋋","\\leftthreetimes",!0);c(f,b,W,"⋌","\\rightthreetimes",!0);c(f,b,W,"⋏","\\curlywedge",!0);c(f,b,W,"⋎","\\curlyvee",!0);c(f,b,W,"⊝","\\circleddash",!0);c(f,b,W,"⊛","\\circledast",!0);c(f,b,W,"⋅","\\centerdot");c(f,b,W,"⊺","\\intercal",!0);c(f,b,W,"⋒","\\doublecap");c(f,b,W,"⋓","\\doublecup");c(f,b,W,"⊠","\\boxtimes",!0);c(f,b,x,"⇢","\\dashrightarrow",!0);c(f,b,x,"⇠","\\dashleftarrow",!0);c(f,b,x,"⇇","\\leftleftarrows",!0);c(f,b,x,"⇆","\\leftrightarrows",!0);c(f,b,x,"⇚","\\Lleftarrow",!0);c(f,b,x,"↞","\\twoheadleftarrow",!0);c(f,b,x,"↢","\\leftarrowtail",!0);c(f,b,x,"↫","\\looparrowleft",!0);c(f,b,x,"⇋","\\leftrightharpoons",!0);c(f,b,x,"↶","\\curvearrowleft",!0);c(f,b,x,"↺","\\circlearrowleft",!0);c(f,b,x,"↰","\\Lsh",!0);c(f,b,x,"⇈","\\upuparrows",!0);c(f,b,x,"↿","\\upharpoonleft",!0);c(f,b,x,"⇃","\\downharpoonleft",!0);c(f,g,x,"⊶","\\origof",!0);c(f,g,x,"⊷","\\imageof",!0);c(f,b,x,"⊸","\\multimap",!0);c(f,b,x,"↭","\\leftrightsquigarrow",!0);c(f,b,x,"⇉","\\rightrightarrows",!0);c(f,b,x,"⇄","\\rightleftarrows",!0);c(f,b,x,"↠","\\twoheadrightarrow",!0);c(f,b,x,"↣","\\rightarrowtail",!0);c(f,b,x,"↬","\\looparrowright",!0);c(f,b,x,"↷","\\curvearrowright",!0);c(f,b,x,"↻","\\circlearrowright",!0);c(f,b,x,"↱","\\Rsh",!0);c(f,b,x,"⇊","\\downdownarrows",!0);c(f,b,x,"↾","\\upharpoonright",!0);c(f,b,x,"⇂","\\downharpoonright",!0);c(f,b,x,"⇝","\\rightsquigarrow",!0);c(f,b,x,"⇝","\\leadsto");c(f,b,x,"⇛","\\Rrightarrow",!0);c(f,b,x,"↾","\\restriction");c(f,g,T,"‘","`");c(f,g,T,"$","\\$");c(N,g,T,"$","\\$");c(N,g,T,"$","\\textdollar");c(f,g,T,"%","\\%");c(N,g,T,"%","\\%");c(f,g,T,"_","\\_");c(N,g,T,"_","\\_");c(N,g,T,"_","\\textunderscore");c(f,g,T,"∠","\\angle",!0);c(f,g,T,"∞","\\infty",!0);c(f,g,T,"′","\\prime");c(f,g,T,"△","\\triangle");c(f,g,T,"Γ","\\Gamma",!0);c(f,g,T,"Δ","\\Delta",!0);c(f,g,T,"Θ","\\Theta",!0);c(f,g,T,"Λ","\\Lambda",!0);c(f,g,T,"Ξ","\\Xi",!0);c(f,g,T,"Π","\\Pi",!0);c(f,g,T,"Σ","\\Sigma",!0);c(f,g,T,"Υ","\\Upsilon",!0);c(f,g,T,"Φ","\\Phi",!0);c(f,g,T,"Ψ","\\Psi",!0);c(f,g,T,"Ω","\\Omega",!0);c(f,g,T,"A","Α");c(f,g,T,"B","Β");c(f,g,T,"E","Ε");c(f,g,T,"Z","Ζ");c(f,g,T,"H","Η");c(f,g,T,"I","Ι");c(f,g,T,"K","Κ");c(f,g,T,"M","Μ");c(f,g,T,"N","Ν");c(f,g,T,"O","Ο");c(f,g,T,"P","Ρ");c(f,g,T,"T","Τ");c(f,g,T,"X","Χ");c(f,g,T,"¬","\\neg",!0);c(f,g,T,"¬","\\lnot");c(f,g,T,"⊤","\\top");c(f,g,T,"⊥","\\bot");c(f,g,T,"∅","\\emptyset");c(f,b,T,"∅","\\varnothing");c(f,g,Z,"α","\\alpha",!0);c(f,g,Z,"β","\\beta",!0);c(f,g,Z,"γ","\\gamma",!0);c(f,g,Z,"δ","\\delta",!0);c(f,g,Z,"ϵ","\\epsilon",!0);c(f,g,Z,"ζ","\\zeta",!0);c(f,g,Z,"η","\\eta",!0);c(f,g,Z,"θ","\\theta",!0);c(f,g,Z,"ι","\\iota",!0);c(f,g,Z,"κ","\\kappa",!0);c(f,g,Z,"λ","\\lambda",!0);c(f,g,Z,"μ","\\mu",!0);c(f,g,Z,"ν","\\nu",!0);c(f,g,Z,"ξ","\\xi",!0);c(f,g,Z,"ο","\\omicron",!0);c(f,g,Z,"π","\\pi",!0);c(f,g,Z,"ρ","\\rho",!0);c(f,g,Z,"σ","\\sigma",!0);c(f,g,Z,"τ","\\tau",!0);c(f,g,Z,"υ","\\upsilon",!0);c(f,g,Z,"ϕ","\\phi",!0);c(f,g,Z,"χ","\\chi",!0);c(f,g,Z,"ψ","\\psi",!0);c(f,g,Z,"ω","\\omega",!0);c(f,g,Z,"ε","\\varepsilon",!0);c(f,g,Z,"ϑ","\\vartheta",!0);c(f,g,Z,"ϖ","\\varpi",!0);c(f,g,Z,"ϱ","\\varrho",!0);c(f,g,Z,"ς","\\varsigma",!0);c(f,g,Z,"φ","\\varphi",!0);c(f,g,W,"∗","*",!0);c(f,g,W,"+","+");c(f,g,W,"−","-",!0);c(f,g,W,"⋅","\\cdot",!0);c(f,g,W,"∘","\\circ",!0);c(f,g,W,"÷","\\div",!0);c(f,g,W,"±","\\pm",!0);c(f,g,W,"×","\\times",!0);c(f,g,W,"∩","\\cap",!0);c(f,g,W,"∪","\\cup",!0);c(f,g,W,"∖","\\setminus",!0);c(f,g,W,"∧","\\land");c(f,g,W,"∨","\\lor");c(f,g,W,"∧","\\wedge",!0);c(f,g,W,"∨","\\vee",!0);c(f,g,T,"√","\\surd");c(f,g,Ye,"⟨","\\langle",!0);c(f,g,Ye,"∣","\\lvert");c(f,g,Ye,"∥","\\lVert");c(f,g,Le,"?","?");c(f,g,Le,"!","!");c(f,g,Le,"⟩","\\rangle",!0);c(f,g,Le,"∣","\\rvert");c(f,g,Le,"∥","\\rVert");c(f,g,x,"=","=");c(f,g,x,":",":");c(f,g,x,"≈","\\approx",!0);c(f,g,x,"≅","\\cong",!0);c(f,g,x,"≥","\\ge");c(f,g,x,"≥","\\geq",!0);c(f,g,x,"←","\\gets");c(f,g,x,">","\\gt",!0);c(f,g,x,"∈","\\in",!0);c(f,g,x,"","\\@not");c(f,g,x,"⊂","\\subset",!0);c(f,g,x,"⊃","\\supset",!0);c(f,g,x,"⊆","\\subseteq",!0);c(f,g,x,"⊇","\\supseteq",!0);c(f,b,x,"⊈","\\nsubseteq",!0);c(f,b,x,"⊉","\\nsupseteq",!0);c(f,g,x,"⊨","\\models");c(f,g,x,"←","\\leftarrow",!0);c(f,g,x,"≤","\\le");c(f,g,x,"≤","\\leq",!0);c(f,g,x,"<","\\lt",!0);c(f,g,x,"→","\\rightarrow",!0);c(f,g,x,"→","\\to");c(f,b,x,"≱","\\ngeq",!0);c(f,b,x,"≰","\\nleq",!0);c(f,g,St," ","\\ ");c(f,g,St," ","\\space");c(f,g,St," ","\\nobreakspace");c(N,g,St," ","\\ ");c(N,g,St," "," ");c(N,g,St," ","\\space");c(N,g,St," ","\\nobreakspace");c(f,g,St,null,"\\nobreak");c(f,g,St,null,"\\allowbreak");c(f,g,sn,",",",");c(f,g,sn,";",";");c(f,b,W,"⊼","\\barwedge",!0);c(f,b,W,"⊻","\\veebar",!0);c(f,g,W,"⊙","\\odot",!0);c(f,g,W,"⊕","\\oplus",!0);c(f,g,W,"⊗","\\otimes",!0);c(f,g,T,"∂","\\partial",!0);c(f,g,W,"⊘","\\oslash",!0);c(f,b,W,"⊚","\\circledcirc",!0);c(f,b,W,"⊡","\\boxdot",!0);c(f,g,W,"△","\\bigtriangleup");c(f,g,W,"▽","\\bigtriangledown");c(f,g,W,"†","\\dagger");c(f,g,W,"⋄","\\diamond");c(f,g,W,"⋆","\\star");c(f,g,W,"◃","\\triangleleft");c(f,g,W,"▹","\\triangleright");c(f,g,Ye,"{","\\{");c(N,g,T,"{","\\{");c(N,g,T,"{","\\textbraceleft");c(f,g,Le,"}","\\}");c(N,g,T,"}","\\}");c(N,g,T,"}","\\textbraceright");c(f,g,Ye,"{","\\lbrace");c(f,g,Le,"}","\\rbrace");c(f,g,Ye,"[","\\lbrack",!0);c(N,g,T,"[","\\lbrack",!0);c(f,g,Le,"]","\\rbrack",!0);c(N,g,T,"]","\\rbrack",!0);c(f,g,Ye,"(","\\lparen",!0);c(f,g,Le,")","\\rparen",!0);c(N,g,T,"<","\\textless",!0);c(N,g,T,">","\\textgreater",!0);c(f,g,Ye,"⌊","\\lfloor",!0);c(f,g,Le,"⌋","\\rfloor",!0);c(f,g,Ye,"⌈","\\lceil",!0);c(f,g,Le,"⌉","\\rceil",!0);c(f,g,T,"\\","\\backslash");c(f,g,T,"∣","|");c(f,g,T,"∣","\\vert");c(N,g,T,"|","\\textbar",!0);c(f,g,T,"∥","\\|");c(f,g,T,"∥","\\Vert");c(N,g,T,"∥","\\textbardbl");c(N,g,T,"~","\\textasciitilde");c(N,g,T,"\\","\\textbackslash");c(N,g,T,"^","\\textasciicircum");c(f,g,x,"↑","\\uparrow",!0);c(f,g,x,"⇑","\\Uparrow",!0);c(f,g,x,"↓","\\downarrow",!0);c(f,g,x,"⇓","\\Downarrow",!0);c(f,g,x,"↕","\\updownarrow",!0);c(f,g,x,"⇕","\\Updownarrow",!0);c(f,g,Te,"∐","\\coprod");c(f,g,Te,"⋁","\\bigvee");c(f,g,Te,"⋀","\\bigwedge");c(f,g,Te,"⨄","\\biguplus");c(f,g,Te,"⋂","\\bigcap");c(f,g,Te,"⋃","\\bigcup");c(f,g,Te,"∫","\\int");c(f,g,Te,"∫","\\intop");c(f,g,Te,"∬","\\iint");c(f,g,Te,"∭","\\iiint");c(f,g,Te,"∏","\\prod");c(f,g,Te,"∑","\\sum");c(f,g,Te,"⨂","\\bigotimes");c(f,g,Te,"⨁","\\bigoplus");c(f,g,Te,"⨀","\\bigodot");c(f,g,Te,"∮","\\oint");c(f,g,Te,"∯","\\oiint");c(f,g,Te,"∰","\\oiiint");c(f,g,Te,"⨆","\\bigsqcup");c(f,g,Te,"∫","\\smallint");c(N,g,rr,"…","\\textellipsis");c(f,g,rr,"…","\\mathellipsis");c(N,g,rr,"…","\\ldots",!0);c(f,g,rr,"…","\\ldots",!0);c(f,g,rr,"⋯","\\@cdots",!0);c(f,g,rr,"⋱","\\ddots",!0);c(f,g,T,"⋮","\\varvdots");c(N,g,T,"⋮","\\varvdots");c(f,g,ge,"ˊ","\\acute");c(f,g,ge,"ˋ","\\grave");c(f,g,ge,"¨","\\ddot");c(f,g,ge,"~","\\tilde");c(f,g,ge,"ˉ","\\bar");c(f,g,ge,"˘","\\breve");c(f,g,ge,"ˇ","\\check");c(f,g,ge,"^","\\hat");c(f,g,ge,"⃗","\\vec");c(f,g,ge,"˙","\\dot");c(f,g,ge,"˚","\\mathring");c(f,g,Z,"","\\@imath");c(f,g,Z,"","\\@jmath");c(f,g,T,"ı","ı");c(f,g,T,"ȷ","ȷ");c(N,g,T,"ı","\\i",!0);c(N,g,T,"ȷ","\\j",!0);c(N,g,T,"ß","\\ss",!0);c(N,g,T,"æ","\\ae",!0);c(N,g,T,"œ","\\oe",!0);c(N,g,T,"ø","\\o",!0);c(N,g,T,"Æ","\\AE",!0);c(N,g,T,"Œ","\\OE",!0);c(N,g,T,"Ø","\\O",!0);c(N,g,ge,"ˊ","\\'");c(N,g,ge,"ˋ","\\`");c(N,g,ge,"ˆ","\\^");c(N,g,ge,"˜","\\~");c(N,g,ge,"ˉ","\\=");c(N,g,ge,"˘","\\u");c(N,g,ge,"˙","\\.");c(N,g,ge,"¸","\\c");c(N,g,ge,"˚","\\r");c(N,g,ge,"ˇ","\\v");c(N,g,ge,"¨",'\\"');c(N,g,ge,"˝","\\H");c(N,g,ge,"◯","\\textcircled");var as={"--":!0,"---":!0,"``":!0,"''":!0};c(N,g,T,"–","--",!0);c(N,g,T,"–","\\textendash");c(N,g,T,"—","---",!0);c(N,g,T,"—","\\textemdash");c(N,g,T,"‘","`",!0);c(N,g,T,"‘","\\textquoteleft");c(N,g,T,"’","'",!0);c(N,g,T,"’","\\textquoteright");c(N,g,T,"“","``",!0);c(N,g,T,"“","\\textquotedblleft");c(N,g,T,"”","''",!0);c(N,g,T,"”","\\textquotedblright");c(f,g,T,"°","\\degree",!0);c(N,g,T,"°","\\degree");c(N,g,T,"°","\\textdegree",!0);c(f,g,T,"£","\\pounds");c(f,g,T,"£","\\mathsterling",!0);c(N,g,T,"£","\\pounds");c(N,g,T,"£","\\textsterling",!0);c(f,b,T,"✠","\\maltese");c(N,b,T,"✠","\\maltese");var oa='0123456789/@."';for(var Rn=0;Rn0)return nt(a,u,i,r,l.concat(h));if(o){var m,d;if(o==="boldsymbol"){var p=$f(a,i,r,l,n);m=p.fontName,d=[p.fontClass]}else s?(m=os[o].fontName,d=[o]):(m=Or(o,r.fontWeight,r.fontShape),d=[o,r.fontWeight,r.fontShape]);if(on(a,m,i).metrics)return nt(a,m,i,r,l.concat(d));if(as.hasOwnProperty(a)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w{if(Ct(e.classes)!==Ct(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(e.classes.length===1){var r=e.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n in e.style)if(e.style.hasOwnProperty(n)&&e.style[n]!==t.style[n])return!1;for(var i in t.style)if(t.style.hasOwnProperty(i)&&e.style[i]!==t.style[i])return!1;return!0},Gf=e=>{for(var t=0;tr&&(r=l.height),l.depth>n&&(n=l.depth),l.maxFontSize>i&&(i=l.maxFontSize)}t.height=r,t.depth=n,t.maxFontSize=i},Oe=function(t,r,n,i){var a=new Cr(t,r,n,i);return H0(a),a},ls=(e,t,r,n)=>new Cr(e,t,r,n),Wf=function(t,r,n){var i=Oe([t],[],r);return i.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),i.style.borderBottomWidth=P(i.height),i.maxFontSize=1,i},Yf=function(t,r,n,i){var a=new q0(t,r,n,i);return H0(a),a},ss=function(t){var r=new Mr(t);return H0(r),r},Xf=function(t,r){return t instanceof Mr?Oe([],[t],r):t},Kf=function(t){if(t.positionType==="individualShift"){for(var r=t.children,n=[r[0]],i=-r[0].shift-r[0].elem.depth,a=i,l=1;l{var r=Oe(["mspace"],[],t),n=ye(e,t);return r.style.marginRight=P(n),r},Or=function(t,r,n){var i="";switch(t){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=t}var a;return r==="textbf"&&n==="textit"?a="BoldItalic":r==="textbf"?a="Bold":r==="textit"?a="Italic":a="Regular",i+"-"+a},os={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},us={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Jf=function(t,r){var[n,i,a]=us[t],l=new Et(n),s=new bt([l],{width:P(i),height:P(a),style:"width:"+P(i),viewBox:"0 0 "+1e3*i+" "+1e3*a,preserveAspectRatio:"xMinYMin"}),o=ls(["overlay"],[s],r);return o.height=a,o.style.height=P(a),o.style.width=P(i),o},C={fontMap:os,makeSymbol:nt,mathsym:jf,makeSpan:Oe,makeSvgSpan:ls,makeLineSpan:Wf,makeAnchor:Yf,makeFragment:ss,wrapFragment:Xf,makeVList:Zf,makeOrd:Uf,makeGlue:Qf,staticSvg:Jf,svgData:us,tryCombineChars:Gf},ve={number:3,unit:"mu"},Pt={number:4,unit:"mu"},dt={number:5,unit:"mu"},e2={mord:{mop:ve,mbin:Pt,mrel:dt,minner:ve},mop:{mord:ve,mop:ve,mrel:dt,minner:ve},mbin:{mord:Pt,mop:Pt,mopen:Pt,minner:Pt},mrel:{mord:dt,mop:dt,mopen:dt,minner:dt},mopen:{},mclose:{mop:ve,mbin:Pt,mrel:dt,minner:ve},mpunct:{mord:ve,mop:ve,mrel:dt,mopen:ve,mclose:ve,mpunct:ve,minner:ve},minner:{mord:ve,mop:ve,mbin:Pt,mrel:dt,mopen:ve,mpunct:ve,minner:ve}},t2={mord:{mop:ve},mop:{mord:ve,mop:ve},mbin:{},mrel:{},mopen:{},mclose:{mop:ve},mpunct:{},minner:{mop:ve}},cs={},Qr={},Jr={};function _(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:l}=e,s={type:t,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},o=0;o{var M=w.classes[0],S=y.classes[0];M==="mbin"&&n2.includes(S)?w.classes[0]="mord":S==="mbin"&&r2.includes(M)&&(y.classes[0]="mord")},{node:m},d,p),fa(a,(y,w)=>{var M=m0(w),S=m0(y),z=M&&S?y.hasClass("mtight")?t2[M][S]:e2[M][S]:null;if(z)return C.makeGlue(z,u)},{node:m},d,p),a},fa=function e(t,r,n,i,a){i&&t.push(i);for(var l=0;ld=>{t.splice(m+1,0,d),l++})(l)}i&&t.pop()},hs=function(t){return t instanceof Mr||t instanceof q0||t instanceof Cr&&t.hasClass("enclosing")?t:null},l2=function e(t,r){var n=hs(t);if(n){var i=n.children;if(i.length){if(r==="right")return e(i[i.length-1],"right");if(r==="left")return e(i[0],"left")}}return t},m0=function(t,r){return t?(r&&(t=l2(t,r)),a2[t.classes[0]]||null):null},kr=function(t,r){var n=["nulldelimiter"].concat(t.baseSizingClasses());return xt(r.concat(n))},oe=function(t,r,n){if(!t)return xt();if(Qr[t.type]){var i=Qr[t.type](t,r);if(n&&r.size!==n.size){i=xt(r.sizingClasses(n),[i],r);var a=r.sizeMultiplier/n.sizeMultiplier;i.height*=a,i.depth*=a}return i}else throw new L("Got group of unknown type: '"+t.type+"'")};function qr(e,t){var r=xt(["base"],e,t),n=xt(["strut"]);return n.style.height=P(r.height+r.depth),r.depth&&(n.style.verticalAlign=P(-r.depth)),r.children.unshift(n),r}function f0(e,t){var r=null;e.length===1&&e[0].type==="tag"&&(r=e[0].tag,e=e[0].body);var n=ze(e,t,"root"),i;n.length===2&&n[1].hasClass("tag")&&(i=n.pop());for(var a=[],l=[],s=0;s0&&(a.push(qr(l,t)),l=[]),a.push(n[s]));l.length>0&&a.push(qr(l,t));var u;r?(u=qr(ze(r,t,!0)),u.classes=["tag"],a.push(u)):i&&a.push(i);var h=xt(["katex-html"],a);if(h.setAttribute("aria-hidden","true"),u){var m=u.children[0];m.style.height=P(h.height+h.depth),h.depth&&(m.style.verticalAlign=P(-h.depth))}return h}function ms(e){return new Mr(e)}class _e{constructor(t,r,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(t,r){this.attributes[t]=r}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);this.classes.length>0&&(t.className=Ct(this.classes));for(var n=0;n0&&(t+=' class ="'+ue.escape(Ct(this.classes))+'"'),t+=">";for(var n=0;n",t}toText(){return this.children.map(t=>t.toText()).join("")}}class ot{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return ue.escape(this.toText())}toText(){return this.text}}class s2{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character="  ":t>=-.05556&&t<=-.05555?this.character=" ⁣":t>=-.1667&&t<=-.1666?this.character=" ⁣":t>=-.2223&&t<=-.2222?this.character=" ⁣":t>=-.2778&&t<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",P(this.width)),t}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var F={MathNode:_e,TextNode:ot,SpaceNode:s2,newDocumentFragment:ms},Je=function(t,r,n){return de[r][t]&&de[r][t].replace&&t.charCodeAt(0)!==55349&&!(as.hasOwnProperty(t)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(t=de[r][t].replace),new F.TextNode(t)},V0=function(t){return t.length===1?t[0]:new F.MathNode("mrow",t)},j0=function(t,r){if(r.fontFamily==="texttt")return"monospace";if(r.fontFamily==="textsf")return r.fontShape==="textit"&&r.fontWeight==="textbf"?"sans-serif-bold-italic":r.fontShape==="textit"?"sans-serif-italic":r.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(r.fontShape==="textit"&&r.fontWeight==="textbf")return"bold-italic";if(r.fontShape==="textit")return"italic";if(r.fontWeight==="textbf")return"bold";var n=r.font;if(!n||n==="mathnormal")return null;var i=t.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return t.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var a=t.text;if(["\\imath","\\jmath"].includes(a))return null;de[i][a]&&de[i][a].replace&&(a=de[i][a].replace);var l=C.fontMap[n].fontName;return O0(a,l,i)?C.fontMap[n].variant:null};function Hn(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof ot&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var r=e.children[0];return r instanceof ot&&r.text===","}else return!1}var Ve=function(t,r,n){if(t.length===1){var i=me(t[0],r);return n&&i instanceof _e&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var a=[],l,s=0;s=1&&(l.type==="mn"||Hn(l))){var u=o.children[0];u instanceof _e&&u.type==="mn"&&(u.children=[...l.children,...u.children],a.pop())}else if(l.type==="mi"&&l.children.length===1){var h=l.children[0];if(h instanceof ot&&h.text==="̸"&&(o.type==="mo"||o.type==="mi"||o.type==="mn")){var m=o.children[0];m instanceof ot&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),a.pop())}}}a.push(o),l=o}return a},Dt=function(t,r,n){return V0(Ve(t,r,n))},me=function(t,r){if(!t)return new F.MathNode("mrow");if(Jr[t.type]){var n=Jr[t.type](t,r);return n}else throw new L("Got group of unknown type: '"+t.type+"'")};function pa(e,t,r,n,i){var a=Ve(e,r),l;a.length===1&&a[0]instanceof _e&&["mrow","mtable"].includes(a[0].type)?l=a[0]:l=new F.MathNode("mrow",a);var s=new F.MathNode("annotation",[new F.TextNode(t)]);s.setAttribute("encoding","application/x-tex");var o=new F.MathNode("semantics",[l,s]),u=new F.MathNode("math",[o]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&u.setAttribute("display","block");var h=i?"katex":"katex-mathml";return C.makeSpan([h],[u])}var fs=function(t){return new gt({style:t.displayMode?Q.DISPLAY:Q.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},ps=function(t,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),t=C.makeSpan(n,[t])}return t},o2=function(t,r,n){var i=fs(n),a;if(n.output==="mathml")return pa(t,r,i,n.displayMode,!0);if(n.output==="html"){var l=f0(t,i);a=C.makeSpan(["katex"],[l])}else{var s=pa(t,r,i,n.displayMode,!1),o=f0(t,i);a=C.makeSpan(["katex"],[s,o])}return ps(a,n)},u2=function(t,r,n){var i=fs(n),a=f0(t,i),l=C.makeSpan(["katex"],[a]);return ps(l,n)},c2={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},h2=function(t){var r=new F.MathNode("mo",[new F.TextNode(c2[t.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},m2={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},f2=function(t){return t.type==="ordgroup"?t.body.length:1},p2=function(t,r){function n(){var s=4e5,o=t.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(o)){var u=t,h=f2(u.base),m,d,p;if(h>5)o==="widehat"||o==="widecheck"?(m=420,s=2364,p=.42,d=o+"4"):(m=312,s=2340,p=.34,d="tilde4");else{var y=[1,1,2,2,3,3][h];o==="widehat"||o==="widecheck"?(s=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],p=[0,.24,.3,.3,.36,.42][y],d=o+y):(s=[0,600,1033,2339,2340][y],m=[0,260,286,306,312][y],p=[0,.26,.286,.3,.306,.34][y],d="tilde"+y)}var w=new Et(d),M=new bt([w],{width:"100%",height:P(p),viewBox:"0 0 "+s+" "+m,preserveAspectRatio:"none"});return{span:C.makeSvgSpan([],[M],r),minWidth:0,height:p}}else{var S=[],z=m2[o],[I,V,O]=z,E=O/1e3,G=I.length,K,U;if(G===1){var D=z[3];K=["hide-tail"],U=[D]}else if(G===2)K=["halfarrow-left","halfarrow-right"],U=["xMinYMin","xMaxYMin"];else if(G===3)K=["brace-left","brace-center","brace-right"],U=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+G+" children.");for(var $=0;$0&&(i.style.minWidth=P(a)),i},d2=function(t,r,n,i,a){var l,s=t.height+t.depth+n+i;if(/fbox|color|angl/.test(r)){if(l=C.makeSpan(["stretchy",r],[],a),r==="fbox"){var o=a.color&&a.getColor();o&&(l.style.borderColor=o)}}else{var u=[];/^[bx]cancel$/.test(r)&&u.push(new c0({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&u.push(new c0({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new bt(u,{width:"100%",height:P(s)});l=C.makeSvgSpan([],[h],a)}return l.height=s,l.style.height=P(s),l},wt={encloseSpan:d2,mathMLnode:h2,svgSpan:p2};function re(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function $0(e){var t=un(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function un(e){return e&&(e.type==="atom"||Hf.hasOwnProperty(e.type))?e:null}var U0=(e,t)=>{var r,n,i;e&&e.type==="supsub"?(n=re(e.base,"accent"),r=n.base,e.base=r,i=Of(oe(e,t)),e.base=n):(n=re(e,"accent"),r=n.base);var a=oe(r,t.havingCrampedStyle()),l=n.isShifty&&ue.isCharacterBox(r),s=0;if(l){var o=ue.getBaseElem(r),u=oe(o,t.havingCrampedStyle());s=sa(u).skew}var h=n.label==="\\c",m=h?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),d;if(n.isStretchy)d=wt.svgSpan(n,t),d=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:d,wrapperClasses:["svg-align"],wrapperStyle:s>0?{width:"calc(100% - "+P(2*s)+")",marginLeft:P(2*s)}:void 0}]},t);else{var p,y;n.label==="\\vec"?(p=C.staticSvg("vec",t),y=C.svgData.vec[1]):(p=C.makeOrd({mode:n.mode,text:n.label},t,"textord"),p=sa(p),p.italic=0,y=p.width,h&&(m+=p.depth)),d=C.makeSpan(["accent-body"],[p]);var w=n.label==="\\textcircled";w&&(d.classes.push("accent-full"),m=a.height);var M=s;w||(M-=y/2),d.style.left=P(M),n.label==="\\textcircled"&&(d.style.top=".2em"),d=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-m},{type:"elem",elem:d}]},t)}var S=C.makeSpan(["mord","accent"],[d],t);return i?(i.children[0]=S,i.height=Math.max(S.height,i.height),i.classes[0]="mord",i):S},ds=(e,t)=>{var r=e.isStretchy?wt.mathMLnode(e.label):new F.MathNode("mo",[Je(e.label,e.mode)]),n=new F.MathNode("mover",[me(e.base,t),r]);return n.setAttribute("accent","true"),n},g2=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));_({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var r=en(t[0]),n=!g2.test(e.funcName),i=!n||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:i,base:r}},htmlBuilder:U0,mathmlBuilder:ds});_({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var r=t[0],n=e.parser.mode;return n==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:U0,mathmlBuilder:ds});_({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:i}},htmlBuilder:(e,t)=>{var r=oe(e.base,t),n=wt.svgSpan(e,t),i=e.label==="\\utilde"?.12:0,a=C.makeVList({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:r}]},t);return C.makeSpan(["mord","accentunder"],[a],t)},mathmlBuilder:(e,t)=>{var r=wt.mathMLnode(e.label),n=new F.MathNode("munder",[me(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});var Hr=e=>{var t=new F.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};_({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n,funcName:i}=e;return{type:"xArrow",mode:n.mode,label:i,body:t[0],below:r[0]}},htmlBuilder(e,t){var r=t.style,n=t.havingStyle(r.sup()),i=C.wrapFragment(oe(e.body,n,t),t),a=e.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(a+"-arrow-pad");var l;e.below&&(n=t.havingStyle(r.sub()),l=C.wrapFragment(oe(e.below,n,t),t),l.classes.push(a+"-arrow-pad"));var s=wt.svgSpan(e,t),o=-t.fontMetrics().axisHeight+.5*s.height,u=-t.fontMetrics().axisHeight-.5*s.height-.111;(i.depth>.25||e.label==="\\xleftequilibrium")&&(u-=i.depth);var h;if(l){var m=-t.fontMetrics().axisHeight+l.height+.5*s.height+.111;h=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:s,shift:o},{type:"elem",elem:l,shift:m}]},t)}else h=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:s,shift:o}]},t);return h.children[0].children[0].children[1].classes.push("svg-align"),C.makeSpan(["mrel","x-arrow"],[h],t)},mathmlBuilder(e,t){var r=wt.mathMLnode(e.label);r.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(e.body){var i=Hr(me(e.body,t));if(e.below){var a=Hr(me(e.below,t));n=new F.MathNode("munderover",[r,a,i])}else n=new F.MathNode("mover",[r,i])}else if(e.below){var l=Hr(me(e.below,t));n=new F.MathNode("munder",[r,l])}else n=Hr(),n=new F.MathNode("mover",[r,n]);return n}});var v2=C.makeSpan;function gs(e,t){var r=ze(e.body,t,!0);return v2([e.mclass],r,t)}function vs(e,t){var r,n=Ve(e.body,t);return e.mclass==="minner"?r=new F.MathNode("mpadded",n):e.mclass==="mord"?e.isCharacterBox?(r=n[0],r.type="mi"):r=new F.MathNode("mi",n):(e.isCharacterBox?(r=n[0],r.type="mo"):r=new F.MathNode("mo",n),e.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}_({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:we(i),isCharacterBox:ue.isCharacterBox(i)}},htmlBuilder:gs,mathmlBuilder:vs});var cn=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};_({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:r}=e;return{type:"mclass",mode:r.mode,mclass:cn(t[0]),body:we(t[1]),isCharacterBox:ue.isCharacterBox(t[1])}}});_({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:r,funcName:n}=e,i=t[1],a=t[0],l;n!=="\\stackrel"?l=cn(i):l="mrel";var s={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:we(i)},o={type:"supsub",mode:a.mode,base:s,sup:n==="\\underset"?null:a,sub:n==="\\underset"?a:null};return{type:"mclass",mode:r.mode,mclass:l,body:[o],isCharacterBox:ue.isCharacterBox(o)}},htmlBuilder:gs,mathmlBuilder:vs});_({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"pmb",mode:r.mode,mclass:cn(t[0]),body:we(t[0])}},htmlBuilder(e,t){var r=ze(e.body,t,!0),n=C.makeSpan([e.mclass],r,t);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(e,t){var r=Ve(e.body,t),n=new F.MathNode("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var y2={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},da=()=>({type:"styling",body:[],mode:"math",style:"display"}),ga=e=>e.type==="textord"&&e.text==="@",b2=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function x2(e,t,r){var n=y2[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var i=r.callFunction("\\\\cdleft",[t[0]],[]),a={type:"atom",text:n,mode:"math",family:"rel"},l=r.callFunction("\\Big",[a],[]),s=r.callFunction("\\\\cdright",[t[1]],[]),o={type:"ordgroup",mode:"math",body:[i,l,s]};return r.callFunction("\\\\cdparent",[o],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function w2(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if(r==="&"||r==="\\\\")e.consume();else if(r==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new L("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var n=[],i=[n],a=0;a-1))if("<>AV".indexOf(u)>-1)for(var m=0;m<2;m++){for(var d=!0,p=o+1;pAV=|." after @',l[o]);var y=x2(u,h,e),w={type:"styling",body:[y],mode:"math",style:"display"};n.push(w),s=da()}a%2===0?n.push(s):n.shift(),n=[],i.push(n)}e.gullet.endGroup(),e.gullet.endGroup();var M=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:M,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}_({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder(e,t){var r=t.havingStyle(t.style.sup()),n=C.wrapFragment(oe(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=P(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(e,t){var r=new F.MathNode("mrow",[me(e.label,t)]);return r=new F.MathNode("mpadded",[r]),r.setAttribute("width","0"),e.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new F.MathNode("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});_({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:r}=e;return{type:"cdlabelparent",mode:r.mode,fragment:t[0]}},htmlBuilder(e,t){var r=C.wrapFragment(oe(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(e,t){return new F.MathNode("mrow",[me(e.fragment,t)])}});_({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:r}=e,n=re(t[0],"ordgroup"),i=n.body,a="",l=0;l=1114111)throw new L("\\@char with invalid code point "+a);return o<=65535?u=String.fromCharCode(o):(o-=65536,u=String.fromCharCode((o>>10)+55296,(o&1023)+56320)),{type:"textord",mode:r.mode,text:u}}});var ys=(e,t)=>{var r=ze(e.body,t.withColor(e.color),!1);return C.makeFragment(r)},bs=(e,t)=>{var r=Ve(e.body,t.withColor(e.color)),n=new F.MathNode("mstyle",r);return n.setAttribute("mathcolor",e.color),n};_({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:r}=e,n=re(t[0],"color-token").color,i=t[1];return{type:"color",mode:r.mode,color:n,body:we(i)}},htmlBuilder:ys,mathmlBuilder:bs});_({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:r,breakOnTokenText:n}=e,i=re(t[0],"color-token").color;r.gullet.macros.set("\\current@color",i);var a=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:i,body:a}},htmlBuilder:ys,mathmlBuilder:bs});_({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,r){var{parser:n}=e,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,a=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:a,size:i&&re(i,"size").value}},htmlBuilder(e,t){var r=C.makeSpan(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=P(ye(e.size,t)))),r},mathmlBuilder(e,t){var r=new F.MathNode("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",P(ye(e.size,t)))),r}});var p0={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},xs=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new L("Expected a control sequence",e);return t},k2=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},ws=(e,t,r,n)=>{var i=e.gullet.macros.get(r.text);i==null&&(r.noexpand=!0,i={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,i,n)};_({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:r}=e;t.consumeSpaces();var n=t.fetch();if(p0[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=p0[n.text]),re(t.parseFunction(),"internal");throw new L("Invalid token after macro prefix",n)}});_({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=t.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new L("Expected a control sequence",n);for(var a=0,l,s=[[]];t.gullet.future().text!=="{";)if(n=t.gullet.popToken(),n.text==="#"){if(t.gullet.future().text==="{"){l=t.gullet.future(),s[a].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new L('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==a+1)throw new L('Argument number "'+n.text+'" out of order');a++,s.push([])}else{if(n.text==="EOF")throw new L("Expected a macro definition");s[a].push(n.text)}var{tokens:o}=t.gullet.consumeArg();return l&&o.unshift(l),(r==="\\edef"||r==="\\xdef")&&(o=t.gullet.expandTokens(o),o.reverse()),t.gullet.macros.set(i,{tokens:o,numArgs:a,delimiters:s},r===p0[r]),{type:"internal",mode:t.mode}}});_({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=xs(t.gullet.popToken());t.gullet.consumeSpaces();var i=k2(t);return ws(t,n,i,r==="\\\\globallet"),{type:"internal",mode:t.mode}}});_({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=xs(t.gullet.popToken()),i=t.gullet.popToken(),a=t.gullet.popToken();return ws(t,n,a,r==="\\\\globalfuture"),t.gullet.pushToken(a),t.gullet.pushToken(i),{type:"internal",mode:t.mode}}});var fr=function(t,r,n){var i=de.math[t]&&de.math[t].replace,a=O0(i||t,r,n);if(!a)throw new Error("Unsupported symbol "+t+" and font size "+r+".");return a},_0=function(t,r,n,i){var a=n.havingBaseStyle(r),l=C.makeSpan(i.concat(a.sizingClasses(n)),[t],n),s=a.sizeMultiplier/n.sizeMultiplier;return l.height*=s,l.depth*=s,l.maxFontSize=a.sizeMultiplier,l},ks=function(t,r,n){var i=r.havingBaseStyle(n),a=(1-r.sizeMultiplier/i.sizeMultiplier)*r.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=P(a),t.height-=a,t.depth+=a},S2=function(t,r,n,i,a,l){var s=C.makeSymbol(t,"Main-Regular",a,i),o=_0(s,r,i,l);return n&&ks(o,i,r),o},A2=function(t,r,n,i){return C.makeSymbol(t,"Size"+r+"-Regular",n,i)},Ss=function(t,r,n,i,a,l){var s=A2(t,r,a,i),o=_0(C.makeSpan(["delimsizing","size"+r],[s],i),Q.TEXT,i,l);return n&&ks(o,i,Q.TEXT),o},Vn=function(t,r,n){var i;r==="Size1-Regular"?i="delim-size1":i="delim-size4";var a=C.makeSpan(["delimsizinginner",i],[C.makeSpan([],[C.makeSymbol(t,r,n)])]);return{type:"elem",elem:a}},jn=function(t,r,n){var i=st["Size4-Regular"][t.charCodeAt(0)]?st["Size4-Regular"][t.charCodeAt(0)][4]:st["Size1-Regular"][t.charCodeAt(0)][4],a=new Et("inner",Ef(t,Math.round(1e3*r))),l=new bt([a],{width:P(i),height:P(r),style:"width:"+P(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),s=C.makeSvgSpan([],[l],n);return s.height=r,s.style.height=P(r),s.style.width=P(i),{type:"elem",elem:s}},d0=.008,Vr={type:"kern",size:-1*d0},T2=["|","\\lvert","\\rvert","\\vert"],z2=["\\|","\\lVert","\\rVert","\\Vert"],As=function(t,r,n,i,a,l){var s,o,u,h,m="",d=0;s=u=h=t,o=null;var p="Size1-Regular";t==="\\uparrow"?u=h="⏐":t==="\\Uparrow"?u=h="‖":t==="\\downarrow"?s=u="⏐":t==="\\Downarrow"?s=u="‖":t==="\\updownarrow"?(s="\\uparrow",u="⏐",h="\\downarrow"):t==="\\Updownarrow"?(s="\\Uparrow",u="‖",h="\\Downarrow"):T2.includes(t)?(u="∣",m="vert",d=333):z2.includes(t)?(u="∥",m="doublevert",d=556):t==="["||t==="\\lbrack"?(s="⎡",u="⎢",h="⎣",p="Size4-Regular",m="lbrack",d=667):t==="]"||t==="\\rbrack"?(s="⎤",u="⎥",h="⎦",p="Size4-Regular",m="rbrack",d=667):t==="\\lfloor"||t==="⌊"?(u=s="⎢",h="⎣",p="Size4-Regular",m="lfloor",d=667):t==="\\lceil"||t==="⌈"?(s="⎡",u=h="⎢",p="Size4-Regular",m="lceil",d=667):t==="\\rfloor"||t==="⌋"?(u=s="⎥",h="⎦",p="Size4-Regular",m="rfloor",d=667):t==="\\rceil"||t==="⌉"?(s="⎤",u=h="⎥",p="Size4-Regular",m="rceil",d=667):t==="("||t==="\\lparen"?(s="⎛",u="⎜",h="⎝",p="Size4-Regular",m="lparen",d=875):t===")"||t==="\\rparen"?(s="⎞",u="⎟",h="⎠",p="Size4-Regular",m="rparen",d=875):t==="\\{"||t==="\\lbrace"?(s="⎧",o="⎨",h="⎩",u="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(s="⎫",o="⎬",h="⎭",u="⎪",p="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(s="⎧",h="⎩",u="⎪",p="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(s="⎫",h="⎭",u="⎪",p="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(s="⎧",h="⎭",u="⎪",p="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(s="⎫",h="⎩",u="⎪",p="Size4-Regular");var y=fr(s,p,a),w=y.height+y.depth,M=fr(u,p,a),S=M.height+M.depth,z=fr(h,p,a),I=z.height+z.depth,V=0,O=1;if(o!==null){var E=fr(o,p,a);V=E.height+E.depth,O=2}var G=w+I+V,K=Math.max(0,Math.ceil((r-G)/(O*S))),U=G+K*O*S,D=i.fontMetrics().axisHeight;n&&(D*=i.sizeMultiplier);var $=U/2-D,j=[];if(m.length>0){var ie=U-w-I,Y=Math.round(U*1e3),q=Df(m,Math.round(ie*1e3)),ae=new Et(m,q),fe=(d/1e3).toFixed(3)+"em",Me=(Y/1e3).toFixed(3)+"em",je=new bt([ae],{width:fe,height:Me,viewBox:"0 0 "+d+" "+Y}),k=C.makeSvgSpan([],[je],i);k.height=Y/1e3,k.style.width=fe,k.style.height=Me,j.push({type:"elem",elem:k})}else{if(j.push(Vn(h,p,a)),j.push(Vr),o===null){var ke=U-w-I+2*d0;j.push(jn(u,ke,i))}else{var be=(U-w-I-V)/2+2*d0;j.push(jn(u,be,i)),j.push(Vr),j.push(Vn(o,p,a)),j.push(Vr),j.push(jn(u,be,i))}j.push(Vr),j.push(Vn(s,p,a))}var A=i.havingBaseStyle(Q.TEXT),De=C.makeVList({positionType:"bottom",positionData:$,children:j},A);return _0(C.makeSpan(["delimsizing","mult"],[De],A),Q.TEXT,i,l)},$n=80,Un=.08,_n=function(t,r,n,i,a){var l=Cf(t,i,n),s=new Et(t,l),o=new bt([s],{width:"400em",height:P(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return C.makeSvgSpan(["hide-tail"],[o],a)},M2=function(t,r){var n=r.havingBaseSizing(),i=Cs("\\surd",t*n.sizeMultiplier,Ms,n),a=n.sizeMultiplier,l=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),s,o=0,u=0,h=0,m;return i.type==="small"?(h=1e3+1e3*l+$n,t<1?a=1:t<1.4&&(a=.7),o=(1+l+Un)/a,u=(1+l)/a,s=_n("sqrtMain",o,h,l,r),s.style.minWidth="0.853em",m=.833/a):i.type==="large"?(h=(1e3+$n)*vr[i.size],u=(vr[i.size]+l)/a,o=(vr[i.size]+l+Un)/a,s=_n("sqrtSize"+i.size,o,h,l,r),s.style.minWidth="1.02em",m=1/a):(o=t+l+Un,u=t+l,h=Math.floor(1e3*t+l)+$n,s=_n("sqrtTall",o,h,l,r),s.style.minWidth="0.742em",m=1.056),s.height=u,s.style.height=P(o),{span:s,advanceWidth:m,ruleWidth:(r.fontMetrics().sqrtRuleThickness+l)*a}},Ts=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],C2=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],zs=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],vr=[0,1.2,1.8,2.4,3],E2=function(t,r,n,i,a){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),Ts.includes(t)||zs.includes(t))return Ss(t,r,!1,n,i,a);if(C2.includes(t))return As(t,vr[r],!1,n,i,a);throw new L("Illegal delimiter: '"+t+"'")},D2=[{type:"small",style:Q.SCRIPTSCRIPT},{type:"small",style:Q.SCRIPT},{type:"small",style:Q.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],I2=[{type:"small",style:Q.SCRIPTSCRIPT},{type:"small",style:Q.SCRIPT},{type:"small",style:Q.TEXT},{type:"stack"}],Ms=[{type:"small",style:Q.SCRIPTSCRIPT},{type:"small",style:Q.SCRIPT},{type:"small",style:Q.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],B2=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},Cs=function(t,r,n,i){for(var a=Math.min(2,3-i.style.size),l=a;lr)return n[l]}return n[n.length-1]},Es=function(t,r,n,i,a,l){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var s;zs.includes(t)?s=D2:Ts.includes(t)?s=Ms:s=I2;var o=Cs(t,r,s,i);return o.type==="small"?S2(t,o.style,n,i,a,l):o.type==="large"?Ss(t,o.size,n,i,a,l):As(t,r,n,i,a,l)},N2=function(t,r,n,i,a,l){var s=i.fontMetrics().axisHeight*i.sizeMultiplier,o=901,u=5/i.fontMetrics().ptPerEm,h=Math.max(r-s,n+s),m=Math.max(h/500*o,2*h-u);return Es(t,m,!0,i,a,l)},yt={sqrtImage:M2,sizedDelim:E2,sizeToMaxHeight:vr,customSizedDelim:Es,leftRightDelim:N2},va={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},F2=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function hn(e,t){var r=un(e);if(r&&F2.includes(r.text))return r;throw r?new L("Invalid delimiter '"+r.text+"' after '"+t.funcName+"'",e):new L("Invalid delimiter type '"+e.type+"'",e)}_({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var r=hn(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:va[e.funcName].size,mclass:va[e.funcName].mclass,delim:r.text}},htmlBuilder:(e,t)=>e.delim==="."?C.makeSpan([e.mclass]):yt.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Je(e.delim,e.mode));var r=new F.MathNode("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=P(yt.sizeToMaxHeight[e.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});function ya(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}_({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=e.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new L("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:hn(t[0],e).text,color:r}}});_({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=hn(t[0],e),n=e.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var a=re(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:r.text,right:a.delim,rightColor:a.color}},htmlBuilder:(e,t)=>{ya(e);for(var r=ze(e.body,t,!0,["mopen","mclose"]),n=0,i=0,a=!1,l=0;l{ya(e);var r=Ve(e.body,t);if(e.left!=="."){var n=new F.MathNode("mo",[Je(e.left,e.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(e.right!=="."){var i=new F.MathNode("mo",[Je(e.right,e.mode)]);i.setAttribute("fence","true"),e.rightColor&&i.setAttribute("mathcolor",e.rightColor),r.push(i)}return V0(r)}});_({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=hn(t[0],e);if(!e.parser.leftrightDepth)throw new L("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},htmlBuilder:(e,t)=>{var r;if(e.delim===".")r=kr(t,[]);else{r=yt.sizedDelim(e.delim,1,t,e.mode,[]);var n={delim:e.delim,options:t};r.isMiddle=n}return r},mathmlBuilder:(e,t)=>{var r=e.delim==="\\vert"||e.delim==="|"?Je("|","text"):Je(e.delim,e.mode),n=new F.MathNode("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var G0=(e,t)=>{var r=C.wrapFragment(oe(e.body,t),t),n=e.label.slice(1),i=t.sizeMultiplier,a,l=0,s=ue.isCharacterBox(e.body);if(n==="sout")a=C.makeSpan(["stretchy","sout"]),a.height=t.fontMetrics().defaultRuleThickness/i,l=-.5*t.fontMetrics().xHeight;else if(n==="phase"){var o=ye({number:.6,unit:"pt"},t),u=ye({number:.35,unit:"ex"},t),h=t.havingBaseSizing();i=i/h.sizeMultiplier;var m=r.height+r.depth+o+u;r.style.paddingLeft=P(m/2+o);var d=Math.floor(1e3*m*i),p=zf(d),y=new bt([new Et("phase",p)],{width:"400em",height:P(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});a=C.makeSvgSpan(["hide-tail"],[y],t),a.style.height=P(m),l=r.depth+o+u}else{/cancel/.test(n)?s||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var w=0,M=0,S=0;/box/.test(n)?(S=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),w=t.fontMetrics().fboxsep+(n==="colorbox"?0:S),M=w):n==="angl"?(S=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),w=4*S,M=Math.max(0,.25-r.depth)):(w=s?.2:0,M=w),a=wt.encloseSpan(r,n,w,M,t),/fbox|boxed|fcolorbox/.test(n)?(a.style.borderStyle="solid",a.style.borderWidth=P(S)):n==="angl"&&S!==.049&&(a.style.borderTopWidth=P(S),a.style.borderRightWidth=P(S)),l=r.depth+M,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var z;if(e.backgroundColor)z=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:l},{type:"elem",elem:r,shift:0}]},t);else{var I=/cancel|phase/.test(n)?["svg-align"]:[];z=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:a,shift:l,wrapperClasses:I}]},t)}return/cancel/.test(n)&&(z.height=r.height,z.depth=r.depth),/cancel/.test(n)&&!s?C.makeSpan(["mord","cancel-lap"],[z],t):C.makeSpan(["mord"],[z],t)},W0=(e,t)=>{var r=0,n=new F.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[me(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),e.label==="\\fcolorbox"){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+i+"em solid "+String(e.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n};_({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=re(t[0],"color-token").color,l=t[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:a,body:l}},htmlBuilder:G0,mathmlBuilder:W0});_({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=re(t[0],"color-token").color,l=re(t[1],"color-token").color,s=t[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:l,borderColor:a,body:s}},htmlBuilder:G0,mathmlBuilder:W0});_({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\fbox",body:t[0]}}});_({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:G0,mathmlBuilder:W0});_({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\angl",body:t[0]}}});var Ds={};function ct(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:l}=e,s={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},o=0;o{var t=e.parser.settings;if(!t.displayMode)throw new L("{"+e.envName+"} can be used only in display mode.")};function Y0(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Bt(e,t,r){var{hskipBeforeAndAfter:n,addJot:i,cols:a,arraystretch:l,colSeparationType:s,autoTag:o,singleRow:u,emptySingleRow:h,maxNumCols:m,leqno:d}=t;if(e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),!l){var p=e.gullet.expandMacroAsText("\\arraystretch");if(p==null)l=1;else if(l=parseFloat(p),!l||l<0)throw new L("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var y=[],w=[y],M=[],S=[],z=o!=null?[]:void 0;function I(){o&&e.gullet.macros.set("\\@eqnsw","1",!0)}function V(){z&&(e.gullet.macros.get("\\df@tag")?(z.push(e.subparse([new We("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):z.push(!!o&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(I(),S.push(ba(e));;){var O=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),O={type:"ordgroup",mode:e.mode,body:O},r&&(O={type:"styling",mode:e.mode,style:r,body:[O]}),y.push(O);var E=e.fetch().text;if(E==="&"){if(m&&y.length===m){if(u||s)throw new L("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(E==="\\end"){V(),y.length===1&&O.type==="styling"&&O.body[0].body.length===0&&(w.length>1||!h)&&w.pop(),S.length0&&(I+=.25),u.push({pos:I,isDashed:Ut[Nt]})}for(V(l[0]),n=0;n0&&($+=z,G<$&&(G=$),$=0)),t.addJot&&(G+=w),K.height=E,K.depth=G,I+=E,K.pos=I,I+=G+$,o[n]=K,V(l[n+1])}var j=I/2+r.fontMetrics().axisHeight,ie=t.cols||[],Y=[],q,ae,fe=[];if(t.tags&&t.tags.some(Ut=>Ut))for(n=0;n=s)){var Xe=void 0;(i>0||t.hskipBeforeAndAfter)&&(Xe=ue.deflt(be.pregap,d),Xe!==0&&(q=C.makeSpan(["arraycolsep"],[]),q.style.width=P(Xe),Y.push(q)));var Ie=[];for(n=0;n0){for(var pn=C.makeLineSpan("hline",r,h),dn=C.makeLineSpan("hdashline",r,h),ir=[{type:"elem",elem:o,shift:0}];u.length>0;){var ar=u.pop(),lr=ar.pos-j;ar.isDashed?ir.push({type:"elem",elem:dn,shift:lr}):ir.push({type:"elem",elem:pn,shift:lr})}o=C.makeVList({positionType:"individualShift",children:ir},r)}if(fe.length===0)return C.makeSpan(["mord"],[o],r);var $t=C.makeVList({positionType:"individualShift",children:fe},r);return $t=C.makeSpan(["tag"],[$t],r),C.makeFragment([o,$t])},L2={c:"center ",l:"left ",r:"right "},mt=function(t,r){for(var n=[],i=new F.MathNode("mtd",[],["mtr-glue"]),a=new F.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var y=t.cols,w="",M=!1,S=0,z=y.length;y[0].type==="separator"&&(d+="top ",S=1),y[y.length-1].type==="separator"&&(d+="bottom ",z-=1);for(var I=S;I0?"left ":"",d+=K[K.length-1].length>0?"right ":"";for(var U=1;U-1?"alignat":"align",a=t.envName==="split",l=Bt(t.parser,{cols:n,addJot:!0,autoTag:a?void 0:Y0(t.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:a?2:void 0,leqno:t.parser.settings.leqno},"display"),s,o=0,u={type:"ordgroup",mode:t.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){for(var h="",m=0;m0&&p&&(M=1),n[y]={type:"align",align:w,pregap:M,postgap:0}}return l.colSeparationType=p?"align":"alignat",l};ct({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var r=un(t[0]),n=r?[t[0]]:re(t[0],"ordgroup").body,i=n.map(function(l){var s=$0(l),o=s.text;if("lcr".indexOf(o)!==-1)return{type:"align",align:o};if(o==="|")return{type:"separator",separator:"|"};if(o===":")return{type:"separator",separator:":"};throw new L("Unknown column alignment: "+o,l)}),a={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Bt(e.parser,a,X0(e.envName))},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(e.envName.charAt(e.envName.length-1)==="*"){var i=e.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,"lcr".indexOf(r)===-1)throw new L("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:r}]}}var a=Bt(e.parser,n,X0(e.envName)),l=Math.max(0,...a.body.map(s=>s.length));return a.cols=new Array(l).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},r=Bt(e.parser,t,"script");return r.colSeparationType="small",r},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var r=un(t[0]),n=r?[t[0]]:re(t[0],"ordgroup").body,i=n.map(function(l){var s=$0(l),o=s.text;if("lc".indexOf(o)!==-1)return{type:"align",align:o};throw new L("Unknown column alignment: "+o,l)});if(i.length>1)throw new L("{subarray} can contain only one column");var a={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(a=Bt(e.parser,a,"script"),a.body.length>0&&a.body[0].length>1)throw new L("{subarray} can contain only one column");return a},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=Bt(e.parser,t,X0(e.envName));return{type:"leftright",mode:e.mode,body:[r],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Bs,htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&mn(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Y0(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Bs,htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){mn(e);var t={autoTag:Y0(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["CD"],props:{numArgs:0},handler(e){return mn(e),w2(e.parser)},htmlBuilder:ht,mathmlBuilder:mt});v("\\nonumber","\\gdef\\@eqnsw{0}");v("\\notag","\\nonumber");_({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new L(e.funcName+" valid only within array environment")}});var xa=Ds;_({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];if(i.type!=="ordgroup")throw new L("Invalid environment name",i);for(var a="",l=0;l{var r=e.font,n=t.withFont(r);return oe(e.body,n)},Fs=(e,t)=>{var r=e.font,n=t.withFont(r);return me(e.body,n)},wa={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};_({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=en(t[0]),a=n;return a in wa&&(a=wa[a]),{type:"font",mode:r.mode,font:a.slice(1),body:i}},htmlBuilder:Ns,mathmlBuilder:Fs});_({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:r}=e,n=t[0],i=ue.isCharacterBox(n);return{type:"mclass",mode:r.mode,mclass:cn(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:i}}});_({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n,breakOnTokenText:i}=e,{mode:a}=r,l=r.parseExpression(!0,i),s="math"+n.slice(1);return{type:"font",mode:a,font:s,body:{type:"ordgroup",mode:r.mode,body:l}}},htmlBuilder:Ns,mathmlBuilder:Fs});var Ls=(e,t)=>{var r=t;return e==="display"?r=r.id>=Q.SCRIPT.id?r.text():Q.DISPLAY:e==="text"&&r.size===Q.DISPLAY.size?r=Q.TEXT:e==="script"?r=Q.SCRIPT:e==="scriptscript"&&(r=Q.SCRIPTSCRIPT),r},K0=(e,t)=>{var r=Ls(e.size,t.style),n=r.fracNum(),i=r.fracDen(),a;a=t.havingStyle(n);var l=oe(e.numer,a,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,o=3.5/t.fontMetrics().ptPerEm;l.height=l.height0?y=3*d:y=7*d,w=t.fontMetrics().denom1):(m>0?(p=t.fontMetrics().num2,y=d):(p=t.fontMetrics().num3,y=3*d),w=t.fontMetrics().denom2);var M;if(h){var z=t.fontMetrics().axisHeight;p-l.depth-(z+.5*m){var r=new F.MathNode("mfrac",[me(e.numer,t),me(e.denom,t)]);if(!e.hasBarLine)r.setAttribute("linethickness","0px");else if(e.barSize){var n=ye(e.barSize,t);r.setAttribute("linethickness",P(n))}var i=Ls(e.size,t.style);if(i.size!==t.style.size){r=new F.MathNode("mstyle",[r]);var a=i.size===Q.DISPLAY.size?"true":"false";r.setAttribute("displaystyle",a),r.setAttribute("scriptlevel","0")}if(e.leftDelim!=null||e.rightDelim!=null){var l=[];if(e.leftDelim!=null){var s=new F.MathNode("mo",[new F.TextNode(e.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),l.push(s)}if(l.push(r),e.rightDelim!=null){var o=new F.MathNode("mo",[new F.TextNode(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),l.push(o)}return V0(l)}return r};_({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=t[1],l,s=null,o=null,u="auto";switch(n){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,s="(",o=")";break;case"\\\\bracefrac":l=!1,s="\\{",o="\\}";break;case"\\\\brackfrac":l=!1,s="[",o="]";break;default:throw new Error("Unrecognized genfrac command")}switch(n){case"\\dfrac":case"\\dbinom":u="display";break;case"\\tfrac":case"\\tbinom":u="text";break}return{type:"genfrac",mode:r.mode,continued:!1,numer:i,denom:a,hasBarLine:l,leftDelim:s,rightDelim:o,size:u,barSize:null}},htmlBuilder:K0,mathmlBuilder:Z0});_({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=t[1];return{type:"genfrac",mode:r.mode,continued:!0,numer:i,denom:a,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});_({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:r,token:n}=e,i;switch(r){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:i,token:n}}});var ka=["display","text","script","scriptscript"],Sa=function(t){var r=null;return t.length>0&&(r=t,r=r==="."?null:r),r};_({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:r}=e,n=t[4],i=t[5],a=en(t[0]),l=a.type==="atom"&&a.family==="open"?Sa(a.text):null,s=en(t[1]),o=s.type==="atom"&&s.family==="close"?Sa(s.text):null,u=re(t[2],"size"),h,m=null;u.isBlank?h=!0:(m=u.value,h=m.number>0);var d="auto",p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var y=re(p.body[0],"textord");d=ka[Number(y.text)]}}else p=re(p,"textord"),d=ka[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:h,barSize:m,leftDelim:l,rightDelim:o,size:d}},htmlBuilder:K0,mathmlBuilder:Z0});_({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:r,funcName:n,token:i}=e;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:re(t[0],"size").value,token:i}}});_({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=hf(re(t[1],"infix").size),l=t[2],s=a.number>0;return{type:"genfrac",mode:r.mode,numer:i,denom:l,continued:!1,hasBarLine:s,barSize:a,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:K0,mathmlBuilder:Z0});var Rs=(e,t)=>{var r=t.style,n,i;e.type==="supsub"?(n=e.sup?oe(e.sup,t.havingStyle(r.sup()),t):oe(e.sub,t.havingStyle(r.sub()),t),i=re(e.base,"horizBrace")):i=re(e,"horizBrace");var a=oe(i.base,t.havingBaseStyle(Q.DISPLAY)),l=wt.svgSpan(i,t),s;if(i.isOver?(s=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:l}]},t),s.children[0].children[0].children[1].classes.push("svg-align")):(s=C.makeVList({positionType:"bottom",positionData:a.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:a}]},t),s.children[0].children[0].children[0].classes.push("svg-align")),n){var o=C.makeSpan(["mord",i.isOver?"mover":"munder"],[s],t);i.isOver?s=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.2},{type:"elem",elem:n}]},t):s=C.makeVList({positionType:"bottom",positionData:o.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:o}]},t)}return C.makeSpan(["mord",i.isOver?"mover":"munder"],[s],t)},R2=(e,t)=>{var r=wt.mathMLnode(e.label);return new F.MathNode(e.isOver?"mover":"munder",[me(e.base,t),r])};_({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"horizBrace",mode:r.mode,label:n,isOver:/^\\over/.test(n),base:t[0]}},htmlBuilder:Rs,mathmlBuilder:R2});_({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[1],i=re(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:r.mode,href:i,body:we(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var r=ze(e.body,t,!1);return C.makeAnchor(e.href,[],r,t)},mathmlBuilder:(e,t)=>{var r=Dt(e.body,t);return r instanceof _e||(r=new _e("mrow",[r])),r.setAttribute("href",e.href),r}});_({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=re(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var i=[],a=0;a{var{parser:r,funcName:n,token:i}=e,a=re(t[0],"raw").string,l=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var s,o={};switch(n){case"\\htmlClass":o.class=a,s={command:"\\htmlClass",class:a};break;case"\\htmlId":o.id=a,s={command:"\\htmlId",id:a};break;case"\\htmlStyle":o.style=a,s={command:"\\htmlStyle",style:a};break;case"\\htmlData":{for(var u=a.split(","),h=0;h{var r=ze(e.body,t,!1),n=["enclosing"];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/));var i=C.makeSpan(n,r,t);for(var a in e.attributes)a!=="class"&&e.attributes.hasOwnProperty(a)&&i.setAttribute(a,e.attributes[a]);return i},mathmlBuilder:(e,t)=>Dt(e.body,t)});_({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"htmlmathml",mode:r.mode,html:we(t[0]),mathml:we(t[1])}},htmlBuilder:(e,t)=>{var r=ze(e.html,t,!1);return C.makeFragment(r)},mathmlBuilder:(e,t)=>Dt(e.mathml,t)});var Gn=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new L("Invalid size: '"+t+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!ts(n))throw new L("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};_({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,r)=>{var{parser:n}=e,i={number:0,unit:"em"},a={number:.9,unit:"em"},l={number:0,unit:"em"},s="";if(r[0])for(var o=re(r[0],"raw").string,u=o.split(","),h=0;h{var r=ye(e.height,t),n=0;e.totalheight.number>0&&(n=ye(e.totalheight,t)-r);var i=0;e.width.number>0&&(i=ye(e.width,t));var a={height:P(r+n)};i>0&&(a.width=P(i)),n>0&&(a.verticalAlign=P(-n));var l=new Rf(e.src,e.alt,a);return l.height=r,l.depth=n,l},mathmlBuilder:(e,t)=>{var r=new F.MathNode("mglyph",[]);r.setAttribute("alt",e.alt);var n=ye(e.height,t),i=0;if(e.totalheight.number>0&&(i=ye(e.totalheight,t)-n,r.setAttribute("valign",P(-i))),r.setAttribute("height",P(n+i)),e.width.number>0){var a=ye(e.width,t);r.setAttribute("width",P(a))}return r.setAttribute("src",e.src),r}});_({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=re(t[0],"size");if(r.settings.strict){var a=n[1]==="m",l=i.value.unit==="mu";a?(l||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):l&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:i.value}},htmlBuilder(e,t){return C.makeGlue(e.dimension,t)},mathmlBuilder(e,t){var r=ye(e.dimension,t);return new F.SpaceNode(r)}});_({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:i}},htmlBuilder:(e,t)=>{var r;e.alignment==="clap"?(r=C.makeSpan([],[oe(e.body,t)]),r=C.makeSpan(["inner"],[r],t)):r=C.makeSpan(["inner"],[oe(e.body,t)]);var n=C.makeSpan(["fix"],[]),i=C.makeSpan([e.alignment],[r,n],t),a=C.makeSpan(["strut"]);return a.style.height=P(i.height+i.depth),i.depth&&(a.style.verticalAlign=P(-i.depth)),i.children.unshift(a),i=C.makeSpan(["thinbox"],[i],t),C.makeSpan(["mord","vbox"],[i],t)},mathmlBuilder:(e,t)=>{var r=new F.MathNode("mpadded",[me(e.body,t)]);if(e.alignment!=="rlap"){var n=e.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});_({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:r,parser:n}=e,i=n.mode;n.switchMode("math");var a=r==="\\("?"\\)":"$",l=n.parseExpression(!1,a);return n.expect(a),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",body:l}}});_({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new L("Mismatched "+e.funcName)}});var Aa=(e,t)=>{switch(t.style.size){case Q.DISPLAY.size:return e.display;case Q.TEXT.size:return e.text;case Q.SCRIPT.size:return e.script;case Q.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};_({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"mathchoice",mode:r.mode,display:we(t[0]),text:we(t[1]),script:we(t[2]),scriptscript:we(t[3])}},htmlBuilder:(e,t)=>{var r=Aa(e,t),n=ze(r,t,!1);return C.makeFragment(n)},mathmlBuilder:(e,t)=>{var r=Aa(e,t);return Dt(r,t)}});var Ps=(e,t,r,n,i,a,l)=>{e=C.makeSpan([],[e]);var s=r&&ue.isCharacterBox(r),o,u;if(t){var h=oe(t,n.havingStyle(i.sup()),n);u={elem:h,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-h.depth)}}if(r){var m=oe(r,n.havingStyle(i.sub()),n);o={elem:m,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-m.height)}}var d;if(u&&o){var p=n.fontMetrics().bigOpSpacing5+o.elem.height+o.elem.depth+o.kern+e.depth+l;d=C.makeVList({positionType:"bottom",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:o.elem,marginLeft:P(-a)},{type:"kern",size:o.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:P(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(o){var y=e.height-l;d=C.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:o.elem,marginLeft:P(-a)},{type:"kern",size:o.kern},{type:"elem",elem:e}]},n)}else if(u){var w=e.depth+l;d=C.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:P(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else return e;var M=[d];if(o&&a!==0&&!s){var S=C.makeSpan(["mspace"],[],n);S.style.marginRight=P(a),M.unshift(S)}return C.makeSpan(["mop","op-limits"],M,n)},Os=["\\smallint"],nr=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=re(e.base,"op"),i=!0):a=re(e,"op");var l=t.style,s=!1;l.size===Q.DISPLAY.size&&a.symbol&&!Os.includes(a.name)&&(s=!0);var o;if(a.symbol){var u=s?"Size2-Regular":"Size1-Regular",h="";if((a.name==="\\oiint"||a.name==="\\oiiint")&&(h=a.name.slice(1),a.name=h==="oiint"?"\\iint":"\\iiint"),o=C.makeSymbol(a.name,u,"math",t,["mop","op-symbol",s?"large-op":"small-op"]),h.length>0){var m=o.italic,d=C.staticSvg(h+"Size"+(s?"2":"1"),t);o=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:d,shift:s?.08:0}]},t),a.name="\\"+h,o.classes.unshift("mop"),o.italic=m}}else if(a.body){var p=ze(a.body,t,!0);p.length===1&&p[0]instanceof Qe?(o=p[0],o.classes[0]="mop"):o=C.makeSpan(["mop"],p,t)}else{for(var y=[],w=1;w{var r;if(e.symbol)r=new _e("mo",[Je(e.name,e.mode)]),Os.includes(e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new _e("mo",Ve(e.body,t));else{r=new _e("mi",[new ot(e.name.slice(1))]);var n=new _e("mo",[Je("⁡","text")]);e.parentIsSupSub?r=new _e("mrow",[r,n]):r=ms([r,n])}return r},P2={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};_({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=n;return i.length===1&&(i=P2[i]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:nr,mathmlBuilder:Er});_({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:we(n)}},htmlBuilder:nr,mathmlBuilder:Er});var O2={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};_({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:nr,mathmlBuilder:Er});_({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:nr,mathmlBuilder:Er});_({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e,n=r;return n.length===1&&(n=O2[n]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:nr,mathmlBuilder:Er});var qs=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=re(e.base,"operatorname"),i=!0):a=re(e,"operatorname");var l;if(a.body.length>0){for(var s=a.body.map(m=>{var d=m.text;return typeof d=="string"?{type:"textord",mode:m.mode,text:d}:m}),o=ze(s,t.withFont("mathrm"),!0),u=0;u{for(var r=Ve(e.body,t.withFont("mathrm")),n=!0,i=0;ih.toText()).join("");r=[new F.TextNode(s)]}var o=new F.MathNode("mi",r);o.setAttribute("mathvariant","normal");var u=new F.MathNode("mo",[Je("⁡","text")]);return e.parentIsSupSub?new F.MathNode("mrow",[o,u]):F.newDocumentFragment([o,u])};_({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"operatorname",mode:r.mode,body:we(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:qs,mathmlBuilder:q2});v("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Vt({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?C.makeFragment(ze(e.body,t,!1)):C.makeSpan(["mord"],ze(e.body,t,!0),t)},mathmlBuilder(e,t){return Dt(e.body,t,!0)}});_({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:r}=e,n=t[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(e,t){var r=oe(e.body,t.havingCrampedStyle()),n=C.makeLineSpan("overline-line",t),i=t.fontMetrics().defaultRuleThickness,a=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]},t);return C.makeSpan(["mord","overline"],[a],t)},mathmlBuilder(e,t){var r=new F.MathNode("mo",[new F.TextNode("‾")]);r.setAttribute("stretchy","true");var n=new F.MathNode("mover",[me(e.body,t),r]);return n.setAttribute("accent","true"),n}});_({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"phantom",mode:r.mode,body:we(n)}},htmlBuilder:(e,t)=>{var r=ze(e.body,t.withPhantom(),!1);return C.makeFragment(r)},mathmlBuilder:(e,t)=>{var r=Ve(e.body,t);return new F.MathNode("mphantom",r)}});_({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"hphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>{var r=C.makeSpan([],[oe(e.body,t.withPhantom())]);if(r.height=0,r.depth=0,r.children)for(var n=0;n{var r=Ve(we(e.body),t),n=new F.MathNode("mphantom",r),i=new F.MathNode("mpadded",[n]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});_({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>{var r=C.makeSpan(["inner"],[oe(e.body,t.withPhantom())]),n=C.makeSpan(["fix"],[]);return C.makeSpan(["mord","rlap"],[r,n],t)},mathmlBuilder:(e,t)=>{var r=Ve(we(e.body),t),n=new F.MathNode("mphantom",r),i=new F.MathNode("mpadded",[n]);return i.setAttribute("width","0px"),i}});_({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e,n=re(t[0],"size").value,i=t[1];return{type:"raisebox",mode:r.mode,dy:n,body:i}},htmlBuilder(e,t){var r=oe(e.body,t),n=ye(e.dy,t);return C.makeVList({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]},t)},mathmlBuilder(e,t){var r=new F.MathNode("mpadded",[me(e.body,t)]),n=e.dy.number+e.dy.unit;return r.setAttribute("voffset",n),r}});_({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});_({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,r){var{parser:n}=e,i=r[0],a=re(t[0],"size"),l=re(t[1],"size");return{type:"rule",mode:n.mode,shift:i&&re(i,"size").value,width:a.value,height:l.value}},htmlBuilder(e,t){var r=C.makeSpan(["mord","rule"],[],t),n=ye(e.width,t),i=ye(e.height,t),a=e.shift?ye(e.shift,t):0;return r.style.borderRightWidth=P(n),r.style.borderTopWidth=P(i),r.style.bottom=P(a),r.width=n,r.height=i+a,r.depth=-a,r.maxFontSize=i*1.125*t.sizeMultiplier,r},mathmlBuilder(e,t){var r=ye(e.width,t),n=ye(e.height,t),i=e.shift?ye(e.shift,t):0,a=t.color&&t.getColor()||"black",l=new F.MathNode("mspace");l.setAttribute("mathbackground",a),l.setAttribute("width",P(r)),l.setAttribute("height",P(n));var s=new F.MathNode("mpadded",[l]);return i>=0?s.setAttribute("height",P(i)):(s.setAttribute("height",P(i)),s.setAttribute("depth",P(-i))),s.setAttribute("voffset",P(i)),s}});function Hs(e,t,r){for(var n=ze(e,t,!1),i=t.sizeMultiplier/r.sizeMultiplier,a=0;a{var r=t.havingSize(e.size);return Hs(e.body,r,t)};_({type:"sizing",names:Ta,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!1,r);return{type:"sizing",mode:i.mode,size:Ta.indexOf(n)+1,body:a}},htmlBuilder:H2,mathmlBuilder:(e,t)=>{var r=t.havingSize(e.size),n=Ve(e.body,r),i=new F.MathNode("mstyle",n);return i.setAttribute("mathsize",P(r.sizeMultiplier)),i}});_({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,r)=>{var{parser:n}=e,i=!1,a=!1,l=r[0]&&re(r[0],"ordgroup");if(l)for(var s="",o=0;o{var r=C.makeSpan([],[oe(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0,r.children))for(var n=0;n{var r=new F.MathNode("mpadded",[me(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});_({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n}=e,i=r[0],a=t[0];return{type:"sqrt",mode:n.mode,body:a,index:i}},htmlBuilder(e,t){var r=oe(e.body,t.havingCrampedStyle());r.height===0&&(r.height=t.fontMetrics().xHeight),r=C.wrapFragment(r,t);var n=t.fontMetrics(),i=n.defaultRuleThickness,a=i;t.style.idr.height+r.depth+l&&(l=(l+m-r.height-r.depth)/2);var d=o.height-r.height-l-u;r.style.paddingLeft=P(h);var p=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+d)},{type:"elem",elem:o},{type:"kern",size:u}]},t);if(e.index){var y=t.havingStyle(Q.SCRIPTSCRIPT),w=oe(e.index,y,t),M=.6*(p.height-p.depth),S=C.makeVList({positionType:"shift",positionData:-M,children:[{type:"elem",elem:w}]},t),z=C.makeSpan(["root"],[S]);return C.makeSpan(["mord","sqrt"],[z,p],t)}else return C.makeSpan(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:r,index:n}=e;return n?new F.MathNode("mroot",[me(r,t),me(n,t)]):new F.MathNode("msqrt",[me(r,t)])}});var za={display:Q.DISPLAY,text:Q.TEXT,script:Q.SCRIPT,scriptscript:Q.SCRIPTSCRIPT};_({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!0,r),l=n.slice(1,n.length-5);return{type:"styling",mode:i.mode,style:l,body:a}},htmlBuilder(e,t){var r=za[e.style],n=t.havingStyle(r).withFont("");return Hs(e.body,n,t)},mathmlBuilder(e,t){var r=za[e.style],n=t.havingStyle(r),i=Ve(e.body,n),a=new F.MathNode("mstyle",i),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},s=l[e.style];return a.setAttribute("scriptlevel",s[0]),a.setAttribute("displaystyle",s[1]),a}});var V2=function(t,r){var n=t.base;if(n)if(n.type==="op"){var i=n.limits&&(r.style.size===Q.DISPLAY.size||n.alwaysHandleSupSub);return i?nr:null}else if(n.type==="operatorname"){var a=n.alwaysHandleSupSub&&(r.style.size===Q.DISPLAY.size||n.limits);return a?qs:null}else{if(n.type==="accent")return ue.isCharacterBox(n.base)?U0:null;if(n.type==="horizBrace"){var l=!t.sub;return l===n.isOver?Rs:null}else return null}else return null};Vt({type:"supsub",htmlBuilder(e,t){var r=V2(e,t);if(r)return r(e,t);var{base:n,sup:i,sub:a}=e,l=oe(n,t),s,o,u=t.fontMetrics(),h=0,m=0,d=n&&ue.isCharacterBox(n);if(i){var p=t.havingStyle(t.style.sup());s=oe(i,p,t),d||(h=l.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(a){var y=t.havingStyle(t.style.sub());o=oe(a,y,t),d||(m=l.depth+y.fontMetrics().subDrop*y.sizeMultiplier/t.sizeMultiplier)}var w;t.style===Q.DISPLAY?w=u.sup1:t.style.cramped?w=u.sup3:w=u.sup2;var M=t.sizeMultiplier,S=P(.5/u.ptPerEm/M),z=null;if(o){var I=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");(l instanceof Qe||I)&&(z=P(-l.italic))}var V;if(s&&o){h=Math.max(h,w,s.depth+.25*u.xHeight),m=Math.max(m,u.sub2);var O=u.defaultRuleThickness,E=4*O;if(h-s.depth-(o.height-m)0&&(h+=G,m-=G)}var K=[{type:"elem",elem:o,shift:m,marginRight:S,marginLeft:z},{type:"elem",elem:s,shift:-h,marginRight:S}];V=C.makeVList({positionType:"individualShift",children:K},t)}else if(o){m=Math.max(m,u.sub1,o.height-.8*u.xHeight);var U=[{type:"elem",elem:o,marginLeft:z,marginRight:S}];V=C.makeVList({positionType:"shift",positionData:m,children:U},t)}else if(s)h=Math.max(h,w,s.depth+.25*u.xHeight),V=C.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:s,marginRight:S}]},t);else throw new Error("supsub must have either sup or sub.");var D=m0(l,"right")||"mord";return C.makeSpan([D],[l,C.makeSpan(["msupsub"],[V])],t)},mathmlBuilder(e,t){var r=!1,n,i;e.base&&e.base.type==="horizBrace"&&(i=!!e.sup,i===e.base.isOver&&(r=!0,n=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var a=[me(e.base,t)];e.sub&&a.push(me(e.sub,t)),e.sup&&a.push(me(e.sup,t));var l;if(r)l=n?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===Q.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===Q.DISPLAY||u.limits)?l="munderover":l="msubsup"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(t.style===Q.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||t.style===Q.DISPLAY)?l="munder":l="msub"}else{var s=e.base;s&&s.type==="op"&&s.limits&&(t.style===Q.DISPLAY||s.alwaysHandleSupSub)||s&&s.type==="operatorname"&&s.alwaysHandleSupSub&&(s.limits||t.style===Q.DISPLAY)?l="mover":l="msup"}return new F.MathNode(l,a)}});Vt({type:"atom",htmlBuilder(e,t){return C.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var r=new F.MathNode("mo",[Je(e.text,e.mode)]);if(e.family==="bin"){var n=j0(e,t);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else e.family==="punct"?r.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&r.setAttribute("stretchy","false");return r}});var Vs={mi:"italic",mn:"normal",mtext:"normal"};Vt({type:"mathord",htmlBuilder(e,t){return C.makeOrd(e,t,"mathord")},mathmlBuilder(e,t){var r=new F.MathNode("mi",[Je(e.text,e.mode,t)]),n=j0(e,t)||"italic";return n!==Vs[r.type]&&r.setAttribute("mathvariant",n),r}});Vt({type:"textord",htmlBuilder(e,t){return C.makeOrd(e,t,"textord")},mathmlBuilder(e,t){var r=Je(e.text,e.mode,t),n=j0(e,t)||"normal",i;return e.mode==="text"?i=new F.MathNode("mtext",[r]):/[0-9]/.test(e.text)?i=new F.MathNode("mn",[r]):e.text==="\\prime"?i=new F.MathNode("mo",[r]):i=new F.MathNode("mi",[r]),n!==Vs[i.type]&&i.setAttribute("mathvariant",n),i}});var Wn={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Yn={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Vt({type:"spacing",htmlBuilder(e,t){if(Yn.hasOwnProperty(e.text)){var r=Yn[e.text].className||"";if(e.mode==="text"){var n=C.makeOrd(e,t,"textord");return n.classes.push(r),n}else return C.makeSpan(["mspace",r],[C.mathsym(e.text,e.mode,t)],t)}else{if(Wn.hasOwnProperty(e.text))return C.makeSpan(["mspace",Wn[e.text]],[],t);throw new L('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var r;if(Yn.hasOwnProperty(e.text))r=new F.MathNode("mtext",[new F.TextNode(" ")]);else{if(Wn.hasOwnProperty(e.text))return new F.MathNode("mspace");throw new L('Unknown type of space "'+e.text+'"')}return r}});var Ma=()=>{var e=new F.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Vt({type:"tag",mathmlBuilder(e,t){var r=new F.MathNode("mtable",[new F.MathNode("mtr",[Ma(),new F.MathNode("mtd",[Dt(e.body,t)]),Ma(),new F.MathNode("mtd",[Dt(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});var Ca={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Ea={"\\textbf":"textbf","\\textmd":"textmd"},j2={"\\textit":"textit","\\textup":"textup"},Da=(e,t)=>{var r=e.font;if(r){if(Ca[r])return t.withTextFontFamily(Ca[r]);if(Ea[r])return t.withTextFontWeight(Ea[r]);if(r==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(j2[r])};_({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"text",mode:r.mode,body:we(i),font:n}},htmlBuilder(e,t){var r=Da(e,t),n=ze(e.body,r,!0);return C.makeSpan(["mord","text"],n,r)},mathmlBuilder(e,t){var r=Da(e,t);return Dt(e.body,r)}});_({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"underline",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=oe(e.body,t),n=C.makeLineSpan("underline-line",t),i=t.fontMetrics().defaultRuleThickness,a=C.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r}]},t);return C.makeSpan(["mord","underline"],[a],t)},mathmlBuilder(e,t){var r=new F.MathNode("mo",[new F.TextNode("‾")]);r.setAttribute("stretchy","true");var n=new F.MathNode("munder",[me(e.body,t),r]);return n.setAttribute("accentunder","true"),n}});_({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"vcenter",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=oe(e.body,t),n=t.fontMetrics().axisHeight,i=.5*(r.height-n-(r.depth+n));return C.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:r}]},t)},mathmlBuilder(e,t){return new F.MathNode("mpadded",[me(e.body,t)],["vcenter"])}});_({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,r){throw new L("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var r=Ia(e),n=[],i=t.havingStyle(t.style.text()),a=0;ae.body.replace(/ /g,e.star?"␣":" "),Mt=cs,js=`[ \r + ]`,$2="\\\\[a-zA-Z@]+",U2="\\\\[^\uD800-\uDFFF]",_2="("+$2+")"+js+"*",G2=`\\\\( |[ \r ]+ -?)[ \r ]*`,p0="[̀-ͯ]",v2=new RegExp(p0+"+$"),y2="("+Ls+"+)|"+(g2+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(p0+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(p0+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+d2)+("|"+p2+")");class Aa{constructor(t,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=r,this.tokenRegex=new RegExp(y2,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){var t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new We("EOF",new qe(this,r,r));var n=this.tokenRegex.exec(t);if(n===null||n.index!==r)throw new L("Unexpected character: '"+t[r]+"'",new We(t[r],new qe(this,r,r+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var a=t.indexOf(` -`,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new We(i,new qe(this,r,this.tokenRegex.lastIndex))}}class b2{constructor(t,r){t===void 0&&(t={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new L("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var r in t)t.hasOwnProperty(r)&&(t[r]==null?delete this.current[r]:this.current[r]=t[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,n){if(n===void 0&&(n=!1),n){for(var i=0;i0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}}var x2=As;v("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});v("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});v("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});v("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});v("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});v("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");v("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var Ta={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};v("\\char",function(e){var t=e.popToken(),r,n="";if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")n=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new L("\\char` missing argument");n=t.text.charCodeAt(0)}else r=10;if(r){if(n=Ta[t.text],n==null||n>=r)throw new L("Invalid base-"+r+" digit "+t.text);for(var i;(i=Ta[e.future().text])!=null&&i{var i=e.consumeArg().tokens;if(i.length!==1)throw new L("\\newcommand's first argument must be a macro name");var a=i[0].text,l=e.isDefined(a);if(l&&!t)throw new L("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!l&&!r)throw new L("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var s=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var o="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)o+=u.text,u=e.expandNextToken();if(!o.match(/^\s*[0-9]+\s*$/))throw new L("Invalid number of arguments: "+o);s=parseInt(o),i=e.consumeArg().tokens}return l&&n||e.macros.set(a,{tokens:i,numArgs:s}),""};v("\\newcommand",e=>Z0(e,!1,!0,!1));v("\\renewcommand",e=>Z0(e,!0,!1,!1));v("\\providecommand",e=>Z0(e,!0,!0,!0));v("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});v("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});v("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),Mt[r],de.math[r],de.text[r]),""});v("\\bgroup","{");v("\\egroup","}");v("~","\\nobreakspace");v("\\lq","`");v("\\rq","'");v("\\aa","\\r a");v("\\AA","\\r A");v("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");v("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");v("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");v("ℬ","\\mathscr{B}");v("ℰ","\\mathscr{E}");v("ℱ","\\mathscr{F}");v("ℋ","\\mathscr{H}");v("ℐ","\\mathscr{I}");v("ℒ","\\mathscr{L}");v("ℳ","\\mathscr{M}");v("ℛ","\\mathscr{R}");v("ℭ","\\mathfrak{C}");v("ℌ","\\mathfrak{H}");v("ℨ","\\mathfrak{Z}");v("\\Bbbk","\\Bbb{k}");v("·","\\cdotp");v("\\llap","\\mathllap{\\textrm{#1}}");v("\\rlap","\\mathrlap{\\textrm{#1}}");v("\\clap","\\mathclap{\\textrm{#1}}");v("\\mathstrut","\\vphantom{(}");v("\\underbar","\\underline{\\text{#1}}");v("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');v("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");v("\\ne","\\neq");v("≠","\\neq");v("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");v("∉","\\notin");v("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");v("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");v("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");v("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");v("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");v("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");v("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");v("⟂","\\perp");v("‼","\\mathclose{!\\mkern-0.8mu!}");v("∌","\\notni");v("⌜","\\ulcorner");v("⌝","\\urcorner");v("⌞","\\llcorner");v("⌟","\\lrcorner");v("©","\\copyright");v("®","\\textregistered");v("️","\\textregistered");v("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');v("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');v("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');v("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');v("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");v("⋮","\\vdots");v("\\varGamma","\\mathit{\\Gamma}");v("\\varDelta","\\mathit{\\Delta}");v("\\varTheta","\\mathit{\\Theta}");v("\\varLambda","\\mathit{\\Lambda}");v("\\varXi","\\mathit{\\Xi}");v("\\varPi","\\mathit{\\Pi}");v("\\varSigma","\\mathit{\\Sigma}");v("\\varUpsilon","\\mathit{\\Upsilon}");v("\\varPhi","\\mathit{\\Phi}");v("\\varPsi","\\mathit{\\Psi}");v("\\varOmega","\\mathit{\\Omega}");v("\\substack","\\begin{subarray}{c}#1\\end{subarray}");v("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");v("\\boxed","\\fbox{$\\displaystyle{#1}$}");v("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");v("\\implies","\\DOTSB\\;\\Longrightarrow\\;");v("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");v("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");v("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var za={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};v("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in za?t=za[r]:(r.slice(0,4)==="\\not"||r in de.math&&["bin","rel"].includes(de.math[r].group))&&(t="\\dotsb"),t});var Q0={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};v("\\dotso",function(e){var t=e.future().text;return t in Q0?"\\ldots\\,":"\\ldots"});v("\\dotsc",function(e){var t=e.future().text;return t in Q0&&t!==","?"\\ldots\\,":"\\ldots"});v("\\cdots",function(e){var t=e.future().text;return t in Q0?"\\@cdots\\,":"\\@cdots"});v("\\dotsb","\\cdots");v("\\dotsm","\\cdots");v("\\dotsi","\\!\\cdots");v("\\dotsx","\\ldots\\,");v("\\DOTSI","\\relax");v("\\DOTSB","\\relax");v("\\DOTSX","\\relax");v("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");v("\\,","\\tmspace+{3mu}{.1667em}");v("\\thinspace","\\,");v("\\>","\\mskip{4mu}");v("\\:","\\tmspace+{4mu}{.2222em}");v("\\medspace","\\:");v("\\;","\\tmspace+{5mu}{.2777em}");v("\\thickspace","\\;");v("\\!","\\tmspace-{3mu}{.1667em}");v("\\negthinspace","\\!");v("\\negmedspace","\\tmspace-{4mu}{.2222em}");v("\\negthickspace","\\tmspace-{5mu}{.277em}");v("\\enspace","\\kern.5em ");v("\\enskip","\\hskip.5em\\relax");v("\\quad","\\hskip1em\\relax");v("\\qquad","\\hskip2em\\relax");v("\\tag","\\@ifstar\\tag@literal\\tag@paren");v("\\tag@paren","\\tag@literal{({#1})}");v("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new L("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});v("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");v("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");v("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");v("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");v("\\newline","\\\\\\relax");v("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Rs=P(st["Main-Regular"][84][1]-.7*st["Main-Regular"][65][1]);v("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Rs+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");v("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Rs+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");v("\\hspace","\\@ifstar\\@hspacer\\@hspace");v("\\@hspace","\\hskip #1\\relax");v("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");v("\\ordinarycolon",":");v("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");v("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');v("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');v("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');v("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');v("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');v("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');v("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');v("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');v("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');v("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');v("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');v("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');v("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');v("∷","\\dblcolon");v("∹","\\eqcolon");v("≔","\\coloneqq");v("≕","\\eqqcolon");v("⩴","\\Coloneqq");v("\\ratio","\\vcentcolon");v("\\coloncolon","\\dblcolon");v("\\colonequals","\\coloneqq");v("\\coloncolonequals","\\Coloneqq");v("\\equalscolon","\\eqqcolon");v("\\equalscoloncolon","\\Eqqcolon");v("\\colonminus","\\coloneq");v("\\coloncolonminus","\\Coloneq");v("\\minuscolon","\\eqcolon");v("\\minuscoloncolon","\\Eqcolon");v("\\coloncolonapprox","\\Colonapprox");v("\\coloncolonsim","\\Colonsim");v("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");v("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");v("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");v("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");v("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");v("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");v("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");v("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");v("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");v("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");v("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");v("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");v("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");v("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");v("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");v("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");v("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");v("\\nleqq","\\html@mathml{\\@nleqq}{≰}");v("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");v("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");v("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");v("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");v("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");v("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");v("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");v("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");v("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");v("\\imath","\\html@mathml{\\@imath}{ı}");v("\\jmath","\\html@mathml{\\@jmath}{ȷ}");v("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");v("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");v("⟦","\\llbracket");v("⟧","\\rrbracket");v("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");v("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");v("⦃","\\lBrace");v("⦄","\\rBrace");v("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");v("⦵","\\minuso");v("\\darr","\\downarrow");v("\\dArr","\\Downarrow");v("\\Darr","\\Downarrow");v("\\lang","\\langle");v("\\rang","\\rangle");v("\\uarr","\\uparrow");v("\\uArr","\\Uparrow");v("\\Uarr","\\Uparrow");v("\\N","\\mathbb{N}");v("\\R","\\mathbb{R}");v("\\Z","\\mathbb{Z}");v("\\alef","\\aleph");v("\\alefsym","\\aleph");v("\\Alpha","\\mathrm{A}");v("\\Beta","\\mathrm{B}");v("\\bull","\\bullet");v("\\Chi","\\mathrm{X}");v("\\clubs","\\clubsuit");v("\\cnums","\\mathbb{C}");v("\\Complex","\\mathbb{C}");v("\\Dagger","\\ddagger");v("\\diamonds","\\diamondsuit");v("\\empty","\\emptyset");v("\\Epsilon","\\mathrm{E}");v("\\Eta","\\mathrm{H}");v("\\exist","\\exists");v("\\harr","\\leftrightarrow");v("\\hArr","\\Leftrightarrow");v("\\Harr","\\Leftrightarrow");v("\\hearts","\\heartsuit");v("\\image","\\Im");v("\\infin","\\infty");v("\\Iota","\\mathrm{I}");v("\\isin","\\in");v("\\Kappa","\\mathrm{K}");v("\\larr","\\leftarrow");v("\\lArr","\\Leftarrow");v("\\Larr","\\Leftarrow");v("\\lrarr","\\leftrightarrow");v("\\lrArr","\\Leftrightarrow");v("\\Lrarr","\\Leftrightarrow");v("\\Mu","\\mathrm{M}");v("\\natnums","\\mathbb{N}");v("\\Nu","\\mathrm{N}");v("\\Omicron","\\mathrm{O}");v("\\plusmn","\\pm");v("\\rarr","\\rightarrow");v("\\rArr","\\Rightarrow");v("\\Rarr","\\Rightarrow");v("\\real","\\Re");v("\\reals","\\mathbb{R}");v("\\Reals","\\mathbb{R}");v("\\Rho","\\mathrm{P}");v("\\sdot","\\cdot");v("\\sect","\\S");v("\\spades","\\spadesuit");v("\\sub","\\subset");v("\\sube","\\subseteq");v("\\supe","\\supseteq");v("\\Tau","\\mathrm{T}");v("\\thetasym","\\vartheta");v("\\weierp","\\wp");v("\\Zeta","\\mathrm{Z}");v("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");v("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");v("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");v("\\bra","\\mathinner{\\langle{#1}|}");v("\\ket","\\mathinner{|{#1}\\rangle}");v("\\braket","\\mathinner{\\langle{#1}\\rangle}");v("\\Bra","\\left\\langle#1\\right|");v("\\Ket","\\left|#1\\right\\rangle");var Ps=e=>t=>{var r=t.consumeArg().tokens,n=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,l=t.macros.get("|"),s=t.macros.get("\\|");t.macros.beginGroup();var o=m=>d=>{e&&(d.macros.set("|",l),i.length&&d.macros.set("\\|",s));var p=m;if(!m&&i.length){var y=d.future();y.text==="|"&&(d.popToken(),p=!0)}return{tokens:p?i:n,numArgs:0}};t.macros.set("|",o(!1)),i.length&&t.macros.set("\\|",o(!0));var u=t.consumeArg().tokens,h=t.expandTokens([...a,...u,...r]);return t.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};v("\\bra@ket",Ps(!1));v("\\bra@set",Ps(!0));v("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");v("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");v("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");v("\\angln","{\\angl n}");v("\\blue","\\textcolor{##6495ed}{#1}");v("\\orange","\\textcolor{##ffa500}{#1}");v("\\pink","\\textcolor{##ff00af}{#1}");v("\\red","\\textcolor{##df0030}{#1}");v("\\green","\\textcolor{##28ae7b}{#1}");v("\\gray","\\textcolor{gray}{#1}");v("\\purple","\\textcolor{##9d38bd}{#1}");v("\\blueA","\\textcolor{##ccfaff}{#1}");v("\\blueB","\\textcolor{##80f6ff}{#1}");v("\\blueC","\\textcolor{##63d9ea}{#1}");v("\\blueD","\\textcolor{##11accd}{#1}");v("\\blueE","\\textcolor{##0c7f99}{#1}");v("\\tealA","\\textcolor{##94fff5}{#1}");v("\\tealB","\\textcolor{##26edd5}{#1}");v("\\tealC","\\textcolor{##01d1c1}{#1}");v("\\tealD","\\textcolor{##01a995}{#1}");v("\\tealE","\\textcolor{##208170}{#1}");v("\\greenA","\\textcolor{##b6ffb0}{#1}");v("\\greenB","\\textcolor{##8af281}{#1}");v("\\greenC","\\textcolor{##74cf70}{#1}");v("\\greenD","\\textcolor{##1fab54}{#1}");v("\\greenE","\\textcolor{##0d923f}{#1}");v("\\goldA","\\textcolor{##ffd0a9}{#1}");v("\\goldB","\\textcolor{##ffbb71}{#1}");v("\\goldC","\\textcolor{##ff9c39}{#1}");v("\\goldD","\\textcolor{##e07d10}{#1}");v("\\goldE","\\textcolor{##a75a05}{#1}");v("\\redA","\\textcolor{##fca9a9}{#1}");v("\\redB","\\textcolor{##ff8482}{#1}");v("\\redC","\\textcolor{##f9685d}{#1}");v("\\redD","\\textcolor{##e84d39}{#1}");v("\\redE","\\textcolor{##bc2612}{#1}");v("\\maroonA","\\textcolor{##ffbde0}{#1}");v("\\maroonB","\\textcolor{##ff92c6}{#1}");v("\\maroonC","\\textcolor{##ed5fa6}{#1}");v("\\maroonD","\\textcolor{##ca337c}{#1}");v("\\maroonE","\\textcolor{##9e034e}{#1}");v("\\purpleA","\\textcolor{##ddd7ff}{#1}");v("\\purpleB","\\textcolor{##c6b9fc}{#1}");v("\\purpleC","\\textcolor{##aa87ff}{#1}");v("\\purpleD","\\textcolor{##7854ab}{#1}");v("\\purpleE","\\textcolor{##543b78}{#1}");v("\\mintA","\\textcolor{##f5f9e8}{#1}");v("\\mintB","\\textcolor{##edf2df}{#1}");v("\\mintC","\\textcolor{##e0e5cc}{#1}");v("\\grayA","\\textcolor{##f6f7f7}{#1}");v("\\grayB","\\textcolor{##f0f1f2}{#1}");v("\\grayC","\\textcolor{##e3e5e6}{#1}");v("\\grayD","\\textcolor{##d6d8da}{#1}");v("\\grayE","\\textcolor{##babec2}{#1}");v("\\grayF","\\textcolor{##888d93}{#1}");v("\\grayG","\\textcolor{##626569}{#1}");v("\\grayH","\\textcolor{##3b3e40}{#1}");v("\\grayI","\\textcolor{##21242c}{#1}");v("\\kaBlue","\\textcolor{##314453}{#1}");v("\\kaGreen","\\textcolor{##71B307}{#1}");var Os={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class w2{constructor(t,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new b2(x2,r.macros),this.mode=n,this.stack=[]}feed(t){this.lexer=new Aa(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,n,i;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:r,end:n}=this.consumeArg());return this.pushToken(new We("EOF",n.loc)),this.pushTokens(i),new We("",qe.range(r,n))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],n=t&&t.length>0;n||this.consumeSpaces();var i=this.future(),a,l=0,s=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++l;else if(a.text==="}"){if(--l,l===-1)throw new L("Extra }",a)}else if(a.text==="EOF")throw new L("Unexpected end of input in a macro argument, expected '"+(t&&n?t[s]:"}")+"'",a);if(t&&n)if((l===0||l===1&&t[s]==="{")&&a.text===t[s]){if(++s,s===t.length){r.splice(-s,s);break}}else s=0}while(l!==0||n);return i.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:i,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new L("The length of delimiters doesn't match the number of args!");for(var n=r[0],i=0;ithis.settings.maxExpand)throw new L("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),n=r.text,i=r.noexpand?null:this._getExpansion(n);if(i==null||t&&i.unexpandable){if(t&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new L("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var a=i.tokens,l=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var s=a.length-1;s>=0;--s){var o=a[s];if(o.text==="#"){if(s===0)throw new L("Incomplete placeholder at end of macro body",o);if(o=a[--s],o.text==="#")a.splice(s+1,1);else if(/^[1-9]$/.test(o.text))a.splice(s,2,...l[+o.text-1]);else throw new L("Not a valid argument number",o)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new We(t)]):void 0}expandTokens(t){var r=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),r.push(i)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(n=>n.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var n=this.lexer.catcodes[t];if(n!=null&&n!==13)return}var i=typeof r=="function"?r(this):r;if(typeof i=="string"){var a=0;if(i.indexOf("#")!==-1)for(var l=i.replace(/##/g,"");l.indexOf("#"+(a+1))!==-1;)++a;for(var s=new Aa(i,this.settings),o=[],u=s.lex();u.text!=="EOF";)o.push(u),u=s.lex();o.reverse();var h={tokens:o,numArgs:a};return h}return i}isDefined(t){return this.macros.has(t)||Mt.hasOwnProperty(t)||de.math.hasOwnProperty(t)||de.text.hasOwnProperty(t)||Os.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Mt.hasOwnProperty(t)&&!Mt[t].primitive}}var Ma=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,jr=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Yn={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Ca={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class fn{constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new w2(t,r,this.mode),this.settings=r,this.leftrightDepth=0}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new L("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new We("}")),this.gullet.pushTokens(t);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(t,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(fn.endOfExpression.indexOf(i.text)!==-1||r&&i.text===r||t&&Mt[i.text]&&Mt[i.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;n.push(a)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){for(var r=-1,n,i=0;i=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',t);var s=de[this.mode][r].group,o=qe.range(t),u;if(uf.hasOwnProperty(s)){var h=s;u={type:"atom",mode:this.mode,family:h,loc:o,text:r}}else u={type:s,mode:this.mode,loc:o,text:r};l=u}else if(r.charCodeAt(0)>=128)this.settings.strict&&(Wl(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),l={type:"textord",mode:"text",loc:qe.range(t),text:r};else return null;if(this.consume(),a)for(var m=0;mu&&(u=h):h&&(u!==void 0&&u>-1&&o.push(` -`.repeat(u)||" "),u=-1,o.push(h))}return o.join("")}function _s(e,t,r){return e.type==="element"?Z2(e,t,r):e.type==="text"?r.whitespace==="normal"?Gs(e,r):Q2(e):[]}function Z2(e,t,r){const n=Ws(e,r),i=e.children||[];let a=-1,l=[];if(X2(e))return l;let s,o;for(g0(e)||Pa(e)&&Na(t,e,Pa)?o=` -`:Y2(e)?(s=2,o=2):Us(e)&&(s=1,o=1);++a0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,n){if(n===void 0&&(n=!1),n){for(var i=0;i0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}}var K2=Is;v("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});v("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});v("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});v("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});v("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});v("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");v("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var Na={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};v("\\char",function(e){var t=e.popToken(),r,n="";if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")n=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new L("\\char` missing argument");n=t.text.charCodeAt(0)}else r=10;if(r){if(n=Na[t.text],n==null||n>=r)throw new L("Invalid base-"+r+" digit "+t.text);for(var i;(i=Na[e.future().text])!=null&&i{var i=e.consumeArg().tokens;if(i.length!==1)throw new L("\\newcommand's first argument must be a macro name");var a=i[0].text,l=e.isDefined(a);if(l&&!t)throw new L("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!l&&!r)throw new L("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var s=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var o="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)o+=u.text,u=e.expandNextToken();if(!o.match(/^\s*[0-9]+\s*$/))throw new L("Invalid number of arguments: "+o);s=parseInt(o),i=e.consumeArg().tokens}return l&&n||e.macros.set(a,{tokens:i,numArgs:s}),""};v("\\newcommand",e=>Q0(e,!1,!0,!1));v("\\renewcommand",e=>Q0(e,!0,!1,!1));v("\\providecommand",e=>Q0(e,!0,!0,!0));v("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});v("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});v("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),Mt[r],de.math[r],de.text[r]),""});v("\\bgroup","{");v("\\egroup","}");v("~","\\nobreakspace");v("\\lq","`");v("\\rq","'");v("\\aa","\\r a");v("\\AA","\\r A");v("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");v("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");v("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");v("ℬ","\\mathscr{B}");v("ℰ","\\mathscr{E}");v("ℱ","\\mathscr{F}");v("ℋ","\\mathscr{H}");v("ℐ","\\mathscr{I}");v("ℒ","\\mathscr{L}");v("ℳ","\\mathscr{M}");v("ℛ","\\mathscr{R}");v("ℭ","\\mathfrak{C}");v("ℌ","\\mathfrak{H}");v("ℨ","\\mathfrak{Z}");v("\\Bbbk","\\Bbb{k}");v("·","\\cdotp");v("\\llap","\\mathllap{\\textrm{#1}}");v("\\rlap","\\mathrlap{\\textrm{#1}}");v("\\clap","\\mathclap{\\textrm{#1}}");v("\\mathstrut","\\vphantom{(}");v("\\underbar","\\underline{\\text{#1}}");v("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');v("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");v("\\ne","\\neq");v("≠","\\neq");v("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");v("∉","\\notin");v("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");v("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");v("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");v("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");v("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");v("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");v("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");v("⟂","\\perp");v("‼","\\mathclose{!\\mkern-0.8mu!}");v("∌","\\notni");v("⌜","\\ulcorner");v("⌝","\\urcorner");v("⌞","\\llcorner");v("⌟","\\lrcorner");v("©","\\copyright");v("®","\\textregistered");v("️","\\textregistered");v("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');v("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');v("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');v("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');v("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");v("⋮","\\vdots");v("\\varGamma","\\mathit{\\Gamma}");v("\\varDelta","\\mathit{\\Delta}");v("\\varTheta","\\mathit{\\Theta}");v("\\varLambda","\\mathit{\\Lambda}");v("\\varXi","\\mathit{\\Xi}");v("\\varPi","\\mathit{\\Pi}");v("\\varSigma","\\mathit{\\Sigma}");v("\\varUpsilon","\\mathit{\\Upsilon}");v("\\varPhi","\\mathit{\\Phi}");v("\\varPsi","\\mathit{\\Psi}");v("\\varOmega","\\mathit{\\Omega}");v("\\substack","\\begin{subarray}{c}#1\\end{subarray}");v("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");v("\\boxed","\\fbox{$\\displaystyle{#1}$}");v("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");v("\\implies","\\DOTSB\\;\\Longrightarrow\\;");v("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");v("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");v("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Fa={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};v("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in Fa?t=Fa[r]:(r.slice(0,4)==="\\not"||r in de.math&&["bin","rel"].includes(de.math[r].group))&&(t="\\dotsb"),t});var J0={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};v("\\dotso",function(e){var t=e.future().text;return t in J0?"\\ldots\\,":"\\ldots"});v("\\dotsc",function(e){var t=e.future().text;return t in J0&&t!==","?"\\ldots\\,":"\\ldots"});v("\\cdots",function(e){var t=e.future().text;return t in J0?"\\@cdots\\,":"\\@cdots"});v("\\dotsb","\\cdots");v("\\dotsm","\\cdots");v("\\dotsi","\\!\\cdots");v("\\dotsx","\\ldots\\,");v("\\DOTSI","\\relax");v("\\DOTSB","\\relax");v("\\DOTSX","\\relax");v("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");v("\\,","\\tmspace+{3mu}{.1667em}");v("\\thinspace","\\,");v("\\>","\\mskip{4mu}");v("\\:","\\tmspace+{4mu}{.2222em}");v("\\medspace","\\:");v("\\;","\\tmspace+{5mu}{.2777em}");v("\\thickspace","\\;");v("\\!","\\tmspace-{3mu}{.1667em}");v("\\negthinspace","\\!");v("\\negmedspace","\\tmspace-{4mu}{.2222em}");v("\\negthickspace","\\tmspace-{5mu}{.277em}");v("\\enspace","\\kern.5em ");v("\\enskip","\\hskip.5em\\relax");v("\\quad","\\hskip1em\\relax");v("\\qquad","\\hskip2em\\relax");v("\\tag","\\@ifstar\\tag@literal\\tag@paren");v("\\tag@paren","\\tag@literal{({#1})}");v("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new L("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});v("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");v("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");v("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");v("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");v("\\newline","\\\\\\relax");v("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var $s=P(st["Main-Regular"][84][1]-.7*st["Main-Regular"][65][1]);v("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+$s+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");v("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+$s+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");v("\\hspace","\\@ifstar\\@hspacer\\@hspace");v("\\@hspace","\\hskip #1\\relax");v("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");v("\\ordinarycolon",":");v("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");v("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');v("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');v("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');v("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');v("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');v("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');v("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');v("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');v("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');v("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');v("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');v("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');v("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');v("∷","\\dblcolon");v("∹","\\eqcolon");v("≔","\\coloneqq");v("≕","\\eqqcolon");v("⩴","\\Coloneqq");v("\\ratio","\\vcentcolon");v("\\coloncolon","\\dblcolon");v("\\colonequals","\\coloneqq");v("\\coloncolonequals","\\Coloneqq");v("\\equalscolon","\\eqqcolon");v("\\equalscoloncolon","\\Eqqcolon");v("\\colonminus","\\coloneq");v("\\coloncolonminus","\\Coloneq");v("\\minuscolon","\\eqcolon");v("\\minuscoloncolon","\\Eqcolon");v("\\coloncolonapprox","\\Colonapprox");v("\\coloncolonsim","\\Colonsim");v("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");v("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");v("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");v("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");v("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");v("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");v("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");v("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");v("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");v("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");v("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");v("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");v("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");v("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");v("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");v("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");v("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");v("\\nleqq","\\html@mathml{\\@nleqq}{≰}");v("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");v("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");v("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");v("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");v("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");v("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");v("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");v("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");v("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");v("\\imath","\\html@mathml{\\@imath}{ı}");v("\\jmath","\\html@mathml{\\@jmath}{ȷ}");v("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");v("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");v("⟦","\\llbracket");v("⟧","\\rrbracket");v("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");v("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");v("⦃","\\lBrace");v("⦄","\\rBrace");v("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");v("⦵","\\minuso");v("\\darr","\\downarrow");v("\\dArr","\\Downarrow");v("\\Darr","\\Downarrow");v("\\lang","\\langle");v("\\rang","\\rangle");v("\\uarr","\\uparrow");v("\\uArr","\\Uparrow");v("\\Uarr","\\Uparrow");v("\\N","\\mathbb{N}");v("\\R","\\mathbb{R}");v("\\Z","\\mathbb{Z}");v("\\alef","\\aleph");v("\\alefsym","\\aleph");v("\\Alpha","\\mathrm{A}");v("\\Beta","\\mathrm{B}");v("\\bull","\\bullet");v("\\Chi","\\mathrm{X}");v("\\clubs","\\clubsuit");v("\\cnums","\\mathbb{C}");v("\\Complex","\\mathbb{C}");v("\\Dagger","\\ddagger");v("\\diamonds","\\diamondsuit");v("\\empty","\\emptyset");v("\\Epsilon","\\mathrm{E}");v("\\Eta","\\mathrm{H}");v("\\exist","\\exists");v("\\harr","\\leftrightarrow");v("\\hArr","\\Leftrightarrow");v("\\Harr","\\Leftrightarrow");v("\\hearts","\\heartsuit");v("\\image","\\Im");v("\\infin","\\infty");v("\\Iota","\\mathrm{I}");v("\\isin","\\in");v("\\Kappa","\\mathrm{K}");v("\\larr","\\leftarrow");v("\\lArr","\\Leftarrow");v("\\Larr","\\Leftarrow");v("\\lrarr","\\leftrightarrow");v("\\lrArr","\\Leftrightarrow");v("\\Lrarr","\\Leftrightarrow");v("\\Mu","\\mathrm{M}");v("\\natnums","\\mathbb{N}");v("\\Nu","\\mathrm{N}");v("\\Omicron","\\mathrm{O}");v("\\plusmn","\\pm");v("\\rarr","\\rightarrow");v("\\rArr","\\Rightarrow");v("\\Rarr","\\Rightarrow");v("\\real","\\Re");v("\\reals","\\mathbb{R}");v("\\Reals","\\mathbb{R}");v("\\Rho","\\mathrm{P}");v("\\sdot","\\cdot");v("\\sect","\\S");v("\\spades","\\spadesuit");v("\\sub","\\subset");v("\\sube","\\subseteq");v("\\supe","\\supseteq");v("\\Tau","\\mathrm{T}");v("\\thetasym","\\vartheta");v("\\weierp","\\wp");v("\\Zeta","\\mathrm{Z}");v("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");v("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");v("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");v("\\bra","\\mathinner{\\langle{#1}|}");v("\\ket","\\mathinner{|{#1}\\rangle}");v("\\braket","\\mathinner{\\langle{#1}\\rangle}");v("\\Bra","\\left\\langle#1\\right|");v("\\Ket","\\left|#1\\right\\rangle");var Us=e=>t=>{var r=t.consumeArg().tokens,n=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,l=t.macros.get("|"),s=t.macros.get("\\|");t.macros.beginGroup();var o=m=>d=>{e&&(d.macros.set("|",l),i.length&&d.macros.set("\\|",s));var p=m;if(!m&&i.length){var y=d.future();y.text==="|"&&(d.popToken(),p=!0)}return{tokens:p?i:n,numArgs:0}};t.macros.set("|",o(!1)),i.length&&t.macros.set("\\|",o(!0));var u=t.consumeArg().tokens,h=t.expandTokens([...a,...u,...r]);return t.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};v("\\bra@ket",Us(!1));v("\\bra@set",Us(!0));v("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");v("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");v("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");v("\\angln","{\\angl n}");v("\\blue","\\textcolor{##6495ed}{#1}");v("\\orange","\\textcolor{##ffa500}{#1}");v("\\pink","\\textcolor{##ff00af}{#1}");v("\\red","\\textcolor{##df0030}{#1}");v("\\green","\\textcolor{##28ae7b}{#1}");v("\\gray","\\textcolor{gray}{#1}");v("\\purple","\\textcolor{##9d38bd}{#1}");v("\\blueA","\\textcolor{##ccfaff}{#1}");v("\\blueB","\\textcolor{##80f6ff}{#1}");v("\\blueC","\\textcolor{##63d9ea}{#1}");v("\\blueD","\\textcolor{##11accd}{#1}");v("\\blueE","\\textcolor{##0c7f99}{#1}");v("\\tealA","\\textcolor{##94fff5}{#1}");v("\\tealB","\\textcolor{##26edd5}{#1}");v("\\tealC","\\textcolor{##01d1c1}{#1}");v("\\tealD","\\textcolor{##01a995}{#1}");v("\\tealE","\\textcolor{##208170}{#1}");v("\\greenA","\\textcolor{##b6ffb0}{#1}");v("\\greenB","\\textcolor{##8af281}{#1}");v("\\greenC","\\textcolor{##74cf70}{#1}");v("\\greenD","\\textcolor{##1fab54}{#1}");v("\\greenE","\\textcolor{##0d923f}{#1}");v("\\goldA","\\textcolor{##ffd0a9}{#1}");v("\\goldB","\\textcolor{##ffbb71}{#1}");v("\\goldC","\\textcolor{##ff9c39}{#1}");v("\\goldD","\\textcolor{##e07d10}{#1}");v("\\goldE","\\textcolor{##a75a05}{#1}");v("\\redA","\\textcolor{##fca9a9}{#1}");v("\\redB","\\textcolor{##ff8482}{#1}");v("\\redC","\\textcolor{##f9685d}{#1}");v("\\redD","\\textcolor{##e84d39}{#1}");v("\\redE","\\textcolor{##bc2612}{#1}");v("\\maroonA","\\textcolor{##ffbde0}{#1}");v("\\maroonB","\\textcolor{##ff92c6}{#1}");v("\\maroonC","\\textcolor{##ed5fa6}{#1}");v("\\maroonD","\\textcolor{##ca337c}{#1}");v("\\maroonE","\\textcolor{##9e034e}{#1}");v("\\purpleA","\\textcolor{##ddd7ff}{#1}");v("\\purpleB","\\textcolor{##c6b9fc}{#1}");v("\\purpleC","\\textcolor{##aa87ff}{#1}");v("\\purpleD","\\textcolor{##7854ab}{#1}");v("\\purpleE","\\textcolor{##543b78}{#1}");v("\\mintA","\\textcolor{##f5f9e8}{#1}");v("\\mintB","\\textcolor{##edf2df}{#1}");v("\\mintC","\\textcolor{##e0e5cc}{#1}");v("\\grayA","\\textcolor{##f6f7f7}{#1}");v("\\grayB","\\textcolor{##f0f1f2}{#1}");v("\\grayC","\\textcolor{##e3e5e6}{#1}");v("\\grayD","\\textcolor{##d6d8da}{#1}");v("\\grayE","\\textcolor{##babec2}{#1}");v("\\grayF","\\textcolor{##888d93}{#1}");v("\\grayG","\\textcolor{##626569}{#1}");v("\\grayH","\\textcolor{##3b3e40}{#1}");v("\\grayI","\\textcolor{##21242c}{#1}");v("\\kaBlue","\\textcolor{##314453}{#1}");v("\\kaGreen","\\textcolor{##71B307}{#1}");var _s={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Z2{constructor(t,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new X2(K2,r.macros),this.mode=n,this.stack=[]}feed(t){this.lexer=new Ba(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,n,i;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:r,end:n}=this.consumeArg());return this.pushToken(new We("EOF",n.loc)),this.pushTokens(i),new We("",qe.range(r,n))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],n=t&&t.length>0;n||this.consumeSpaces();var i=this.future(),a,l=0,s=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++l;else if(a.text==="}"){if(--l,l===-1)throw new L("Extra }",a)}else if(a.text==="EOF")throw new L("Unexpected end of input in a macro argument, expected '"+(t&&n?t[s]:"}")+"'",a);if(t&&n)if((l===0||l===1&&t[s]==="{")&&a.text===t[s]){if(++s,s===t.length){r.splice(-s,s);break}}else s=0}while(l!==0||n);return i.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:i,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new L("The length of delimiters doesn't match the number of args!");for(var n=r[0],i=0;ithis.settings.maxExpand)throw new L("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),n=r.text,i=r.noexpand?null:this._getExpansion(n);if(i==null||t&&i.unexpandable){if(t&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new L("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var a=i.tokens,l=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var s=a.length-1;s>=0;--s){var o=a[s];if(o.text==="#"){if(s===0)throw new L("Incomplete placeholder at end of macro body",o);if(o=a[--s],o.text==="#")a.splice(s+1,1);else if(/^[1-9]$/.test(o.text))a.splice(s,2,...l[+o.text-1]);else throw new L("Not a valid argument number",o)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new We(t)]):void 0}expandTokens(t){var r=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),r.push(i)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(n=>n.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var n=this.lexer.catcodes[t];if(n!=null&&n!==13)return}var i=typeof r=="function"?r(this):r;if(typeof i=="string"){var a=0;if(i.indexOf("#")!==-1)for(var l=i.replace(/##/g,"");l.indexOf("#"+(a+1))!==-1;)++a;for(var s=new Ba(i,this.settings),o=[],u=s.lex();u.text!=="EOF";)o.push(u),u=s.lex();o.reverse();var h={tokens:o,numArgs:a};return h}return i}isDefined(t){return this.macros.has(t)||Mt.hasOwnProperty(t)||de.math.hasOwnProperty(t)||de.text.hasOwnProperty(t)||_s.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Mt.hasOwnProperty(t)&&!Mt[t].primitive}}var La=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,jr=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Xn={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Ra={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class fn{constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Z2(t,r,this.mode),this.settings=r,this.leftrightDepth=0}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new L("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new We("}")),this.gullet.pushTokens(t);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(t,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(fn.endOfExpression.indexOf(i.text)!==-1||r&&i.text===r||t&&Mt[i.text]&&Mt[i.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;n.push(a)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){for(var r=-1,n,i=0;i=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',t);var s=de[this.mode][r].group,o=qe.range(t),u;if(qf.hasOwnProperty(s)){var h=s;u={type:"atom",mode:this.mode,family:h,loc:o,text:r}}else u={type:s,mode:this.mode,loc:o,text:r};l=u}else if(r.charCodeAt(0)>=128)this.settings.strict&&(es(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),l={type:"textord",mode:"text",loc:qe.range(t),text:r};else return null;if(this.consume(),a)for(var m=0;m=0;)c=dn(e,t,n,r,u+1,i+1,s),c>f&&(u===o?c*=jn:ts.test(e.charAt(u-1))?(c*=Ji,p=e.slice(o,u-1).match(ns),p&&o>0&&(c*=Math.pow(Zt,p.length))):rs.test(e.charAt(u-1))?(c*=Zi,h=e.slice(o,u-1).match(Nr),h&&o>0&&(c*=Math.pow(Zt,h.length))):(c*=Xi,o>0&&(c*=Math.pow(Zt,u-o))),e.charAt(u)!==t.charAt(i)&&(c*=Qi)),(cc&&(c=d*Kt)),c>f&&(f=c),u=n.indexOf(l,u+1);return s[a]=f,f}function Bn(e){return e.toLowerCase().replace(Nr," ")}function os(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,dn(e,t,Bn(e),Bn(t),0,0,{})}var is=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Be=is.reduce((e,t)=>{const n=fi(`Primitive.${t}`),r=b.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),yi.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),at='[cmdk-group=""]',Jt='[cmdk-group-items=""]',ss='[cmdk-group-heading=""]',Dr='[cmdk-item=""]',Ln=`${Dr}:not([aria-disabled="true"])`,pn="cmdk-item-select",Ve="data-value",as=(e,t,n)=>os(e,t,n),Ir=b.createContext(void 0),bt=()=>b.useContext(Ir),Wr=b.createContext(void 0),On=()=>b.useContext(Wr),Rr=b.createContext(void 0),Ar=b.forwardRef((e,t)=>{let n=Ke(()=>{var k,R;return{search:"",value:(R=(k=e.value)!=null?k:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ke(()=>new Set),o=Ke(()=>new Map),i=Ke(()=>new Map),s=Ke(()=>new Set),a=_r(e),{label:l,children:u,value:f,onValueChange:c,filter:d,shouldFilter:p,loop:h,disablePointerSelection:v=!1,vimBindings:S=!0,...y}=e,m=Ze(),E=Ze(),M=Ze(),C=b.useRef(null),O=gs();ze(()=>{if(f!==void 0){let k=f.trim();n.current.value=k,D.emit()}},[f]),ze(()=>{O(6,fe)},[]);let D=b.useMemo(()=>({subscribe:k=>(s.current.add(k),()=>s.current.delete(k)),snapshot:()=>n.current,setState:(k,R,B)=>{var W,U,V,ne;if(!Object.is(n.current[k],R)){if(n.current[k]=R,k==="search")ue(),$(),O(1,oe);else if(k==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Q=document.getElementById(M);Q?Q.focus():(W=document.getElementById(m))==null||W.focus()}if(O(7,()=>{var Q;n.current.selectedItemId=(Q=X())==null?void 0:Q.id,D.emit()}),B||O(5,fe),((U=a.current)==null?void 0:U.value)!==void 0){let Q=R??"";(ne=(V=a.current).onValueChange)==null||ne.call(V,Q);return}}D.emit()}},emit:()=>{s.current.forEach(k=>k())}}),[]),j=b.useMemo(()=>({value:(k,R,B)=>{var W;R!==((W=i.current.get(k))==null?void 0:W.value)&&(i.current.set(k,{value:R,keywords:B}),n.current.filtered.items.set(k,Z(R,B)),O(2,()=>{$(),D.emit()}))},item:(k,R)=>(r.current.add(k),R&&(o.current.has(R)?o.current.get(R).add(k):o.current.set(R,new Set([k]))),O(3,()=>{ue(),$(),n.current.value||oe(),D.emit()}),()=>{i.current.delete(k),r.current.delete(k),n.current.filtered.items.delete(k);let B=X();O(4,()=>{ue(),B?.getAttribute("id")===k&&oe(),D.emit()})}),group:k=>(o.current.has(k)||o.current.set(k,new Set),()=>{i.current.delete(k),o.current.delete(k)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:m,inputId:M,labelId:E,listInnerRef:C}),[]);function Z(k,R){var B,W;let U=(W=(B=a.current)==null?void 0:B.filter)!=null?W:as;return k?U(k,n.current.search,R):0}function $(){if(!n.current.search||a.current.shouldFilter===!1)return;let k=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(W=>{let U=o.current.get(W),V=0;U.forEach(ne=>{let Q=k.get(ne);V=Math.max(Q,V)}),R.push([W,V])});let B=C.current;de().sort((W,U)=>{var V,ne;let Q=W.getAttribute("id"),xe=U.getAttribute("id");return((V=k.get(xe))!=null?V:0)-((ne=k.get(Q))!=null?ne:0)}).forEach(W=>{let U=W.closest(Jt);U?U.appendChild(W.parentElement===U?W:W.closest(`${Jt} > *`)):B.appendChild(W.parentElement===B?W:W.closest(`${Jt} > *`))}),R.sort((W,U)=>U[1]-W[1]).forEach(W=>{var U;let V=(U=C.current)==null?void 0:U.querySelector(`${at}[${Ve}="${encodeURIComponent(W[0])}"]`);V?.parentElement.appendChild(V)})}function oe(){let k=de().find(B=>B.getAttribute("aria-disabled")!=="true"),R=k?.getAttribute(Ve);D.setState("value",R||void 0)}function ue(){var k,R,B,W;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let U=0;for(let V of r.current){let ne=(R=(k=i.current.get(V))==null?void 0:k.value)!=null?R:"",Q=(W=(B=i.current.get(V))==null?void 0:B.keywords)!=null?W:[],xe=Z(ne,Q);n.current.filtered.items.set(V,xe),xe>0&&U++}for(let[V,ne]of o.current)for(let Q of ne)if(n.current.filtered.items.get(Q)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=U}function fe(){var k,R,B;let W=X();W&&(((k=W.parentElement)==null?void 0:k.firstChild)===W&&((B=(R=W.closest(at))==null?void 0:R.querySelector(ss))==null||B.scrollIntoView({block:"nearest"})),W.scrollIntoView({block:"nearest"}))}function X(){var k;return(k=C.current)==null?void 0:k.querySelector(`${Dr}[aria-selected="true"]`)}function de(){var k;return Array.from(((k=C.current)==null?void 0:k.querySelectorAll(Ln))||[])}function Ae(k){let R=de()[k];R&&D.setState("value",R.getAttribute(Ve))}function Le(k){var R;let B=X(),W=de(),U=W.findIndex(ne=>ne===B),V=W[U+k];(R=a.current)!=null&&R.loop&&(V=U+k<0?W[W.length-1]:U+k===W.length?W[0]:W[U+k]),V&&D.setState("value",V.getAttribute(Ve))}function qe(k){let R=X(),B=R?.closest(at),W;for(;B&&!W;)B=k>0?ys(B,at):vs(B,at),W=B?.querySelector(Ln);W?D.setState("value",W.getAttribute(Ve)):Le(k)}let ie=()=>Ae(de().length-1),se=k=>{k.preventDefault(),k.metaKey?ie():k.altKey?qe(1):Le(1)},pe=k=>{k.preventDefault(),k.metaKey?Ae(0):k.altKey?qe(-1):Le(-1)};return b.createElement(Be.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:k=>{var R;(R=y.onKeyDown)==null||R.call(y,k);let B=k.nativeEvent.isComposing||k.keyCode===229;if(!(k.defaultPrevented||B))switch(k.key){case"n":case"j":{S&&k.ctrlKey&&se(k);break}case"ArrowDown":{se(k);break}case"p":case"k":{S&&k.ctrlKey&&pe(k);break}case"ArrowUp":{pe(k);break}case"Home":{k.preventDefault(),Ae(0);break}case"End":{k.preventDefault(),ie();break}case"Enter":{k.preventDefault();let W=X();if(W){let U=new Event(pn);W.dispatchEvent(U)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:ws},l),jt(e,k=>b.createElement(Wr.Provider,{value:D},b.createElement(Ir.Provider,{value:j},k))))}),ls=b.forwardRef((e,t)=>{var n,r;let o=Ze(),i=b.useRef(null),s=b.useContext(Rr),a=bt(),l=_r(e),u=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:s?.forceMount;ze(()=>{if(!u)return a.item(o,s?.id)},[u]);let f=Fr(o,i,[e.value,e.children,i],e.keywords),c=On(),d=Fe(O=>O.value&&O.value===f.current),p=Fe(O=>u||a.filter()===!1?!0:O.search?O.filtered.items.get(o)>0:!0);b.useEffect(()=>{let O=i.current;if(!(!O||e.disabled))return O.addEventListener(pn,h),()=>O.removeEventListener(pn,h)},[p,e.onSelect,e.disabled]);function h(){var O,D;v(),(D=(O=l.current).onSelect)==null||D.call(O,f.current)}function v(){c.setState("value",f.current,!0)}if(!p)return null;let{disabled:S,value:y,onSelect:m,forceMount:E,keywords:M,...C}=e;return b.createElement(Be.div,{ref:mt(i,t),...C,id:o,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!d,"data-disabled":!!S,"data-selected":!!d,onPointerMove:S||a.getDisablePointerSelection()?void 0:v,onClick:S?void 0:h},e.children)}),cs=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,s=Ze(),a=b.useRef(null),l=b.useRef(null),u=Ze(),f=bt(),c=Fe(p=>o||f.filter()===!1?!0:p.search?p.filtered.groups.has(s):!0);ze(()=>f.group(s),[]),Fr(s,a,[e.value,e.heading,l]);let d=b.useMemo(()=>({id:s,forceMount:o}),[o]);return b.createElement(Be.div,{ref:mt(a,t),...i,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),jt(e,p=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Rr.Provider,{value:d},p))))}),us=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=b.useRef(null),i=Fe(s=>!s.search);return!n&&!i?null:b.createElement(Be.div,{ref:mt(o,t),...r,"cmdk-separator":"",role:"separator"})}),fs=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=On(),s=Fe(u=>u.search),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(Be.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:o?e.value:s,onChange:u=>{o||i.setState("search",u.target.value),n?.(u.target.value)}})}),ds=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=b.useRef(null),s=b.useRef(null),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{if(s.current&&i.current){let u=s.current,f=i.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let p=u.offsetHeight;f.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return d.observe(u),()=>{cancelAnimationFrame(c),d.unobserve(u)}}},[]),b.createElement(Be.div,{ref:mt(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},jt(e,u=>b.createElement("div",{ref:mt(s,l.listInnerRef),"cmdk-list-sizer":""},u)))}),ps=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:s,...a}=e;return b.createElement(di,{open:n,onOpenChange:r},b.createElement(pi,{container:s},b.createElement(hi,{"cmdk-overlay":"",className:o}),b.createElement(mi,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(Ar,{ref:t,...a}))))}),hs=b.forwardRef((e,t)=>Fe(n=>n.filtered.count===0)?b.createElement(Be.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ms=b.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return b.createElement(Be.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},jt(e,s=>b.createElement("div",{"aria-hidden":!0},s)))}),nf=Object.assign(Ar,{List:ds,Item:ls,Input:fs,Group:cs,Separator:us,Dialog:ps,Empty:hs,Loading:ms});function ys(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function vs(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function _r(e){let t=b.useRef(e);return ze(()=>{t.current=e}),t}var ze=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Ke(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function Fe(e){let t=On(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function Fr(e,t,n,r=[]){let o=b.useRef(),i=bt();return ze(()=>{var s;let a=(()=>{var u;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():o.current}})(),l=r.map(u=>u.trim());i.value(e,a,l),(s=t.current)==null||s.setAttribute(Ve,a),o.current=a}),o}var gs=()=>{let[e,t]=b.useState(),n=Ke(()=>new Map);return ze(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function bs(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function jt({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(bs(t),{ref:t.ref},n(t.props.children)):n(t)}var ws={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function jr(e){return t=>typeof t===e}var Os=jr("function"),Ss=e=>e===null,$n=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Hn=e=>!Es(e)&&!Ss(e)&&(Os(e)||typeof e=="object"),Es=jr("undefined");function ks(e,t){const{length:n}=e;if(n!==t.length)return!1;for(let r=n;r--!==0;)if(!re(e[r],t[r]))return!1;return!0}function Cs(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function Ts(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!re(n[1],t.get(n[0])))return!1;return!0}function Ms(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function re(e,t){if(e===t)return!0;if(e&&Hn(e)&&t&&Hn(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return ks(e,t);if(e instanceof Map&&t instanceof Map)return Ts(e,t);if(e instanceof Set&&t instanceof Set)return Ms(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Cs(e,t);if($n(e)&&$n(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(let o=n.length;o--!==0;){const i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!re(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}var Ps=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],xs=["bigint","boolean","null","number","string","symbol","undefined"];function Bt(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Ns(t))return t}function be(e){return t=>Bt(t)===e}function Ns(e){return Ps.includes(e)}function tt(e){return t=>typeof t===e}function Ds(e){return xs.includes(e)}var Is=["innerHTML","ownerDocument","style","attributes","nodeValue"];function P(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(P.array(e))return"Array";if(P.plainFunction(e))return"Function";const t=Bt(e);return t||"Object"}P.array=Array.isArray;P.arrayOf=(e,t)=>!P.array(e)&&!P.function(t)?!1:e.every(n=>t(n));P.asyncGeneratorFunction=e=>Bt(e)==="AsyncGeneratorFunction";P.asyncFunction=be("AsyncFunction");P.bigint=tt("bigint");P.boolean=e=>e===!0||e===!1;P.date=be("Date");P.defined=e=>!P.undefined(e);P.domElement=e=>P.object(e)&&!P.plainObject(e)&&e.nodeType===1&&P.string(e.nodeName)&&Is.every(t=>t in e);P.empty=e=>P.string(e)&&e.length===0||P.array(e)&&e.length===0||P.object(e)&&!P.map(e)&&!P.set(e)&&Object.keys(e).length===0||P.set(e)&&e.size===0||P.map(e)&&e.size===0;P.error=be("Error");P.function=tt("function");P.generator=e=>P.iterable(e)&&P.function(e.next)&&P.function(e.throw);P.generatorFunction=be("GeneratorFunction");P.instanceOf=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype;P.iterable=e=>!P.nullOrUndefined(e)&&P.function(e[Symbol.iterator]);P.map=be("Map");P.nan=e=>Number.isNaN(e);P.null=e=>e===null;P.nullOrUndefined=e=>P.null(e)||P.undefined(e);P.number=e=>tt("number")(e)&&!P.nan(e);P.numericString=e=>P.string(e)&&e.length>0&&!Number.isNaN(Number(e));P.object=e=>!P.nullOrUndefined(e)&&(P.function(e)||typeof e=="object");P.oneOf=(e,t)=>P.array(e)?e.indexOf(t)>-1:!1;P.plainFunction=be("Function");P.plainObject=e=>{if(Bt(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};P.primitive=e=>P.null(e)||Ds(typeof e);P.promise=be("Promise");P.propertyOf=(e,t,n)=>{if(!P.object(e)||!t)return!1;const r=e[t];return P.function(n)?n(r):P.defined(r)};P.regexp=be("RegExp");P.set=be("Set");P.string=tt("string");P.symbol=tt("symbol");P.undefined=tt("undefined");P.weakMap=be("WeakMap");P.weakSet=be("WeakSet");var x=P;function Ws(...e){return e.every(t=>x.string(t)||x.array(t)||x.plainObject(t))}function Rs(e,t,n){return Br(e,t)?[e,t].every(x.array)?!e.some(Gn(n))&&t.some(Gn(n)):[e,t].every(x.plainObject)?!Object.entries(e).some(qn(n))&&Object.entries(t).some(qn(n)):t===n:!1}function zn(e,t,n){const{actual:r,key:o,previous:i,type:s}=n,a=Ce(e,o),l=Ce(t,o);let u=[a,l].every(x.number)&&(s==="increased"?al);return x.undefined(r)||(u=u&&l===r),x.undefined(i)||(u=u&&a===i),u}function Un(e,t,n){const{key:r,type:o,value:i}=n,s=Ce(e,r),a=Ce(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!x.nullOrUndefined(i)){if(x.defined(l)){if(x.array(l)||x.plainObject(l))return Rs(l,u,i)}else return re(u,i);return!1}return[s,a].every(x.array)?!u.every(Sn(l)):[s,a].every(x.plainObject)?As(Object.keys(l),Object.keys(u)):![s,a].every(f=>x.primitive(f)&&x.defined(f))&&(o==="added"?!x.defined(s)&&x.defined(a):x.defined(s)&&!x.defined(a))}function Yn(e,t,{key:n}={}){let r=Ce(e,n),o=Ce(t,n);if(!Br(r,o))throw new TypeError("Inputs have different types");if(!Ws(r,o))throw new TypeError("Inputs don't have length");return[r,o].every(x.plainObject)&&(r=Object.keys(r),o=Object.keys(o)),[r,o]}function qn(e){return([t,n])=>x.array(e)?re(e,n)||e.some(r=>re(r,n)||x.array(n)&&Sn(n)(r)):x.plainObject(e)&&e[t]?!!e[t]&&re(e[t],n):re(e,n)}function As(e,t){return t.some(n=>!e.includes(n))}function Gn(e){return t=>x.array(e)?e.some(n=>re(n,t)||x.array(t)&&Sn(t)(n)):re(e,t)}function lt(e,t){return x.array(e)?e.some(n=>re(n,t)):re(e,t)}function Sn(e){return t=>e.some(n=>re(n,t))}function Br(...e){return e.every(x.array)||e.every(x.number)||e.every(x.plainObject)||e.every(x.string)}function Ce(e,t){return x.plainObject(e)||x.array(e)?x.string(t)?t.split(".").reduce((r,o)=>r&&r[o],e):x.number(t)?e[t]:e:e}function Rt(e,t){if([e,t].some(x.nullOrUndefined))throw new Error("Missing required parameters");if(![e,t].every(f=>x.plainObject(f)||x.array(f)))throw new Error("Expected plain objects or array");return{added:(f,c)=>{try{return Un(e,t,{key:f,type:"added",value:c})}catch{return!1}},changed:(f,c,d)=>{try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(c),S=x.defined(d);if(v||S){const y=S?lt(d,p):!lt(c,p),m=lt(c,h);return y&&m}return[p,h].every(x.array)||[p,h].every(x.plainObject)?!re(p,h):p!==h}catch{return!1}},changedFrom:(f,c,d)=>{if(!x.defined(f))return!1;try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(d);return lt(c,p)&&(v?lt(d,h):!v)}catch{return!1}},decreased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"decreased"})}catch{return!1}},emptied:f=>{try{const[c,d]=Yn(e,t,{key:f});return!!c.length&&!d.length}catch{return!1}},filled:f=>{try{const[c,d]=Yn(e,t,{key:f});return!c.length&&!!d.length}catch{return!1}},increased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"increased"})}catch{return!1}},removed:(f,c)=>{try{return Un(e,t,{key:f,type:"removed",value:c})}catch{return!1}}}}var Xt,Vn;function _s(){if(Vn)return Xt;Vn=1;var e=new Error("Element already at target scroll position"),t=new Error("Scroll cancelled"),n=Math.min,r=Date.now;Xt={left:o("scrollLeft"),top:o("scrollTop")};function o(a){return function(u,f,c,d){c=c||{},typeof c=="function"&&(d=c,c={}),typeof d!="function"&&(d=s);var p=r(),h=u[a],v=c.ease||i,S=isNaN(c.duration)?350:+c.duration,y=!1;return h===f?d(e,u[a]):requestAnimationFrame(E),m;function m(){y=!0}function E(M){if(y)return d(t,u[a]);var C=r(),O=n(1,(C-p)/S),D=v(O);u[a]=D*(f-h)+h,O<1?requestAnimationFrame(E):requestAnimationFrame(function(){d(null,u[a])})}}}function i(a){return .5*(1-Math.cos(Math.PI*a))}function s(){}return Xt}var Fs=_s();const js=gt(Fs);var It={exports:{}},Bs=It.exports,Kn;function Ls(){return Kn||(Kn=1,(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Bs,function(){function t(r){var o=getComputedStyle(r,null).getPropertyValue("overflow");return o.indexOf("scroll")>-1||o.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var o=r.parentNode;o.parentNode;){if(t(o))return o;o=o.parentNode}return document.scrollingElement||document.documentElement}}return n})})(It)),It.exports}var $s=Ls();const Lr=gt($s);var Qt,Zn;function Hs(){if(Zn)return Qt;Zn=1;var e=function(r){return Object.prototype.hasOwnProperty.call(r,"props")},t=function(r,o){return r+n(o)},n=function(r){return r===null||typeof r=="boolean"||typeof r>"u"?"":typeof r=="number"?r.toString():typeof r=="string"?r:Array.isArray(r)?r.reduce(t,""):e(r)&&Object.prototype.hasOwnProperty.call(r.props,"children")?n(r.props.children):""};return n.default=n,Qt=n,Qt}var zs=Hs();const Jn=gt(zs);var en,Xn;function Us(){if(Xn)return en;Xn=1;var e=function(m){return t(m)&&!n(m)};function t(y){return!!y&&typeof y=="object"}function n(y){var m=Object.prototype.toString.call(y);return m==="[object RegExp]"||m==="[object Date]"||i(y)}var r=typeof Symbol=="function"&&Symbol.for,o=r?Symbol.for("react.element"):60103;function i(y){return y.$$typeof===o}function s(y){return Array.isArray(y)?[]:{}}function a(y,m){return m.clone!==!1&&m.isMergeableObject(y)?v(s(y),y,m):y}function l(y,m,E){return y.concat(m).map(function(M){return a(M,E)})}function u(y,m){if(!m.customMerge)return v;var E=m.customMerge(y);return typeof E=="function"?E:v}function f(y){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(y).filter(function(m){return Object.propertyIsEnumerable.call(y,m)}):[]}function c(y){return Object.keys(y).concat(f(y))}function d(y,m){try{return m in y}catch{return!1}}function p(y,m){return d(y,m)&&!(Object.hasOwnProperty.call(y,m)&&Object.propertyIsEnumerable.call(y,m))}function h(y,m,E){var M={};return E.isMergeableObject(y)&&c(y).forEach(function(C){M[C]=a(y[C],E)}),c(m).forEach(function(C){p(y,C)||(d(y,C)&&E.isMergeableObject(m[C])?M[C]=u(C,E)(y[C],m[C],E):M[C]=a(m[C],E))}),M}function v(y,m,E){E=E||{},E.arrayMerge=E.arrayMerge||l,E.isMergeableObject=E.isMergeableObject||e,E.cloneUnlessOtherwiseSpecified=a;var M=Array.isArray(m),C=Array.isArray(y),O=M===C;return O?M?E.arrayMerge(y,m,E):h(y,m,E):a(m,E)}v.all=function(m,E){if(!Array.isArray(m))throw new Error("first argument should be an array");return m.reduce(function(M,C){return v(M,C,E)},{})};var S=v;return en=S,en}var Ys=Us();const ve=gt(Ys);var tn={exports:{}},nn,Qn;function qs(){if(Qn)return nn;Qn=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return nn=e,nn}var rn,er;function Gs(){if(er)return rn;er=1;var e=qs();function t(){}function n(){}return n.resetWarningCache=t,rn=function(){function r(s,a,l,u,f,c){if(c!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},rn}var tr;function Vs(){return tr||(tr=1,tn.exports=Gs()()),tn.exports}var Ks=Vs();const T=gt(Ks);var wt=typeof window<"u"&&typeof document<"u"&&typeof navigator<"u",Zs=(function(){for(var e=["Edge","Trident","Firefox"],t=0;t=0)return 1;return 0})();function Js(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}function Xs(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},Zs))}}var Qs=wt&&window.Promise,ea=Qs?Js:Xs;function $r(e){var t={};return e&&t.toString.call(e)==="[object Function]"}function Ye(e,t){if(e.nodeType!==1)return[];var n=e.ownerDocument.defaultView,r=n.getComputedStyle(e,null);return t?r[t]:r}function En(e){return e.nodeName==="HTML"?e:e.parentNode||e.host}function Ot(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=Ye(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+r)?e:Ot(En(e))}function Hr(e){return e&&e.referenceNode?e.referenceNode:e}var nr=wt&&!!(window.MSInputMethodContext&&document.documentMode),rr=wt&&/MSIE 10/.test(navigator.userAgent);function nt(e){return e===11?nr:e===10?rr:nr||rr}function Je(e){if(!e)return document.documentElement;for(var t=nt(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var r=n&&n.nodeName;return!r||r==="BODY"||r==="HTML"?e?e.ownerDocument.documentElement:document.documentElement:["TH","TD","TABLE"].indexOf(n.nodeName)!==-1&&Ye(n,"position")==="static"?Je(n):n}function ta(e){var t=e.nodeName;return t==="BODY"?!1:t==="HTML"||Je(e.firstElementChild)===e}function hn(e){return e.parentNode!==null?hn(e.parentNode):e}function At(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?e:t,o=n?t:e,i=document.createRange();i.setStart(r,0),i.setEnd(o,0);var s=i.commonAncestorContainer;if(e!==s&&t!==s||r.contains(o))return ta(s)?s:Je(s);var a=hn(e);return a.host?At(a.host,t):At(e,hn(t).host)}function Xe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top",n=t==="top"?"scrollTop":"scrollLeft",r=e.nodeName;if(r==="BODY"||r==="HTML"){var o=e.ownerDocument.documentElement,i=e.ownerDocument.scrollingElement||o;return i[n]}return e[n]}function na(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=Xe(t,"top"),o=Xe(t,"left"),i=n?-1:1;return e.top+=r*i,e.bottom+=r*i,e.left+=o*i,e.right+=o*i,e}function or(e,t){var n=t==="x"?"Left":"Top",r=n==="Left"?"Right":"Bottom";return parseFloat(e["border"+n+"Width"])+parseFloat(e["border"+r+"Width"])}function ir(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],nt(10)?parseInt(n["offset"+e])+parseInt(r["margin"+(e==="Height"?"Top":"Left")])+parseInt(r["margin"+(e==="Height"?"Bottom":"Right")]):0)}function zr(e){var t=e.body,n=e.documentElement,r=nt(10)&&getComputedStyle(n);return{height:ir("Height",t,n,r),width:ir("Width",t,n,r)}}var ra=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},oa=(function(){function e(t,n){for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=nt(10),o=t.nodeName==="HTML",i=mn(e),s=mn(t),a=Ot(e),l=Ye(t),u=parseFloat(l.borderTopWidth),f=parseFloat(l.borderLeftWidth);n&&o&&(s.top=Math.max(s.top,0),s.left=Math.max(s.left,0));var c=je({top:i.top-s.top-u,left:i.left-s.left-f,width:i.width,height:i.height});if(c.marginTop=0,c.marginLeft=0,!r&&o){var d=parseFloat(l.marginTop),p=parseFloat(l.marginLeft);c.top-=u-d,c.bottom-=u-d,c.left-=f-p,c.right-=f-p,c.marginTop=d,c.marginLeft=p}return(r&&!n?t.contains(a):t===a&&a.nodeName!=="BODY")&&(c=na(c,t)),c}function ia(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=e.ownerDocument.documentElement,r=kn(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),s=t?0:Xe(n),a=t?0:Xe(n,"left"),l={top:s-r.top+r.marginTop,left:a-r.left+r.marginLeft,width:o,height:i};return je(l)}function Ur(e){var t=e.nodeName;if(t==="BODY"||t==="HTML")return!1;if(Ye(e,"position")==="fixed")return!0;var n=En(e);return n?Ur(n):!1}function Yr(e){if(!e||!e.parentElement||nt())return document.documentElement;for(var t=e.parentElement;t&&Ye(t,"transform")==="none";)t=t.parentElement;return t||document.documentElement}function Cn(e,t,n,r){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,i={top:0,left:0},s=o?Yr(e):At(e,Hr(t));if(r==="viewport")i=ia(s,o);else{var a=void 0;r==="scrollParent"?(a=Ot(En(t)),a.nodeName==="BODY"&&(a=e.ownerDocument.documentElement)):r==="window"?a=e.ownerDocument.documentElement:a=r;var l=kn(a,s,o);if(a.nodeName==="HTML"&&!Ur(s)){var u=zr(e.ownerDocument),f=u.height,c=u.width;i.top+=l.top-l.marginTop,i.bottom=f+l.top,i.left+=l.left-l.marginLeft,i.right=c+l.left}else i=l}n=n||0;var d=typeof n=="number";return i.left+=d?n:n.left||0,i.top+=d?n:n.top||0,i.right-=d?n:n.right||0,i.bottom-=d?n:n.bottom||0,i}function sa(e){var t=e.width,n=e.height;return t*n}function qr(e,t,n,r,o){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(e.indexOf("auto")===-1)return e;var s=Cn(n,r,i,o),a={top:{width:s.width,height:t.top-s.top},right:{width:s.right-t.right,height:s.height},bottom:{width:s.width,height:s.bottom-t.bottom},left:{width:t.left-s.left,height:s.height}},l=Object.keys(a).map(function(d){return he({key:d},a[d],{area:sa(a[d])})}).sort(function(d,p){return p.area-d.area}),u=l.filter(function(d){var p=d.width,h=d.height;return p>=n.clientWidth&&h>=n.clientHeight}),f=u.length>0?u[0].key:l[0].key,c=e.split("-")[1];return f+(c?"-"+c:"")}function Gr(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o=r?Yr(t):At(t,Hr(n));return kn(n,o,r)}function Vr(e){var t=e.ownerDocument.defaultView,n=t.getComputedStyle(e),r=parseFloat(n.marginTop||0)+parseFloat(n.marginBottom||0),o=parseFloat(n.marginLeft||0)+parseFloat(n.marginRight||0),i={width:e.offsetWidth+o,height:e.offsetHeight+r};return i}function _t(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(n){return t[n]})}function Kr(e,t,n){n=n.split("-")[0];var r=Vr(e),o={width:r.width,height:r.height},i=["right","left"].indexOf(n)!==-1,s=i?"top":"left",a=i?"left":"top",l=i?"height":"width",u=i?"width":"height";return o[s]=t[s]+t[l]/2-r[l]/2,n===a?o[a]=t[a]-r[u]:o[a]=t[_t(a)],o}function St(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function aa(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(o){return o[t]===n});var r=St(e,function(o){return o[t]===n});return e.indexOf(r)}function Zr(e,t,n){var r=n===void 0?e:e.slice(0,aa(e,"name",n));return r.forEach(function(o){o.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var i=o.function||o.fn;o.enabled&&$r(i)&&(t.offsets.popper=je(t.offsets.popper),t.offsets.reference=je(t.offsets.reference),t=i(t,o))}),t}function la(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=Gr(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=qr(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=Kr(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=Zr(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function Jr(e,t){return e.some(function(n){var r=n.name,o=n.enabled;return o&&r===t})}function Tn(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),r=0;rs[p]&&(e.offsets.popper[c]+=a[c]+h-s[p]),e.offsets.popper=je(e.offsets.popper);var v=a[c]+a[u]/2-h/2,S=Ye(e.instance.popper),y=parseFloat(S["margin"+f]),m=parseFloat(S["border"+f+"Width"]),E=v-e.offsets.popper[c]-y-m;return E=Math.max(Math.min(s[u]-h,E),0),e.arrowElement=r,e.offsets.arrow=(n={},Qe(n,c,Math.round(E)),Qe(n,d,""),n),e}function Oa(e){return e==="end"?"start":e==="start"?"end":e}var to=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],on=to.slice(3);function sr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=on.indexOf(e),r=on.slice(n+1).concat(on.slice(0,n));return t?r.reverse():r}var sn={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function Sa(e,t){if(Jr(e.instance.modifiers,"inner")||e.flipped&&e.placement===e.originalPlacement)return e;var n=Cn(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),r=e.placement.split("-")[0],o=_t(r),i=e.placement.split("-")[1]||"",s=[];switch(t.behavior){case sn.FLIP:s=[r,o];break;case sn.CLOCKWISE:s=sr(r);break;case sn.COUNTERCLOCKWISE:s=sr(r,!0);break;default:s=t.behavior}return s.forEach(function(a,l){if(r!==a||s.length===l+1)return e;r=e.placement.split("-")[0],o=_t(r);var u=e.offsets.popper,f=e.offsets.reference,c=Math.floor,d=r==="left"&&c(u.right)>c(f.left)||r==="right"&&c(u.left)c(f.top)||r==="bottom"&&c(u.top)c(n.right),v=c(u.top)c(n.bottom),y=r==="left"&&p||r==="right"&&h||r==="top"&&v||r==="bottom"&&S,m=["top","bottom"].indexOf(r)!==-1,E=!!t.flipVariations&&(m&&i==="start"&&p||m&&i==="end"&&h||!m&&i==="start"&&v||!m&&i==="end"&&S),M=!!t.flipVariationsByContent&&(m&&i==="start"&&h||m&&i==="end"&&p||!m&&i==="start"&&S||!m&&i==="end"&&v),C=E||M;(d||y||C)&&(e.flipped=!0,(d||y)&&(r=s[l+1]),C&&(i=Oa(i)),e.placement=r+(i?"-"+i:""),e.offsets.popper=he({},e.offsets.popper,Kr(e.instance.popper,e.offsets.reference,e.placement)),e=Zr(e.instance.modifiers,e,"flip"))}),e}function Ea(e){var t=e.offsets,n=t.popper,r=t.reference,o=e.placement.split("-")[0],i=Math.floor,s=["top","bottom"].indexOf(o)!==-1,a=s?"right":"bottom",l=s?"left":"top",u=s?"width":"height";return n[a]i(r[a])&&(e.offsets.popper[l]=i(r[a])),e}function ka(e,t,n,r){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+o[1],s=o[2];if(!i)return e;if(s.indexOf("%")===0){var a=void 0;switch(s){case"%p":a=n;break;case"%":case"%r":default:a=r}var l=je(a);return l[t]/100*i}else if(s==="vh"||s==="vw"){var u=void 0;return s==="vh"?u=Math.max(document.documentElement.clientHeight,window.innerHeight||0):u=Math.max(document.documentElement.clientWidth,window.innerWidth||0),u/100*i}else return i}function Ca(e,t,n,r){var o=[0,0],i=["right","left"].indexOf(r)!==-1,s=e.split(/(\+|\-)/).map(function(f){return f.trim()}),a=s.indexOf(St(s,function(f){return f.search(/,|\s/)!==-1}));s[a]&&s[a].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,u=a!==-1?[s.slice(0,a).concat([s[a].split(l)[0]]),[s[a].split(l)[1]].concat(s.slice(a+1))]:[s];return u=u.map(function(f,c){var d=(c===1?!i:i)?"height":"width",p=!1;return f.reduce(function(h,v){return h[h.length-1]===""&&["+","-"].indexOf(v)!==-1?(h[h.length-1]=v,p=!0,h):p?(h[h.length-1]+=v,p=!1,h):h.concat(v)},[]).map(function(h){return ka(h,d,t,n)})}),u.forEach(function(f,c){f.forEach(function(d,p){Mn(d)&&(o[c]+=d*(f[p-1]==="-"?-1:1))})}),o}function Ta(e,t){var n=t.offset,r=e.placement,o=e.offsets,i=o.popper,s=o.reference,a=r.split("-")[0],l=void 0;return Mn(+n)?l=[+n,0]:l=Ca(n,i,s,a),a==="left"?(i.top+=l[0],i.left-=l[1]):a==="right"?(i.top+=l[0],i.left+=l[1]):a==="top"?(i.left+=l[0],i.top-=l[1]):a==="bottom"&&(i.left+=l[0],i.top+=l[1]),e.popper=i,e}function Ma(e,t){var n=t.boundariesElement||Je(e.instance.popper);e.instance.reference===n&&(n=Je(n));var r=Tn("transform"),o=e.instance.popper.style,i=o.top,s=o.left,a=o[r];o.top="",o.left="",o[r]="";var l=Cn(e.instance.popper,e.instance.reference,t.padding,n,e.positionFixed);o.top=i,o.left=s,o[r]=a,t.boundaries=l;var u=t.priority,f=e.offsets.popper,c={primary:function(p){var h=f[p];return f[p]l[p]&&!t.escapeWithReference&&(v=Math.min(f[h],l[p]-(p==="right"?f.width:f.height))),Qe({},h,v)}};return u.forEach(function(d){var p=["left","top"].indexOf(d)!==-1?"primary":"secondary";f=he({},f,c[p](d))}),e.offsets.popper=f,e}function Pa(e){var t=e.placement,n=t.split("-")[0],r=t.split("-")[1];if(r){var o=e.offsets,i=o.reference,s=o.popper,a=["bottom","top"].indexOf(n)!==-1,l=a?"left":"top",u=a?"width":"height",f={start:Qe({},l,i[l]),end:Qe({},l,i[l]+i[u]-s[u])};e.offsets.popper=he({},s,f[r])}return e}function xa(e){if(!eo(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=St(e.instance.modifiers,function(r){return r.name==="preventOverflow"}).boundaries;if(t.bottomn.right||t.top>n.bottom||t.right2&&arguments[2]!==void 0?arguments[2]:{};ra(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=ea(this.update.bind(this)),this.options=he({},e.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=t&&t.jquery?t[0]:t,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(he({},e.Defaults.modifiers,o.modifiers)).forEach(function(s){r.options.modifiers[s]=he({},e.Defaults.modifiers[s]||{},o.modifiers?o.modifiers[s]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(s){return he({name:s},r.options.modifiers[s])}).sort(function(s,a){return s.order-a.order}),this.modifiers.forEach(function(s){s.enabled&&$r(s.onLoad)&&s.onLoad(r.reference,r.popper,r.options,s,r.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return oa(e,[{key:"update",value:function(){return la.call(this)}},{key:"destroy",value:function(){return ca.call(this)}},{key:"enableEventListeners",value:function(){return fa.call(this)}},{key:"disableEventListeners",value:function(){return pa.call(this)}}]),e})();yt.Utils=(typeof window<"u"?window:global).PopperUtils;yt.placements=to;yt.Defaults=Ia;var Wa=["innerHTML","ownerDocument","style","attributes","nodeValue"],Ra=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Aa=["bigint","boolean","null","number","string","symbol","undefined"];function Lt(e){var t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(_a(t))return t}function we(e){return function(t){return Lt(t)===e}}function _a(e){return Ra.includes(e)}function rt(e){return function(t){return typeof t===e}}function Fa(e){return Aa.includes(e)}function g(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(g.array(e))return"Array";if(g.plainFunction(e))return"Function";var t=Lt(e);return t||"Object"}g.array=Array.isArray;g.arrayOf=function(e,t){return!g.array(e)&&!g.function(t)?!1:e.every(function(n){return t(n)})};g.asyncGeneratorFunction=function(e){return Lt(e)==="AsyncGeneratorFunction"};g.asyncFunction=we("AsyncFunction");g.bigint=rt("bigint");g.boolean=function(e){return e===!0||e===!1};g.date=we("Date");g.defined=function(e){return!g.undefined(e)};g.domElement=function(e){return g.object(e)&&!g.plainObject(e)&&e.nodeType===1&&g.string(e.nodeName)&&Wa.every(function(t){return t in e})};g.empty=function(e){return g.string(e)&&e.length===0||g.array(e)&&e.length===0||g.object(e)&&!g.map(e)&&!g.set(e)&&Object.keys(e).length===0||g.set(e)&&e.size===0||g.map(e)&&e.size===0};g.error=we("Error");g.function=rt("function");g.generator=function(e){return g.iterable(e)&&g.function(e.next)&&g.function(e.throw)};g.generatorFunction=we("GeneratorFunction");g.instanceOf=function(e,t){return!e||!t?!1:Object.getPrototypeOf(e)===t.prototype};g.iterable=function(e){return!g.nullOrUndefined(e)&&g.function(e[Symbol.iterator])};g.map=we("Map");g.nan=function(e){return Number.isNaN(e)};g.null=function(e){return e===null};g.nullOrUndefined=function(e){return g.null(e)||g.undefined(e)};g.number=function(e){return rt("number")(e)&&!g.nan(e)};g.numericString=function(e){return g.string(e)&&e.length>0&&!Number.isNaN(Number(e))};g.object=function(e){return!g.nullOrUndefined(e)&&(g.function(e)||typeof e=="object")};g.oneOf=function(e,t){return g.array(e)?e.indexOf(t)>-1:!1};g.plainFunction=we("Function");g.plainObject=function(e){if(Lt(e)!=="Object")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};g.primitive=function(e){return g.null(e)||Fa(typeof e)};g.promise=we("Promise");g.propertyOf=function(e,t,n){if(!g.object(e)||!t)return!1;var r=e[t];return g.function(n)?n(r):g.defined(r)};g.regexp=we("RegExp");g.set=we("Set");g.string=rt("string");g.symbol=rt("symbol");g.undefined=rt("undefined");g.weakMap=we("WeakMap");g.weakSet=we("WeakSet");function no(e){return function(t){return typeof t===e}}var ja=no("function"),Ba=function(e){return e===null},ar=function(e){return Object.prototype.toString.call(e).slice(8,-1)==="RegExp"},lr=function(e){return!La(e)&&!Ba(e)&&(ja(e)||typeof e=="object")},La=no("undefined"),vn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function $a(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=n;r--!==0;)if(!ae(e[r],t[r]))return!1;return!0}function Ha(e,t){if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e.buffer),r=new DataView(t.buffer),o=e.byteLength;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function za(e,t){var n,r,o,i;if(e.size!==t.size)return!1;try{for(var s=vn(e.entries()),a=s.next();!a.done;a=s.next()){var l=a.value;if(!t.has(l[0]))return!1}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}try{for(var u=vn(e.entries()),f=u.next();!f.done;f=u.next()){var l=f.value;if(!ae(l[1],t.get(l[0])))return!1}}catch(c){o={error:c}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}return!0}function Ua(e,t){var n,r;if(e.size!==t.size)return!1;try{for(var o=vn(e.entries()),i=o.next();!i.done;i=o.next()){var s=i.value;if(!t.has(s[0]))return!1}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!0}function ae(e,t){if(e===t)return!0;if(e&&lr(e)&&t&&lr(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return $a(e,t);if(e instanceof Map&&t instanceof Map)return za(e,t);if(e instanceof Set&&t instanceof Set)return Ua(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Ha(e,t);if(ar(e)&&ar(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(var o=n.length;o--!==0;){var i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!ae(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}function Ya(){for(var e=[],t=0;tl);return g.undefined(r)||(u=u&&l===r),g.undefined(i)||(u=u&&a===i),u}function ur(e,t,n){var r=n.key,o=n.type,i=n.value,s=Te(e,r),a=Te(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!g.nullOrUndefined(i)){if(g.defined(l)){if(g.array(l)||g.plainObject(l))return qa(l,u,i)}else return ae(u,i);return!1}return[s,a].every(g.array)?!u.every(Pn(l)):[s,a].every(g.plainObject)?Ga(Object.keys(l),Object.keys(u)):![s,a].every(function(f){return g.primitive(f)&&g.defined(f)})&&(o==="added"?!g.defined(s)&&g.defined(a):g.defined(s)&&!g.defined(a))}function fr(e,t,n){var r=n===void 0?{}:n,o=r.key,i=Te(e,o),s=Te(t,o);if(!ro(i,s))throw new TypeError("Inputs have different types");if(!Ya(i,s))throw new TypeError("Inputs don't have length");return[i,s].every(g.plainObject)&&(i=Object.keys(i),s=Object.keys(s)),[i,s]}function dr(e){return function(t){var n=t[0],r=t[1];return g.array(e)?ae(e,r)||e.some(function(o){return ae(o,r)||g.array(r)&&Pn(r)(o)}):g.plainObject(e)&&e[n]?!!e[n]&&ae(e[n],r):ae(e,r)}}function Ga(e,t){return t.some(function(n){return!e.includes(n)})}function pr(e){return function(t){return g.array(e)?e.some(function(n){return ae(n,t)||g.array(t)&&Pn(t)(n)}):ae(e,t)}}function ct(e,t){return g.array(e)?e.some(function(n){return ae(n,t)}):ae(e,t)}function Pn(e){return function(t){return e.some(function(n){return ae(n,t)})}}function ro(){for(var e=[],t=0;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ja(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function oo(e,t){if(e==null)return{};var n=Ja(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xa(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ne(e)}function Tt(e){var t=Za();return function(){var r=Ft(e),o;if(t){var i=Ft(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Xa(this,o)}}function Qa(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function io(e){var t=Qa(e,"string");return typeof t=="symbol"?t:String(t)}var el={flip:{padding:20},preventOverflow:{padding:10}},tl="The typeValidator argument must be a function with the signature function(props, propName, componentName).",nl="The error message is optional, but must be a string if provided.";function rl(e,t,n,r){return typeof e=="boolean"?e:typeof e=="function"?e(t,n,r):e?!!e:!1}function ol(e,t){return Object.hasOwnProperty.call(e,t)}function il(e,t,n,r){return new Error("Required ".concat(e[t]," `").concat(t,"` was not specified in `").concat(n,"`."))}function sl(e,t){if(typeof e!="function")throw new TypeError(tl);if(t&&typeof t!="string")throw new TypeError(nl)}function mr(e,t,n){return sl(e,n),function(r,o,i){for(var s=arguments.length,a=new Array(s>3?s-3:0),l=3;l3&&arguments[3]!==void 0?arguments[3]:!1;e.addEventListener(t,n,r)}function ll(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;e.removeEventListener(t,n,r)}function cl(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o;o=function(s){n(s),ll(e,t,o)},al(e,t,o,r)}function yr(){}var so=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"componentDidMount",value:function(){Ee()&&(this.node||this.appendNode(),ut||this.renderPortal())}},{key:"componentDidUpdate",value:function(){Ee()&&(ut||this.renderPortal())}},{key:"componentWillUnmount",value:function(){!Ee()||!this.node||(ut||Nt.unmountComponentAtNode(this.node),this.node&&this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=void 0))}},{key:"appendNode",value:function(){var o=this.props,i=o.id,s=o.zIndex;this.node||(this.node=document.createElement("div"),i&&(this.node.id=i),s&&(this.node.style.zIndex=s),document.body.appendChild(this.node))}},{key:"renderPortal",value:function(){if(!Ee())return null;var o=this.props,i=o.children,s=o.setRef;if(this.node||this.appendNode(),ut)return Nt.createPortal(i,this.node);var a=Nt.unstable_renderSubtreeIntoContainer(this,i.length>1?w.createElement("div",null,i):i[0],this.node);return s(a),null}},{key:"renderReact16",value:function(){var o=this.props,i=o.hasChildren,s=o.placement,a=o.target;return i?this.renderPortal():a||s==="center"?this.renderPortal():null}},{key:"render",value:function(){return ut?this.renderReact16():null}}]),n})(w.Component);te(so,"propTypes",{children:T.oneOfType([T.element,T.array]),hasChildren:T.bool,id:T.oneOfType([T.string,T.number]),placement:T.string,setRef:T.func.isRequired,target:T.oneOfType([T.object,T.string]),zIndex:T.number});var ao=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"parentStyle",get:function(){var o=this.props,i=o.placement,s=o.styles,a=s.arrow.length,l={pointerEvents:"none",position:"absolute",width:"100%"};return i.startsWith("top")?(l.bottom=0,l.left=0,l.right=0,l.height=a):i.startsWith("bottom")?(l.left=0,l.right=0,l.top=0,l.height=a):i.startsWith("left")?(l.right=0,l.top=0,l.bottom=0):i.startsWith("right")&&(l.left=0,l.top=0),l}},{key:"render",value:function(){var o=this.props,i=o.placement,s=o.setArrowRef,a=o.styles,l=a.arrow,u=l.color,f=l.display,c=l.length,d=l.margin,p=l.position,h=l.spread,v={display:f,position:p},S,y=h,m=c;return i.startsWith("top")?(S="0,0 ".concat(y/2,",").concat(m," ").concat(y,",0"),v.bottom=0,v.marginLeft=d,v.marginRight=d):i.startsWith("bottom")?(S="".concat(y,",").concat(m," ").concat(y/2,",0 0,").concat(m),v.top=0,v.marginLeft=d,v.marginRight=d):i.startsWith("left")?(m=h,y=c,S="0,0 ".concat(y,",").concat(m/2," 0,").concat(m),v.right=0,v.marginTop=d,v.marginBottom=d):i.startsWith("right")&&(m=h,y=c,S="".concat(y,",").concat(m," ").concat(y,",0 0,").concat(m/2),v.left=0,v.marginTop=d,v.marginBottom=d),w.createElement("div",{className:"__floater__arrow",style:this.parentStyle},w.createElement("span",{ref:s,style:v},w.createElement("svg",{width:y,height:m,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},w.createElement("polygon",{points:S,fill:u}))))}}]),n})(w.Component);te(ao,"propTypes",{placement:T.string.isRequired,setArrowRef:T.func.isRequired,styles:T.object.isRequired});var ul=["color","height","width"];function lo(e){var t=e.handleClick,n=e.styles,r=n.color,o=n.height,i=n.width,s=oo(n,ul);return w.createElement("button",{"aria-label":"close",onClick:t,style:s,type:"button"},w.createElement("svg",{width:"".concat(i,"px"),height:"".concat(o,"px"),viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid"},w.createElement("g",null,w.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:r}))))}lo.propTypes={handleClick:T.func.isRequired,styles:T.object.isRequired};function co(e){var t=e.content,n=e.footer,r=e.handleClick,o=e.open,i=e.positionWrapper,s=e.showCloseButton,a=e.title,l=e.styles,u={content:w.isValidElement(t)?t:w.createElement("div",{className:"__floater__content",style:l.content},t)};return a&&(u.title=w.isValidElement(a)?a:w.createElement("div",{className:"__floater__title",style:l.title},a)),n&&(u.footer=w.isValidElement(n)?n:w.createElement("div",{className:"__floater__footer",style:l.footer},n)),(s||i)&&!g.boolean(o)&&(u.close=w.createElement(lo,{styles:l.close,handleClick:r})),w.createElement("div",{className:"__floater__container",style:l.container},u.close,u.title,u.content,u.footer)}co.propTypes={content:T.node.isRequired,footer:T.node,handleClick:T.func.isRequired,open:T.bool,positionWrapper:T.bool.isRequired,showCloseButton:T.bool.isRequired,styles:T.object.isRequired,title:T.node};var uo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"style",get:function(){var o=this.props,i=o.disableAnimation,s=o.component,a=o.placement,l=o.hideArrow,u=o.status,f=o.styles,c=f.arrow.length,d=f.floater,p=f.floaterCentered,h=f.floaterClosing,v=f.floaterOpening,S=f.floaterWithAnimation,y=f.floaterWithComponent,m={};return l||(a.startsWith("top")?m.padding="0 0 ".concat(c,"px"):a.startsWith("bottom")?m.padding="".concat(c,"px 0 0"):a.startsWith("left")?m.padding="0 ".concat(c,"px 0 0"):a.startsWith("right")&&(m.padding="0 0 0 ".concat(c,"px"))),[z.OPENING,z.OPEN].indexOf(u)!==-1&&(m=K(K({},m),v)),u===z.CLOSING&&(m=K(K({},m),h)),u===z.OPEN&&!i&&(m=K(K({},m),S)),a==="center"&&(m=K(K({},m),p)),s&&(m=K(K({},m),y)),K(K({},d),m)}},{key:"render",value:function(){var o=this.props,i=o.component,s=o.handleClick,a=o.hideArrow,l=o.setFloaterRef,u=o.status,f={},c=["__floater"];return i?w.isValidElement(i)?f.content=w.cloneElement(i,{closeFn:s}):f.content=i({closeFn:s}):f.content=w.createElement(co,this.props),u===z.OPEN&&c.push("__floater__open"),a||(f.arrow=w.createElement(ao,this.props)),w.createElement("div",{ref:l,className:c.join(" "),style:this.style},w.createElement("div",{className:"__floater__body"},f.content,f.arrow))}}]),n})(w.Component);te(uo,"propTypes",{component:T.oneOfType([T.func,T.element]),content:T.node,disableAnimation:T.bool.isRequired,footer:T.node,handleClick:T.func.isRequired,hideArrow:T.bool.isRequired,open:T.bool,placement:T.string.isRequired,positionWrapper:T.bool.isRequired,setArrowRef:T.func.isRequired,setFloaterRef:T.func.isRequired,showCloseButton:T.bool,status:T.string.isRequired,styles:T.object.isRequired,title:T.node});var fo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"render",value:function(){var o=this.props,i=o.children,s=o.handleClick,a=o.handleMouseEnter,l=o.handleMouseLeave,u=o.setChildRef,f=o.setWrapperRef,c=o.style,d=o.styles,p;if(i)if(w.Children.count(i)===1)if(!w.isValidElement(i))p=w.createElement("span",null,i);else{var h=g.function(i.type)?"innerRef":"ref";p=w.cloneElement(w.Children.only(i),te({},h,u))}else p=i;return p?w.createElement("span",{ref:f,style:K(K({},d),c),onClick:s,onMouseEnter:a,onMouseLeave:l},p):null}}]),n})(w.Component);te(fo,"propTypes",{children:T.node,handleClick:T.func.isRequired,handleMouseEnter:T.func.isRequired,handleMouseLeave:T.func.isRequired,setChildRef:T.func.isRequired,setWrapperRef:T.func.isRequired,style:T.object,styles:T.object.isRequired});var fl={zIndex:100};function dl(e){var t=ve(fl,e.options||{});return{wrapper:{cursor:"help",display:"inline-flex",flexDirection:"column",zIndex:t.zIndex},wrapperPosition:{left:-1e3,position:"absolute",top:-1e3,visibility:"hidden"},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:300,opacity:0,position:"relative",transition:"opacity 0.3s",visibility:"hidden",zIndex:t.zIndex},floaterOpening:{opacity:1,visibility:"visible"},floaterWithAnimation:{opacity:1,transition:"opacity 0.3s, transform 0.2s",visibility:"visible"},floaterWithComponent:{maxWidth:"100%"},floaterClosing:{opacity:0,visibility:"visible"},floaterCentered:{left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)"},container:{backgroundColor:"#fff",color:"#666",minHeight:60,minWidth:200,padding:20,position:"relative",zIndex:10},title:{borderBottom:"1px solid #555",color:"#555",fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",fontSize:0,height:15,outline:"none",padding:10,position:"absolute",right:0,top:0,width:15,WebkitAppearance:"none"},footer:{borderTop:"1px solid #ccc",fontSize:13,marginTop:10,paddingTop:5},arrow:{color:"#fff",display:"inline-flex",length:16,margin:8,position:"absolute",spread:32},options:t}}var pl=["arrow","flip","offset"],hl=["position","top","right","bottom","left"],xn=(function(e){Ct(n,e);var t=Tt(n);function n(r){var o;return Et(this,n),o=t.call(this,r),te(Ne(o),"setArrowRef",function(i){o.arrowRef=i}),te(Ne(o),"setChildRef",function(i){o.childRef=i}),te(Ne(o),"setFloaterRef",function(i){o.floaterRef=i}),te(Ne(o),"setWrapperRef",function(i){o.wrapperRef=i}),te(Ne(o),"handleTransitionEnd",function(){var i=o.state.status,s=o.props.callback;o.wrapperPopper&&o.wrapperPopper.instance.update(),o.setState({status:i===z.OPENING?z.OPEN:z.IDLE},function(){var a=o.state.status;s(a===z.OPEN?"open":"close",o.props)})}),te(Ne(o),"handleClick",function(){var i=o.props,s=i.event,a=i.open;if(!g.boolean(a)){var l=o.state,u=l.positionWrapper,f=l.status;(o.event==="click"||o.event==="hover"&&u)&&(xt({title:"click",data:[{event:s,status:f===z.OPEN?"closing":"opening"}],debug:o.debug}),o.toggle())}}),te(Ne(o),"handleMouseEnter",function(){var i=o.props,s=i.event,a=i.open;if(!(g.boolean(a)||an())){var l=o.state.status;o.event==="hover"&&l===z.IDLE&&(xt({title:"mouseEnter",data:[{key:"originalEvent",value:s}],debug:o.debug}),clearTimeout(o.eventDelayTimeout),o.toggle())}}),te(Ne(o),"handleMouseLeave",function(){var i=o.props,s=i.event,a=i.eventDelay,l=i.open;if(!(g.boolean(l)||an())){var u=o.state,f=u.status,c=u.positionWrapper;o.event==="hover"&&(xt({title:"mouseLeave",data:[{key:"originalEvent",value:s}],debug:o.debug}),a?[z.OPENING,z.OPEN].indexOf(f)!==-1&&!c&&!o.eventDelayTimeout&&(o.eventDelayTimeout=setTimeout(function(){delete o.eventDelayTimeout,o.toggle()},a*1e3)):o.toggle(z.IDLE))}}),o.state={currentPlacement:r.placement,needsUpdate:!1,positionWrapper:r.wrapperOptions.position&&!!r.target,status:z.INIT,statusWrapper:z.INIT},o._isMounted=!1,o.hasMounted=!1,Ee()&&window.addEventListener("load",function(){o.popper&&o.popper.instance.update(),o.wrapperPopper&&o.wrapperPopper.instance.update()}),o}return kt(n,[{key:"componentDidMount",value:function(){if(Ee()){var o=this.state.positionWrapper,i=this.props,s=i.children,a=i.open,l=i.target;this._isMounted=!0,xt({title:"init",data:{hasChildren:!!s,hasTarget:!!l,isControlled:g.boolean(a),positionWrapper:o,target:this.target,floater:this.floaterRef},debug:this.debug}),this.hasMounted||(this.initPopper(),this.hasMounted=!0),!s&&l&&g.boolean(a)}}},{key:"componentDidUpdate",value:function(o,i){if(Ee()){var s=this.props,a=s.autoOpen,l=s.open,u=s.target,f=s.wrapperOptions,c=Va(i,this.state),d=c.changedFrom,p=c.changed;if(o.open!==l){var h;g.boolean(l)&&(h=l?z.OPENING:z.CLOSING),this.toggle(h)}(o.wrapperOptions.position!==f.position||o.target!==u)&&this.changeWrapperPosition(this.props),p("status",z.IDLE)&&l?this.toggle(z.OPEN):d("status",z.INIT,z.IDLE)&&a&&this.toggle(z.OPEN),this.popper&&p("status",z.OPENING)&&this.popper.instance.update(),this.floaterRef&&(p("status",z.OPENING)||p("status",z.CLOSING))&&cl(this.floaterRef,"transitionend",this.handleTransitionEnd),p("needsUpdate",!0)&&this.rebuildPopper()}}},{key:"componentWillUnmount",value:function(){Ee()&&(this._isMounted=!1,this.popper&&this.popper.instance.destroy(),this.wrapperPopper&&this.wrapperPopper.instance.destroy())}},{key:"initPopper",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.target,s=this.state.positionWrapper,a=this.props,l=a.disableFlip,u=a.getPopper,f=a.hideArrow,c=a.offset,d=a.placement,p=a.wrapperOptions,h=d==="top"||d==="bottom"?"flip":["right","bottom-end","top-end","left","top-start","bottom-start"];if(d==="center")this.setState({status:z.IDLE});else if(i&&this.floaterRef){var v=this.options,S=v.arrow,y=v.flip,m=v.offset,E=oo(v,pl);new yt(i,this.floaterRef,{placement:d,modifiers:K({arrow:K({enabled:!f,element:this.arrowRef},S),flip:K({enabled:!l,behavior:h},y),offset:K({offset:"0, ".concat(c,"px")},m)},E),onCreate:function(O){var D;if(o.popper=O,!((D=o.floaterRef)!==null&&D!==void 0&&D.isConnected)){o.setState({needsUpdate:!0});return}u(O,"floater"),o._isMounted&&o.setState({currentPlacement:O.placement,status:z.IDLE}),d!==O.placement&&setTimeout(function(){O.instance.update()},1)},onUpdate:function(O){o.popper=O;var D=o.state.currentPlacement;o._isMounted&&O.placement!==D&&o.setState({currentPlacement:O.placement})}})}if(s){var M=g.undefined(p.offset)?0:p.offset;new yt(this.target,this.wrapperRef,{placement:p.placement||d,modifiers:{arrow:{enabled:!1},offset:{offset:"0, ".concat(M,"px")},flip:{enabled:!1}},onCreate:function(O){o.wrapperPopper=O,o._isMounted&&o.setState({statusWrapper:z.IDLE}),u(O,"wrapper"),d!==O.placement&&setTimeout(function(){O.instance.update()},1)}})}}},{key:"rebuildPopper",value:function(){var o=this;this.floaterRefInterval=setInterval(function(){var i;(i=o.floaterRef)!==null&&i!==void 0&&i.isConnected&&(clearInterval(o.floaterRefInterval),o.setState({needsUpdate:!1}),o.initPopper())},50)}},{key:"changeWrapperPosition",value:function(o){var i=o.target,s=o.wrapperOptions;this.setState({positionWrapper:s.position&&!!i})}},{key:"toggle",value:function(o){var i=this.state.status,s=i===z.OPEN?z.CLOSING:z.OPENING;g.undefined(o)||(s=o),this.setState({status:s})}},{key:"debug",get:function(){var o=this.props.debug;return o||Ee()&&"ReactFloaterDebug"in window&&!!window.ReactFloaterDebug}},{key:"event",get:function(){var o=this.props,i=o.disableHoverToClick,s=o.event;return s==="hover"&&an()&&!i?"click":s}},{key:"options",get:function(){var o=this.props.options;return ve(el,o||{})}},{key:"styles",get:function(){var o=this,i=this.state,s=i.status,a=i.positionWrapper,l=i.statusWrapper,u=this.props.styles,f=ve(dl(u),u);if(a){var c;[z.IDLE].indexOf(s)===-1||[z.IDLE].indexOf(l)===-1?c=f.wrapperPosition:c=this.wrapperPopper.styles,f.wrapper=K(K({},f.wrapper),c)}if(this.target){var d=window.getComputedStyle(this.target);this.wrapperStyles?f.wrapper=K(K({},f.wrapper),this.wrapperStyles):["relative","static"].indexOf(d.position)===-1&&(this.wrapperStyles={},a||(hl.forEach(function(p){o.wrapperStyles[p]=d[p]}),f.wrapper=K(K({},f.wrapper),this.wrapperStyles),this.target.style.position="relative",this.target.style.top="auto",this.target.style.right="auto",this.target.style.bottom="auto",this.target.style.left="auto"))}return f}},{key:"target",get:function(){if(!Ee())return null;var o=this.props.target;return o?g.domElement(o)?o:document.querySelector(o):this.childRef||this.wrapperRef}},{key:"render",value:function(){var o=this.state,i=o.currentPlacement,s=o.positionWrapper,a=o.status,l=this.props,u=l.children,f=l.component,c=l.content,d=l.disableAnimation,p=l.footer,h=l.hideArrow,v=l.id,S=l.open,y=l.showCloseButton,m=l.style,E=l.target,M=l.title,C=w.createElement(fo,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:m,styles:this.styles.wrapper},u),O={};return s?O.wrapperInPortal=C:O.wrapperAsChildren=C,w.createElement("span",null,w.createElement(so,{hasChildren:!!u,id:v,placement:i,setRef:this.setFloaterRef,target:E,zIndex:this.styles.options.zIndex},w.createElement(uo,{component:f,content:c,disableAnimation:d,footer:p,handleClick:this.handleClick,hideArrow:h||i==="center",open:S,placement:i,positionWrapper:s,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:y,status:a,styles:this.styles,title:M}),O.wrapperInPortal),O.wrapperAsChildren)}}]),n})(w.Component);te(xn,"propTypes",{autoOpen:T.bool,callback:T.func,children:T.node,component:mr(T.oneOfType([T.func,T.element]),function(e){return!e.content}),content:mr(T.node,function(e){return!e.component}),debug:T.bool,disableAnimation:T.bool,disableFlip:T.bool,disableHoverToClick:T.bool,event:T.oneOf(["hover","click"]),eventDelay:T.number,footer:T.node,getPopper:T.func,hideArrow:T.bool,id:T.oneOfType([T.string,T.number]),offset:T.number,open:T.bool,options:T.object,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto","center"]),showCloseButton:T.bool,style:T.object,styles:T.object,target:T.oneOfType([T.object,T.string]),title:T.node,wrapperOptions:T.shape({offset:T.number,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto"]),position:T.bool})});te(xn,"defaultProps",{autoOpen:!1,callback:yr,debug:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:"click",eventDelay:.4,getPopper:yr,hideArrow:!1,offset:15,placement:"bottom",showCloseButton:!1,styles:{},target:null,wrapperOptions:{position:!1}});var ml=Object.defineProperty,yl=(e,t,n)=>t in e?ml(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t,n)=>yl(e,typeof t!="symbol"?t+"":t,n),q={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update"},ye={TOUR_START:"tour:start",STEP_BEFORE:"step:before",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found"},A={INIT:"init",READY:"ready",BEACON:"beacon",TOOLTIP:"tooltip",COMPLETE:"complete",ERROR:"error"},L={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"};function _e(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function po(e){return e?e.getBoundingClientRect():null}function vl(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,s)=>i-s),o=Math.floor(r.length/2);return r.length%2===0?(r[o-1]+r[o])/2:r[o]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function De(e){if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function gl(e){return!e||e.nodeType!==1?null:getComputedStyle(e)}function vt(e,t,n){if(!e)return $e();const r=Lr(e);if(r){if(r.isSameNode($e()))return n?document:$e();if(!(r.scrollHeight>r.offsetHeight)&&!t)return r.style.overflow="initial",$e()}return r}function $t(e,t){if(!e)return!1;const n=vt(e,t);return n?!n.isSameNode($e()):!1}function bl(e){return e.offsetParent!==document.body}function et(e,t="fixed"){if(!e||!(e instanceof HTMLElement))return!1;const{nodeName:n}=e,r=gl(e);return n==="BODY"||n==="HTML"?!1:r&&r.position===t?!0:e.parentNode?et(e.parentNode,t):!1}function wl(e){var t;if(!e)return!1;let n=e;for(;n&&n!==document.body;){if(n instanceof HTMLElement){const{display:r,visibility:o}=getComputedStyle(n);if(r==="none"||o==="hidden")return!1}n=(t=n.parentElement)!=null?t:null}return!0}function Ol(e,t,n){var r,o,i;const s=po(e),a=vt(e,n),l=$t(e,n),u=et(e);let f=0,c=(r=s?.top)!=null?r:0;if(l&&u){const d=(o=e?.offsetTop)!=null?o:0,p=(i=a?.scrollTop)!=null?i:0;c=d-p}else a instanceof HTMLElement&&(f=a.scrollTop,!l&&!et(e)&&(c+=f),a.isSameNode($e())||(c+=$e().scrollTop));return Math.floor(c-t)}function Sl(e,t,n){var r;if(!e)return 0;const{offsetTop:o=0,scrollTop:i=0}=(r=Lr(e))!=null?r:{};let s=e.getBoundingClientRect().top+i;o&&($t(e,n)||bl(e))&&(s-=o);const a=Math.floor(s-t);return a<0?0:a}function $e(){var e;return(e=document.scrollingElement)!=null?e:document.documentElement}function El(e,t){const{duration:n,element:r}=t;return new Promise((o,i)=>{const{scrollTop:s}=r,a=e>s?e-s:s-e;js.top(r,e,{duration:a<100?50:n},l=>l&&l.message!=="Element already at target scroll position"?i(l):o())})}var ft=Dt.createPortal!==void 0;function ho(e=navigator.userAgent){let t=e;return typeof window>"u"?t="node":document.documentMode?t="ie":/Edge/.test(e)?t="edge":window.opera||e.includes(" OPR/")?t="opera":typeof window.InstallTrigger<"u"?t="firefox":window.chrome?t="chrome":/(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(e)&&(t="safari"),t}function Wt(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function ke(e,t={}){const{defaultValue:n,step:r,steps:o}=t;let i=Jn(e);if(i)(i.includes("{step}")||i.includes("{steps}"))&&r&&o&&(i=i.replace("{step}",r.toString()).replace("{steps}",o.toString()));else if(b.isValidElement(e)&&!Object.values(e.props).length&&Wt(e.type)==="function"){const s=e.type({});i=ke(s,t)}else i=Jn(n);return i}function kl(e,t){return!x.plainObject(e)||!x.array(t)?!1:Object.keys(e).every(n=>t.includes(n))}function Cl(e){const t=/^#?([\da-f])([\da-f])([\da-f])$/i,n=e.replace(t,(o,i,s,a)=>i+i+s+s+a+a),r=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(n);return r?[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]:[]}function vr(e){return e.disableBeacon||e.placement==="center"}function gr(){return!["chrome","safari","firefox","opera"].includes(ho())}function Ue({data:e,debug:t=!1,title:n,warn:r=!1}){const o=r?console.warn||console.error:console.log;t&&(n&&e?(console.groupCollapsed(`%creact-joyride: ${n}`,"color: #ff0044; font-weight: bold; font-size: 12px;"),Array.isArray(e)?e.forEach(i=>{x.plainObject(i)&&i.key?o.apply(console,[i.key,i.value]):o.apply(console,[i])}):o.apply(console,[e]),console.groupEnd()):console.error("Missing title or data props"))}function Tl(e){return Object.keys(e)}function mo(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function Ml(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function bn(e,t,n){const r=i=>i.replace("{step}",String(t)).replace("{steps}",String(n));if(Wt(e)==="string")return r(e);if(!b.isValidElement(e))return e;const{children:o}=e.props;if(Wt(o)==="string"&&o.includes("{step}"))return b.cloneElement(e,{children:r(o)});if(Array.isArray(o))return b.cloneElement(e,{children:o.map(i=>typeof i=="string"?r(i):bn(i,t,n))});if(Wt(e.type)==="function"&&!Object.values(e.props).length){const i=e.type({});return bn(i,t,n)}return e}function Pl(e){const{isFirstStep:t,lifecycle:n,previousLifecycle:r,scrollToFirstStep:o,step:i,target:s}=e;return!i.disableScrolling&&(!t||o||n===A.TOOLTIP)&&i.placement!=="center"&&(!i.isFixed||!et(s))&&r!==n&&[A.BEACON,A.TOOLTIP].includes(n)}var xl={options:{preventOverflow:{boundariesElement:"scrollParent"}},wrapperOptions:{offset:-18,position:!0}},yo={back:"Back",close:"Close",last:"Last",next:"Next",nextLabelWithProgress:"Next (Step {step} of {steps})",open:"Open the dialog",skip:"Skip"},Nl={event:"click",placement:"bottom",offset:10,disableBeacon:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrollParentFix:!1,disableScrolling:!1,hideBackButton:!1,hideCloseButton:!1,hideFooter:!1,isFixed:!1,locale:yo,showProgress:!1,showSkipButton:!1,spotlightClicks:!1,spotlightPadding:10},Dl={continuous:!1,debug:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrolling:!1,disableScrollParentFix:!1,getHelpers:void 0,hideBackButton:!1,run:!0,scrollOffset:20,scrollDuration:300,scrollToFirstStep:!1,showSkipButton:!1,showProgress:!1,spotlightClicks:!1,spotlightPadding:10,steps:[]},Il={arrowColor:"#fff",backgroundColor:"#fff",beaconSize:36,overlayColor:"rgba(0, 0, 0, 0.5)",primaryColor:"#f04",spotlightShadow:"0 0 15px rgba(0, 0, 0, 0.5)",textColor:"#333",width:380,zIndex:100},dt={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",cursor:"pointer",fontSize:16,lineHeight:1,padding:8,WebkitAppearance:"none"},br={borderRadius:4,position:"absolute"};function Wl(e,t){var n,r,o,i,s;const{floaterProps:a,styles:l}=e,u=ve((n=t.floaterProps)!=null?n:{},a??{}),f=ve(l??{},(r=t.styles)!=null?r:{}),c=ve(Il,f.options||{}),d=t.placement==="center"||t.disableBeacon;let{width:p}=c;window.innerWidth>480&&(p=380),"width"in c&&(p=typeof c.width=="number"&&window.innerWidthvo(n,t)):(Ue({title:"validateSteps",data:"steps must be an array",warn:!0,debug:t}),!1)}var go={action:"init",controlled:!1,index:0,lifecycle:A.INIT,origin:null,size:0,status:L.IDLE},Or=Tl(mo(go,"controlled","size")),Al=class{constructor(e){N(this,"beaconPopper"),N(this,"tooltipPopper"),N(this,"data",new Map),N(this,"listener"),N(this,"store",new Map),N(this,"addListener",o=>{this.listener=o}),N(this,"setSteps",o=>{const{size:i,status:s}=this.getState(),a={size:o.length,status:s};this.data.set("steps",o),s===L.WAITING&&!i&&o.length&&(a.status=L.RUNNING),this.setState(a)}),N(this,"getPopper",o=>o==="beacon"?this.beaconPopper:this.tooltipPopper),N(this,"setPopper",(o,i)=>{o==="beacon"?this.beaconPopper=i:this.tooltipPopper=i}),N(this,"cleanupPoppers",()=>{this.beaconPopper=null,this.tooltipPopper=null}),N(this,"close",(o=null)=>{const{index:i,status:s}=this.getState();s===L.RUNNING&&this.setState({...this.getNextState({action:q.CLOSE,index:i+1,origin:o})})}),N(this,"go",o=>{const{controlled:i,status:s}=this.getState();if(i||s!==L.RUNNING)return;const a=this.getSteps()[o];this.setState({...this.getNextState({action:q.GO,index:o}),status:a?s:L.FINISHED})}),N(this,"info",()=>this.getState()),N(this,"next",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState(this.getNextState({action:q.NEXT,index:o+1}))}),N(this,"open",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({...this.getNextState({action:q.UPDATE,lifecycle:A.TOOLTIP})})}),N(this,"prev",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState({...this.getNextState({action:q.PREV,index:o-1})})}),N(this,"reset",(o=!1)=>{const{controlled:i}=this.getState();i||this.setState({...this.getNextState({action:q.RESET,index:0}),status:o?L.RUNNING:L.READY})}),N(this,"skip",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({action:q.SKIP,lifecycle:A.INIT,status:L.SKIPPED})}),N(this,"start",o=>{const{index:i,size:s}=this.getState();this.setState({...this.getNextState({action:q.START,index:x.number(o)?o:i},!0),status:s?L.RUNNING:L.WAITING})}),N(this,"stop",(o=!1)=>{const{index:i,status:s}=this.getState();[L.FINISHED,L.SKIPPED].includes(s)||this.setState({...this.getNextState({action:q.STOP,index:i+(o?1:0)}),status:L.PAUSED})}),N(this,"update",o=>{var i,s;if(!kl(o,Or))throw new Error(`State is not valid. Valid keys: ${Or.join(", ")}`);this.setState({...this.getNextState({...this.getState(),...o,action:(i=o.action)!=null?i:q.UPDATE,origin:(s=o.origin)!=null?s:null},!0)})});const{continuous:t=!1,stepIndex:n,steps:r=[]}=e??{};this.setState({action:q.INIT,controlled:x.number(n),continuous:t,index:x.number(n)?n:0,lifecycle:A.INIT,origin:null,status:r.length?L.READY:L.IDLE},!0),this.beaconPopper=null,this.tooltipPopper=null,this.listener=null,this.setSteps(r)}getState(){return this.store.size?{action:this.store.get("action")||"",controlled:this.store.get("controlled")||!1,index:parseInt(this.store.get("index"),10),lifecycle:this.store.get("lifecycle")||"",origin:this.store.get("origin")||null,size:this.store.get("size")||0,status:this.store.get("status")||""}:{...go}}getNextState(e,t=!1){var n,r,o,i,s;const{action:a,controlled:l,index:u,size:f,status:c}=this.getState(),d=x.number(e.index)?e.index:u,p=l&&!t?u:Math.min(Math.max(d,0),f);return{action:(n=e.action)!=null?n:a,controlled:l,index:p,lifecycle:(r=e.lifecycle)!=null?r:A.INIT,origin:(o=e.origin)!=null?o:null,size:(i=e.size)!=null?i:f,status:p===f?L.FINISHED:(s=e.status)!=null?s:c}}getSteps(){const e=this.data.get("steps");return Array.isArray(e)?e:[]}hasUpdatedState(e){const t=JSON.stringify(e),n=JSON.stringify(this.getState());return t!==n}setState(e,t=!1){const n=this.getState(),{action:r,index:o,lifecycle:i,origin:s=null,size:a,status:l}={...n,...e};this.store.set("action",r),this.store.set("index",o),this.store.set("lifecycle",i),this.store.set("origin",s),this.store.set("size",a),this.store.set("status",l),t&&(this.store.set("controlled",e.controlled),this.store.set("continuous",e.continuous)),this.listener&&this.hasUpdatedState(n)&&this.listener(this.getState())}getHelpers(){return{close:this.close,go:this.go,info:this.info,next:this.next,open:this.open,prev:this.prev,reset:this.reset,skip:this.skip}}};function _l(e){return new Al(e)}function Fl({styles:e}){return b.createElement("div",{key:"JoyrideSpotlight",className:"react-joyride__spotlight","data-test-id":"spotlight",style:e})}var jl=Fl,Bl=class extends b.Component{constructor(){super(...arguments),N(this,"isActive",!1),N(this,"resizeTimeout"),N(this,"scrollTimeout"),N(this,"scrollParent"),N(this,"state",{isScrolling:!1,mouseOverSpotlight:!1,showSpotlight:!0}),N(this,"hideSpotlight",()=>{const{continuous:e,disableOverlay:t,lifecycle:n}=this.props,r=[A.INIT,A.BEACON,A.COMPLETE,A.ERROR];return t||(e?r.includes(n):n!==A.TOOLTIP)}),N(this,"handleMouseMove",e=>{const{mouseOverSpotlight:t}=this.state,{height:n,left:r,position:o,top:i,width:s}=this.spotlightStyles,a=o==="fixed"?e.clientY:e.pageY,l=o==="fixed"?e.clientX:e.pageX,u=a>=i&&a<=i+n,c=l>=r&&l<=r+s&&u;c!==t&&this.updateState({mouseOverSpotlight:c})}),N(this,"handleScroll",()=>{const{target:e}=this.props,t=De(e);if(this.scrollParent!==document){const{isScrolling:n}=this.state;n||this.updateState({isScrolling:!0,showSpotlight:!1}),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateState({isScrolling:!1,showSpotlight:!0})},50)}else et(t,"sticky")&&this.updateState({})}),N(this,"handleResize",()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.isActive&&this.forceUpdate()},100)})}componentDidMount(){const{debug:e,disableScrolling:t,disableScrollParentFix:n=!1,target:r}=this.props,o=De(r);this.scrollParent=vt(o??document.body,n,!0),this.isActive=!0,window.addEventListener("resize",this.handleResize)}componentDidUpdate(e){var t;const{disableScrollParentFix:n,lifecycle:r,spotlightClicks:o,target:i}=this.props,{changed:s}=Rt(e,this.props);if(s("target")||s("disableScrollParentFix")){const a=De(i);this.scrollParent=vt(a??document.body,n,!0)}s("lifecycle",A.TOOLTIP)&&((t=this.scrollParent)==null||t.addEventListener("scroll",this.handleScroll,{passive:!0}),setTimeout(()=>{const{isScrolling:a}=this.state;a||this.updateState({showSpotlight:!0})},100)),(s("spotlightClicks")||s("disableOverlay")||s("lifecycle"))&&(o&&r===A.TOOLTIP?window.addEventListener("mousemove",this.handleMouseMove,!1):r!==A.TOOLTIP&&window.removeEventListener("mousemove",this.handleMouseMove))}componentWillUnmount(){var e;this.isActive=!1,window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimeout),clearTimeout(this.scrollTimeout),(e=this.scrollParent)==null||e.removeEventListener("scroll",this.handleScroll)}get overlayStyles(){const{mouseOverSpotlight:e}=this.state,{disableOverlayClose:t,placement:n,styles:r}=this.props;let o=r.overlay;return gr()&&(o=n==="center"?r.overlayLegacyCenter:r.overlayLegacy),{cursor:t?"default":"pointer",height:vl(),pointerEvents:e?"none":"auto",...o}}get spotlightStyles(){var e,t,n;const{showSpotlight:r}=this.state,{disableScrollParentFix:o=!1,spotlightClicks:i,spotlightPadding:s=0,styles:a,target:l}=this.props,u=De(l),f=po(u),c=et(u),d=Ol(u,s,o);return{...gr()?a.spotlightLegacy:a.spotlight,height:Math.round(((e=f?.height)!=null?e:0)+s*2),left:Math.round(((t=f?.left)!=null?t:0)-s),opacity:r?1:0,pointerEvents:i?"none":"auto",position:c?"fixed":"absolute",top:d,transition:"opacity 0.2s",width:Math.round(((n=f?.width)!=null?n:0)+s*2)}}updateState(e){this.isActive&&this.setState(t=>({...t,...e}))}render(){const{showSpotlight:e}=this.state,{onClickOverlay:t,placement:n}=this.props,{hideSpotlight:r,overlayStyles:o,spotlightStyles:i}=this;if(r())return null;let s=n!=="center"&&e&&b.createElement(jl,{styles:i});if(ho()==="safari"){const{mixBlendMode:a,zIndex:l,...u}=o;s=b.createElement("div",{style:{...u}},s),delete o.backgroundColor}return b.createElement("div",{className:"react-joyride__overlay","data-test-id":"overlay",onClick:t,role:"presentation",style:o},s)}},Ll=class extends b.Component{constructor(){super(...arguments),N(this,"node",null)}componentDidMount(){const{id:e}=this.props;_e()&&(this.node=document.createElement("div"),this.node.id=e,document.body.appendChild(this.node),ft||this.renderReact15())}componentDidUpdate(){_e()&&(ft||this.renderReact15())}componentWillUnmount(){!_e()||!this.node||(ft||Dt.unmountComponentAtNode(this.node),this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=null))}renderReact15(){if(!_e())return;const{children:e}=this.props;this.node&&Dt.unstable_renderSubtreeIntoContainer(this,e,this.node)}renderReact16(){if(!_e()||!ft)return null;const{children:e}=this.props;return this.node?Dt.createPortal(e,this.node):null}render(){return ft?this.renderReact16():null}},$l=class{constructor(e,t){if(N(this,"element"),N(this,"options"),N(this,"canBeTabbed",n=>{const{tabIndex:r}=n;return r===null||r<0?!1:this.canHaveFocus(n)}),N(this,"canHaveFocus",n=>{const r=/input|select|textarea|button|object/,o=n.nodeName.toLowerCase();return(r.test(o)&&!n.getAttribute("disabled")||o==="a"&&!!n.getAttribute("href"))&&this.isVisible(n)}),N(this,"findValidTabElements",()=>[].slice.call(this.element.querySelectorAll("*"),0).filter(this.canBeTabbed)),N(this,"handleKeyDown",n=>{const{code:r="Tab"}=this.options;n.code===r&&this.interceptTab(n)}),N(this,"interceptTab",n=>{n.preventDefault();const r=this.findValidTabElements(),{shiftKey:o}=n;if(!r.length)return;let i=document.activeElement?r.indexOf(document.activeElement):0;i===-1||!o&&i+1===r.length?i=0:o&&i===0?i=r.length-1:i+=o?-1:1,r[i].focus()}),N(this,"isHidden",n=>{const r=n.offsetWidth<=0&&n.offsetHeight<=0,o=window.getComputedStyle(n);return r&&!n.innerHTML?!0:r&&o.getPropertyValue("overflow")!=="visible"||o.getPropertyValue("display")==="none"}),N(this,"isVisible",n=>{let r=n;for(;r;)if(r instanceof HTMLElement){if(r===document.body)break;if(this.isHidden(r))return!1;r=r.parentNode}return!0}),N(this,"removeScope",()=>{window.removeEventListener("keydown",this.handleKeyDown)}),N(this,"checkFocus",n=>{document.activeElement!==n&&(n.focus(),window.requestAnimationFrame(()=>this.checkFocus(n)))}),N(this,"setFocus",()=>{const{selector:n}=this.options;if(!n)return;const r=this.element.querySelector(n);r&&window.requestAnimationFrame(()=>this.checkFocus(r))}),!(e instanceof HTMLElement))throw new TypeError("Invalid parameter: element must be an HTMLElement");this.element=e,this.options=t,window.addEventListener("keydown",this.handleKeyDown,!1),this.setFocus()}},Hl=class extends b.Component{constructor(e){if(super(e),N(this,"beacon",null),N(this,"setBeaconRef",o=>{this.beacon=o}),e.beaconComponent)return;const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="joyride-beacon-animation",e.nonce&&n.setAttribute("nonce",e.nonce),n.appendChild(document.createTextNode(` + @keyframes joyride-beacon-inner { + 20% { + opacity: 0.9; + } + + 90% { + opacity: 0.7; + } + } + + @keyframes joyride-beacon-outer { + 0% { + transform: scale(1); + } + + 45% { + opacity: 0.7; + transform: scale(0.75); + } + + 100% { + opacity: 0.9; + transform: scale(1); + } + } + `)),t.appendChild(n)}componentDidMount(){const{shouldFocus:e}=this.props;setTimeout(()=>{x.domElement(this.beacon)&&e&&this.beacon.focus()},0)}componentWillUnmount(){const e=document.getElementById("joyride-beacon-animation");e?.parentNode&&e.parentNode.removeChild(e)}render(){const{beaconComponent:e,continuous:t,index:n,isLastStep:r,locale:o,onClickOrHover:i,size:s,step:a,styles:l}=this.props,u=ke(o.open),f={"aria-label":u,onClick:i,onMouseEnter:i,ref:this.setBeaconRef,title:u};let c;if(e){const d=e;c=b.createElement(d,{continuous:t,index:n,isLastStep:r,size:s,step:a,...f})}else c=b.createElement("button",{key:"JoyrideBeacon",className:"react-joyride__beacon","data-test-id":"button-beacon",style:l.beacon,type:"button",...f},b.createElement("span",{style:l.beaconInner}),b.createElement("span",{style:l.beaconOuter}));return c}};function zl({styles:e,...t}){const{color:n,height:r,width:o,...i}=e;return w.createElement("button",{style:i,type:"button",...t},w.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof o=="number"?`${o}px`:o,xmlns:"http://www.w3.org/2000/svg"},w.createElement("g",null,w.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:n}))))}var Ul=zl;function Yl(e){const{backProps:t,closeProps:n,index:r,isLastStep:o,primaryProps:i,skipProps:s,step:a,tooltipProps:l}=e,{content:u,hideBackButton:f,hideCloseButton:c,hideFooter:d,showSkipButton:p,styles:h,title:v}=a,S={};return S.primary=b.createElement("button",{"data-test-id":"button-primary",style:h.buttonNext,type:"button",...i}),p&&!o&&(S.skip=b.createElement("button",{"aria-live":"off","data-test-id":"button-skip",style:h.buttonSkip,type:"button",...s})),!f&&r>0&&(S.back=b.createElement("button",{"data-test-id":"button-back",style:h.buttonBack,type:"button",...t})),S.close=!c&&b.createElement(Ul,{"data-test-id":"button-close",styles:h.buttonClose,...n}),b.createElement("div",{key:"JoyrideTooltip","aria-label":ke(v??u),className:"react-joyride__tooltip",style:h.tooltip,...l},b.createElement("div",{style:h.tooltipContainer},v&&b.createElement("h1",{"aria-label":ke(v),style:h.tooltipTitle},v),b.createElement("div",{style:h.tooltipContent},u)),!d&&b.createElement("div",{style:h.tooltipFooter},b.createElement("div",{style:h.tooltipFooterSpacer},S.skip),S.back,S.primary),S.close)}var ql=Yl,Gl=class extends b.Component{constructor(){super(...arguments),N(this,"handleClickBack",e=>{e.preventDefault();const{helpers:t}=this.props;t.prev()}),N(this,"handleClickClose",e=>{e.preventDefault();const{helpers:t}=this.props;t.close("button_close")}),N(this,"handleClickPrimary",e=>{e.preventDefault();const{continuous:t,helpers:n}=this.props;if(!t){n.close("button_primary");return}n.next()}),N(this,"handleClickSkip",e=>{e.preventDefault();const{helpers:t}=this.props;t.skip()}),N(this,"getElementsProps",()=>{const{continuous:e,index:t,isLastStep:n,setTooltipRef:r,size:o,step:i}=this.props,{back:s,close:a,last:l,next:u,nextLabelWithProgress:f,skip:c}=i.locale,d=ke(s),p=ke(a),h=ke(l),v=ke(u),S=ke(c);let y=a,m=p;if(e){if(y=u,m=v,i.showProgress&&!n){const E=ke(f,{step:t+1,steps:o});y=bn(f,t+1,o),m=E}n&&(y=l,m=h)}return{backProps:{"aria-label":d,children:s,"data-action":"back",onClick:this.handleClickBack,role:"button",title:d},closeProps:{"aria-label":p,children:a,"data-action":"close",onClick:this.handleClickClose,role:"button",title:p},primaryProps:{"aria-label":m,children:y,"data-action":"primary",onClick:this.handleClickPrimary,role:"button",title:m},skipProps:{"aria-label":S,children:c,"data-action":"skip",onClick:this.handleClickSkip,role:"button",title:S},tooltipProps:{"aria-modal":!0,ref:r,role:"alertdialog"}}})}render(){const{continuous:e,index:t,isLastStep:n,setTooltipRef:r,size:o,step:i}=this.props,{beaconComponent:s,tooltipComponent:a,...l}=i;let u;if(a){const f={...this.getElementsProps(),continuous:e,index:t,isLastStep:n,size:o,step:l,setTooltipRef:r},c=a;u=b.createElement(c,{...f})}else u=b.createElement(ql,{...this.getElementsProps(),continuous:e,index:t,isLastStep:n,size:o,step:i});return u}},Vl=class extends b.Component{constructor(){super(...arguments),N(this,"scope",null),N(this,"tooltip",null),N(this,"handleClickHoverBeacon",e=>{const{step:t,store:n}=this.props;e.type==="mouseenter"&&t.event!=="hover"||n.update({lifecycle:A.TOOLTIP})}),N(this,"setTooltipRef",e=>{this.tooltip=e}),N(this,"setPopper",(e,t)=>{var n;const{action:r,lifecycle:o,step:i,store:s}=this.props;t==="wrapper"?s.setPopper("beacon",e):s.setPopper("tooltip",e),s.getPopper("beacon")&&(s.getPopper("tooltip")||i.placement==="center")&&o===A.INIT&&s.update({action:r,lifecycle:A.READY}),(n=i.floaterProps)!=null&&n.getPopper&&i.floaterProps.getPopper(e,t)}),N(this,"renderTooltip",e=>{const{continuous:t,helpers:n,index:r,size:o,step:i}=this.props;return b.createElement(Gl,{continuous:t,helpers:n,index:r,isLastStep:r+1===o,setTooltipRef:this.setTooltipRef,size:o,step:i,...e})})}componentDidMount(){const{debug:e,index:t}=this.props;Ue({title:`step:${t}`,data:[{key:"props",value:this.props}],debug:e})}componentDidUpdate(e){var t;const{action:n,callback:r,continuous:o,controlled:i,debug:s,helpers:a,index:l,lifecycle:u,shouldScroll:f,status:c,step:d,store:p}=this.props,{changed:h,changedFrom:v}=Rt(e,this.props),S=a.info(),y=o&&n!==q.CLOSE&&(l>0||n===q.PREV),m=h("action")||h("index")||h("lifecycle")||h("status"),E=v("lifecycle",[A.TOOLTIP,A.INIT],A.INIT),M=h("action",[q.NEXT,q.PREV,q.SKIP,q.CLOSE]),C=i&&l===e.index;if(M&&(E||C)&&r({...S,index:e.index,lifecycle:A.COMPLETE,step:e.step,type:ye.STEP_AFTER}),d.placement==="center"&&c===L.RUNNING&&h("index")&&n!==q.START&&u===A.INIT&&p.update({lifecycle:A.READY}),m){const O=De(d.target),D=!!O;D&&wl(O)?(v("status",L.READY,L.RUNNING)||v("lifecycle",A.INIT,A.READY))&&r({...S,step:d,type:ye.STEP_BEFORE}):(console.warn(D?"Target not visible":"Target not mounted",d),r({...S,type:ye.TARGET_NOT_FOUND,step:d}),i||p.update({index:l+(n===q.PREV?-1:1)}))}v("lifecycle",A.INIT,A.READY)&&p.update({lifecycle:vr(d)||y?A.TOOLTIP:A.BEACON}),h("index")&&Ue({title:`step:${u}`,data:[{key:"props",value:this.props}],debug:s}),h("lifecycle",A.BEACON)&&r({...S,step:d,type:ye.BEACON}),h("lifecycle",A.TOOLTIP)&&(r({...S,step:d,type:ye.TOOLTIP}),f&&this.tooltip&&(this.scope=new $l(this.tooltip,{selector:"[data-action=primary]"}),this.scope.setFocus())),v("lifecycle",[A.TOOLTIP,A.INIT],A.INIT)&&((t=this.scope)==null||t.removeScope(),p.cleanupPoppers())}componentWillUnmount(){var e;(e=this.scope)==null||e.removeScope()}get open(){const{lifecycle:e,step:t}=this.props;return vr(t)||e===A.TOOLTIP}render(){const{continuous:e,debug:t,index:n,nonce:r,shouldScroll:o,size:i,step:s}=this.props,a=De(s.target);return!vo(s)||!x.domElement(a)?null:b.createElement("div",{key:`JoyrideStep-${n}`,className:"react-joyride__step"},b.createElement(xn,{...s.floaterProps,component:this.renderTooltip,debug:t,getPopper:this.setPopper,id:`react-joyride-step-${n}`,open:this.open,placement:s.placement,target:s.target},b.createElement(Hl,{beaconComponent:s.beaconComponent,continuous:e,index:n,isLastStep:n+1===i,locale:s.locale,nonce:r,onClickOrHover:this.handleClickHoverBeacon,shouldFocus:o,size:i,step:s,styles:s.styles})))}},bo=class extends b.Component{constructor(e){super(e),N(this,"helpers"),N(this,"store"),N(this,"callback",s=>{const{callback:a}=this.props;x.function(a)&&a(s)}),N(this,"handleKeyboard",s=>{const{index:a,lifecycle:l}=this.state,{steps:u}=this.props,f=u[a];l===A.TOOLTIP&&s.code==="Escape"&&f&&!f.disableCloseOnEsc&&this.store.close("keyboard")}),N(this,"handleClickOverlay",()=>{const{index:s}=this.state,{steps:a}=this.props;Ge(this.props,a[s]).disableOverlayClose||this.helpers.close("overlay")}),N(this,"syncState",s=>{this.setState(s)});const{debug:t,getHelpers:n,run:r=!0,stepIndex:o}=e;this.store=_l({...e,controlled:r&&x.number(o)}),this.helpers=this.store.getHelpers();const{addListener:i}=this.store;Ue({title:"init",data:[{key:"props",value:this.props},{key:"state",value:this.state}],debug:t}),i(this.syncState),n&&n(this.helpers),this.state=this.store.getState()}componentDidMount(){if(!_e())return;const{debug:e,disableCloseOnEsc:t,run:n,steps:r}=this.props,{start:o}=this.store;wr(r,e)&&n&&o(),t||document.body.addEventListener("keydown",this.handleKeyboard,{passive:!0})}componentDidUpdate(e,t){if(!_e())return;const{action:n,controlled:r,index:o,status:i}=this.state,{debug:s,run:a,stepIndex:l,steps:u}=this.props,{stepIndex:f,steps:c}=e,{reset:d,setSteps:p,start:h,stop:v,update:S}=this.store,{changed:y}=Rt(e,this.props),{changed:m,changedFrom:E}=Rt(t,this.state),M=Ge(this.props,u[o]),C=!re(c,u),O=x.number(l)&&y("stepIndex"),D=De(M.target);if(C&&(wr(u,s)?p(u):console.warn("Steps are not valid",u)),y("run")&&(a?h(l):v()),O){let $=x.number(f)&&f=0?v:0,r===L.RUNNING&&El(v,{element:h,duration:s}).then(()=>{setTimeout(()=>{var m;(m=this.store.getPopper("tooltip"))==null||m.instance.update()},10)})}}render(){if(!_e())return null;const{index:e,lifecycle:t,status:n}=this.state,{continuous:r=!1,debug:o=!1,nonce:i,scrollToFirstStep:s=!1,steps:a}=this.props,l=n===L.RUNNING,u={};if(l&&a[e]){const f=Ge(this.props,a[e]);u.step=b.createElement(Vl,{...this.state,callback:this.callback,continuous:r,debug:o,helpers:this.helpers,nonce:i,shouldScroll:!f.disableScrolling&&(e!==0||s),step:f,store:this.store}),u.overlay=b.createElement(Ll,{id:"react-joyride-portal"},b.createElement(Bl,{...f,continuous:r,debug:o,lifecycle:t,onClickOverlay:this.handleClickOverlay}))}return b.createElement("div",{className:"react-joyride"},u.step,u.overlay)}};N(bo,"defaultProps",Dl);var rf=bo;function Kl(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const Zl={},ht={};function He(e,t){try{const r=(Zl[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return r in ht?ht[r]:Sr(r,r.split(":"))}catch{if(e in ht)return ht[e];const n=e?.match(Jl);return n?Sr(e,n.slice(1)):NaN}}const Jl=/([+-]\d\d):?(\d\d)?/;function Sr(e,t){const n=+(t[0]||0),r=+(t[1]||0),o=+(t[2]||0)/60;return ht[e]=n*60+r>0?n*60+r+o:n*60-r-o}class Me extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(He(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),wo(this),wn(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new Me(...n,t):new Me(Date.now(),t)}withTimeZone(t){return new Me(+this,t)}getTimezoneOffset(){const t=-He(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),wn(this),+this}[Symbol.for("constructDateFrom")](t){return new Me(+new Date(t),this.timeZone)}}const Er=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Er.test(e))return;const t=e.replace(Er,"$1UTC");Me.prototype[t]&&(e.startsWith("get")?Me.prototype[e]=function(){return this.internal[t]()}:(Me.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),Xl(this),+this},Me.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),wn(this),+this}))});function wn(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-He(e.timeZone,e)*60))}function Xl(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),wo(e)}function wo(e){const t=He(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const o=-new Date(+e).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),s=o-i,a=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();s&&a&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+s);const l=o-n;l&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+l);const u=new Date(+e);u.setUTCSeconds(0);const f=o>0?u.getSeconds():(u.getSeconds()-60)%60,c=Math.round(-(He(e.timeZone,e)*60))%60;(c||f)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+c),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+c+f));const d=He(e.timeZone,e),p=d>0?Math.floor(d):Math.ceil(d),v=-new Date(+e).getTimezoneOffset()-p,S=p!==n,y=v-l;if(S&&y){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+y);const m=He(e.timeZone,e),E=m>0?Math.floor(m):Math.ceil(m),M=p-E;M&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+M),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+M))}}class Ie extends Me{static tz(t,...n){return n.length?new Ie(...n,t):new Ie(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),o=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,o]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${r} ${n} ${o}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,o]=this.tzComponents();return`${t} GMT${n}${r}${o} (${Kl(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),o=String(Math.abs(t)%60).padStart(2,"0");return[n,r,o]}withTimeZone(t){return new Ie(+this,t)}[Symbol.for("constructDateFrom")](t){return new Ie(+new Date(t),this.timeZone)}}const kr=5,Ql=4;function ec(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,o=t.addDays(e,-r+1),i=t.addDays(o,kr*7-1);return t.getMonth(e)===t.getMonth(i)?kr:Ql}function Oo(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function tc(e,t){const n=Oo(e,t),r=ec(e,t);return t.addDays(n,r*7-1)}const nc={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},rc=(e,t,n)=>{let r;const o=nc[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},oc={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},ic={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},sc={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},ac={date:Vt({formats:oc,defaultWidth:"full"}),time:Vt({formats:ic,defaultWidth:"full"}),dateTime:Vt({formats:sc,defaultWidth:"full"})};function Cr(e,t,n){const r="eeee p";return vi(e,t,n)?r:e.getTime()>t.getTime()?"'下个'"+r:"'上个'"+r}const lc={lastWeek:Cr,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Cr,other:"PP p"},cc=(e,t,n,r)=>{const o=lc[e];return typeof o=="function"?o(t,n,r):o},uc={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},fc={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},dc={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},pc={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},hc={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},mc={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},yc=(e,t)=>{const n=Number(e);switch(t?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},vc={ordinalNumber:yc,era:ot({values:uc,defaultWidth:"wide"}),quarter:ot({values:fc,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ot({values:dc,defaultWidth:"wide"}),day:ot({values:pc,defaultWidth:"wide"}),dayPeriod:ot({values:hc,defaultWidth:"wide",formattingValues:mc,defaultFormattingWidth:"wide"})},gc=/^(第\s*)?\d+(日|时|分|秒)?/i,bc=/\d+/i,wc={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},Oc={any:[/^(前)/i,/^(公元)/i]},Sc={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},Ec={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},kc={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},Cc={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},Tc={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},Mc={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},Pc={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},xc={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},Nc={ordinalNumber:gi({matchPattern:gc,parsePattern:bc,valueCallback:e=>parseInt(e,10)}),era:it({matchPatterns:wc,defaultMatchWidth:"wide",parsePatterns:Oc,defaultParseWidth:"any"}),quarter:it({matchPatterns:Sc,defaultMatchWidth:"wide",parsePatterns:Ec,defaultParseWidth:"any",valueCallback:e=>e+1}),month:it({matchPatterns:kc,defaultMatchWidth:"wide",parsePatterns:Cc,defaultParseWidth:"any"}),day:it({matchPatterns:Tc,defaultMatchWidth:"wide",parsePatterns:Mc,defaultParseWidth:"any"}),dayPeriod:it({matchPatterns:Pc,defaultMatchWidth:"any",parsePatterns:xc,defaultParseWidth:"any"})},of={code:"zh-CN",formatDistance:rc,formatLong:ac,formatRelative:cc,localize:vc,match:Nc,options:{weekStartsOn:1,firstWeekContainsDate:4}},So={...st,labels:{labelDayButton:(e,t,n,r)=>{let o;r&&typeof r.format=="function"?o=r.format.bind(r):o=(s,a)=>pt(s,a,{locale:st,...n});let i=o(e,"PPPP");return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(o,i)=>pt(o,i,{locale:st,...t}),r(e,"LLLL yyyy")},labelGridcell:(e,t,n,r)=>{let o;r&&typeof r.format=="function"?o=r.format.bind(r):o=(s,a)=>pt(s,a,{locale:st,...n});let i=o(e,"PPPP");return t?.today&&(i=`Today, ${i}`),i},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(o,i)=>pt(o,i,{locale:st,...t}),r(e,"cccc")}}};class ce{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Ie.tz(this.options.timeZone):new this.Date,this.newDate=(r,o,i)=>this.overrides?.newDate?this.overrides.newDate(r,o,i):this.options.timeZone?new Ie(r,o,i,this.options.timeZone):new Date(r,o,i),this.addDays=(r,o)=>this.overrides?.addDays?this.overrides.addDays(r,o):bi(r,o),this.addMonths=(r,o)=>this.overrides?.addMonths?this.overrides.addMonths(r,o):wi(r,o),this.addWeeks=(r,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,o):Oi(r,o),this.addYears=(r,o)=>this.overrides?.addYears?this.overrides.addYears(r,o):Si(r,o),this.differenceInCalendarDays=(r,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,o):Ei(r,o),this.differenceInCalendarMonths=(r,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,o):ki(r,o),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Ci(r),this.eachYearOfInterval=r=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Ti(r),i=new Set(o.map(a=>this.getYear(a)));if(i.size===o.length)return o;const s=[];return i.forEach(a=>{s.push(new Date(a,0,1))}),s},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):tc(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Mi(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Pi(r),this.endOfWeek=(r,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,o):xi(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Ni(r),this.format=(r,o,i)=>{const s=this.overrides?.format?this.overrides.format(r,o,this.options):pt(r,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(s):s},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):Di(r),this.getMonth=(r,o)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Ii(r,this.options),this.getYear=(r,o)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Wi(r,this.options),this.getWeek=(r,o)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):Ri(r,this.options),this.isAfter=(r,o)=>this.overrides?.isAfter?this.overrides.isAfter(r,o):Ai(r,o),this.isBefore=(r,o)=>this.overrides?.isBefore?this.overrides.isBefore(r,o):_i(r,o),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):Fi(r),this.isSameDay=(r,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,o):ji(r,o),this.isSameMonth=(r,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,o):Bi(r,o),this.isSameYear=(r,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,o):Li(r,o),this.max=r=>this.overrides?.max?this.overrides.max(r):$i(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Hi(r),this.setMonth=(r,o)=>this.overrides?.setMonth?this.overrides.setMonth(r,o):zi(r,o),this.setYear=(r,o)=>this.overrides?.setYear?this.overrides.setYear(r,o):Ui(r,o),this.startOfBroadcastWeek=(r,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Oo(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Yi(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):qi(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Gi(r),this.startOfWeek=(r,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Vi(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):Ki(r),this.options={locale:So,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let o=0;o<10;o++)r[o.toString()]=n.format(o);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&ce.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:o}=this.options,i=n?.code;if(i&&ce.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:o}).format(t)}catch{}const s=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,s)}}ce.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Pe=new ce;class Eo{constructor(t,n,r=Pe){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r,this.isoDate=r.format(t,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class Dc{constructor(t,n){this.date=t,this.weeks=n}}class Ic{constructor(t,n){this.days=n,this.weekNumber=t}}function Wc(e){return w.createElement("button",{...e})}function Rc(e){return w.createElement("span",{...e})}function Ac(e){const{size:t=24,orientation:n="left",className:r}=e;return w.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&w.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&w.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&w.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&w.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function _c(e){const{day:t,modifiers:n,...r}=e;return w.createElement("td",{...r})}function Fc(e){const{day:t,modifiers:n,...r}=e,o=w.useRef(null);return w.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),w.createElement("button",{ref:o,...r})}var I;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(I||(I={}));var J;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(J||(J={}));var ge;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(ge||(ge={}));var le;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(le||(le={}));function jc(e){const{options:t,className:n,components:r,classNames:o,...i}=e,s=[o[I.Dropdown],n].join(" "),a=t?.find(({value:l})=>l===i.value);return w.createElement("span",{"data-disabled":i.disabled,className:o[I.DropdownRoot]},w.createElement(r.Select,{className:s,...i},t?.map(({value:l,label:u,disabled:f})=>w.createElement(r.Option,{key:l,value:l,disabled:f},u))),w.createElement("span",{className:o[I.CaptionLabel],"aria-hidden":!0},a?.label,w.createElement(r.Chevron,{orientation:"down",size:18,className:o[I.Chevron]})))}function Bc(e){return w.createElement("div",{...e})}function Lc(e){return w.createElement("div",{...e})}function $c(e){const{calendarMonth:t,displayIndex:n,...r}=e;return w.createElement("div",{...r},e.children)}function Hc(e){const{calendarMonth:t,displayIndex:n,...r}=e;return w.createElement("div",{...r})}function zc(e){return w.createElement("table",{...e})}function Uc(e){return w.createElement("div",{...e})}const ko=b.createContext(void 0);function Mt(){const e=b.useContext(ko);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Yc(e){const{components:t}=Mt();return w.createElement(t.Dropdown,{...e})}function qc(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:o,...i}=e,{components:s,classNames:a,labels:{labelPrevious:l,labelNext:u}}=Mt(),f=b.useCallback(d=>{o&&n?.(d)},[o,n]),c=b.useCallback(d=>{r&&t?.(d)},[r,t]);return w.createElement("nav",{...i},w.createElement(s.PreviousMonthButton,{type:"button",className:a[I.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":l(r),onClick:c},w.createElement(s.Chevron,{disabled:r?void 0:!0,className:a[I.Chevron],orientation:"left"})),w.createElement(s.NextMonthButton,{type:"button",className:a[I.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":u(o),onClick:f},w.createElement(s.Chevron,{disabled:o?void 0:!0,orientation:"right",className:a[I.Chevron]})))}function Gc(e){const{components:t}=Mt();return w.createElement(t.Button,{...e})}function Vc(e){return w.createElement("option",{...e})}function Kc(e){const{components:t}=Mt();return w.createElement(t.Button,{...e})}function Zc(e){const{rootRef:t,...n}=e;return w.createElement("div",{...n,ref:t})}function Jc(e){return w.createElement("select",{...e})}function Xc(e){const{week:t,...n}=e;return w.createElement("tr",{...n})}function Qc(e){return w.createElement("th",{...e})}function eu(e){return w.createElement("thead",{"aria-hidden":!0},w.createElement("tr",{...e}))}function tu(e){const{week:t,...n}=e;return w.createElement("th",{...n})}function nu(e){return w.createElement("th",{...e})}function ru(e){return w.createElement("tbody",{...e})}function ou(e){const{components:t}=Mt();return w.createElement(t.Dropdown,{...e})}const iu=Object.freeze(Object.defineProperty({__proto__:null,Button:Wc,CaptionLabel:Rc,Chevron:Ac,Day:_c,DayButton:Fc,Dropdown:jc,DropdownNav:Bc,Footer:Lc,Month:$c,MonthCaption:Hc,MonthGrid:zc,Months:Uc,MonthsDropdown:Yc,Nav:qc,NextMonthButton:Gc,Option:Vc,PreviousMonthButton:Kc,Root:Zc,Select:Jc,Week:Xc,WeekNumber:tu,WeekNumberHeader:nu,Weekday:Qc,Weekdays:eu,Weeks:ru,YearsDropdown:ou},Symbol.toStringTag,{value:"Module"}));function We(e,t,n=!1,r=Pe){let{from:o,to:i}=e;const{differenceInCalendarDays:s,isSameDay:a}=r;return o&&i?(s(i,o)<0&&([o,i]=[i,o]),s(t,o)>=(n?1:0)&&s(i,t)>=(n?1:0)):!n&&i?a(i,t):!n&&o?a(o,t):!1}function Nn(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Ht(e){return!!(e&&typeof e=="object"&&"from"in e)}function Dn(e){return!!(e&&typeof e=="object"&&"after"in e)}function In(e){return!!(e&&typeof e=="object"&&"before"in e)}function Co(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function To(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Re(e,t,n=Pe){const r=Array.isArray(t)?t:[t],{isSameDay:o,differenceInCalendarDays:i,isAfter:s}=n;return r.some(a=>{if(typeof a=="boolean")return a;if(n.isDate(a))return o(e,a);if(To(a,n))return a.some(l=>o(e,l));if(Ht(a))return We(a,e,!1,n);if(Co(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(e.getDay()):a.dayOfWeek===e.getDay();if(Nn(a)){const l=i(a.before,e),u=i(a.after,e),f=l>0,c=u<0;return s(a.before,a.after)?c&&f:f||c}return Dn(a)?i(e,a.after)>0:In(a)?i(a.before,e)>0:typeof a=="function"?a(e):!1})}function su(e,t,n,r,o){const{disabled:i,hidden:s,modifiers:a,showOutsideDays:l,broadcastCalendar:u,today:f=o.today()}=t,{isSameDay:c,isSameMonth:d,startOfMonth:p,isBefore:h,endOfMonth:v,isAfter:S}=o,y=n&&p(n),m=r&&v(r),E={[J.focused]:[],[J.outside]:[],[J.disabled]:[],[J.hidden]:[],[J.today]:[]},M={};for(const C of e){const{date:O,displayMonth:D}=C,j=!!(D&&!d(O,D)),Z=!!(y&&h(O,y)),$=!!(m&&S(O,m)),oe=!!(i&&Re(O,i,o)),ue=!!(s&&Re(O,s,o))||Z||$||!u&&!l&&j||u&&l===!1&&j,fe=c(O,f);j&&E.outside.push(C),oe&&E.disabled.push(C),ue&&E.hidden.push(C),fe&&E.today.push(C),a&&Object.keys(a).forEach(X=>{const de=a?.[X];de&&Re(O,de,o)&&(M[X]?M[X].push(C):M[X]=[C])})}return C=>{const O={[J.focused]:!1,[J.disabled]:!1,[J.hidden]:!1,[J.outside]:!1,[J.today]:!1},D={};for(const j in E){const Z=E[j];O[j]=Z.some($=>$===C)}for(const j in M)D[j]=M[j].some(Z=>Z===C);return{...O,...D}}}function au(e,t,n={}){return Object.entries(e).filter(([,o])=>o===!0).reduce((o,[i])=>(n[i]?o.push(n[i]):t[J[i]]?o.push(t[J[i]]):t[ge[i]]&&o.push(t[ge[i]]),o),[t[I.Day]])}function lu(e){return{...iu,...e}}function cu(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function uu(){const e={};for(const t in I)e[I[t]]=`rdp-${I[t]}`;for(const t in J)e[J[t]]=`rdp-${J[t]}`;for(const t in ge)e[ge[t]]=`rdp-${ge[t]}`;for(const t in le)e[le[t]]=`rdp-${le[t]}`;return e}function Mo(e,t,n){return(n??new ce(t)).formatMonthYear(e)}const fu=Mo;function du(e,t,n){return(n??new ce(t)).format(e,"d")}function pu(e,t=Pe){return t.format(e,"LLLL")}function hu(e,t,n){return(n??new ce(t)).format(e,"cccccc")}function mu(e,t=Pe){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function yu(){return""}function Po(e,t=Pe){return t.format(e,"yyyy")}const vu=Po,gu=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Mo,formatDay:du,formatMonthCaption:fu,formatMonthDropdown:pu,formatWeekNumber:mu,formatWeekNumberHeader:yu,formatWeekdayName:hu,formatYearCaption:vu,formatYearDropdown:Po},Symbol.toStringTag,{value:"Module"}));function bu(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...gu,...e}}function Wn(e,t,n,r){let o=(r??new ce(n)).format(e,"PPPP");return t.today&&(o=`Today, ${o}`),t.selected&&(o=`${o}, selected`),o}const wu=Wn;function Rn(e,t,n){return(n??new ce(t)).formatMonthYear(e)}const Ou=Rn;function xo(e,t,n,r){let o=(r??new ce(n)).format(e,"PPPP");return t?.today&&(o=`Today, ${o}`),o}function No(e){return"Choose the Month"}function Do(){return""}const Su="Go to the Next Month";function Io(e,t){return Su}function Wo(e){return"Go to the Previous Month"}function Ro(e,t,n){return(n??new ce(t)).format(e,"cccc")}function Ao(e,t){return`Week ${e}`}function _o(e){return"Week Number"}function Fo(e){return"Choose the Year"}const Eu=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:Ou,labelDay:wu,labelDayButton:Wn,labelGrid:Rn,labelGridcell:xo,labelMonthDropdown:No,labelNav:Do,labelNext:Io,labelPrevious:Wo,labelWeekNumber:Ao,labelWeekNumberHeader:_o,labelWeekday:Ro,labelYearDropdown:Fo},Symbol.toStringTag,{value:"Module"})),me=(e,t,n)=>t||(n?typeof n=="function"?n:(...r)=>n:e);function ku(e,t){const n=t.locale?.labels??{};return{...Eu,...e??{},labelDayButton:me(Wn,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:me(No,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:me(Io,e?.labelNext,n.labelNext),labelPrevious:me(Wo,e?.labelPrevious,n.labelPrevious),labelWeekNumber:me(Ao,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:me(Fo,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:me(Rn,e?.labelGrid,n.labelGrid),labelGridcell:me(xo,e?.labelGridcell,n.labelGridcell),labelNav:me(Do,e?.labelNav,n.labelNav),labelWeekNumberHeader:me(_o,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:me(Ro,e?.labelWeekday,n.labelWeekday)}}function Cu(e,t,n,r,o){const{startOfMonth:i,startOfYear:s,endOfYear:a,eachMonthOfInterval:l,getMonth:u}=o;return l({start:s(e),end:a(e)}).map(d=>{const p=r.formatMonthDropdown(d,o),h=u(d),v=t&&di(n)||!1;return{value:h,label:p,disabled:v}})}function Tu(e,t={},n={}){let r={...t?.[I.Day]};return Object.entries(e).filter(([,o])=>o===!0).forEach(([o])=>{r={...r,...n?.[o]}}),r}function Mu(e,t,n,r){const o=r??e.today(),i=n?e.startOfBroadcastWeek(o,e):t?e.startOfISOWeek(o):e.startOfWeek(o),s=[];for(let a=0;a<7;a++){const l=e.addDays(i,a);s.push(l)}return s}function Pu(e,t,n,r,o=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:s,eachYearOfInterval:a,getYear:l}=r,u=i(e),f=s(t),c=a({start:u,end:f});return o&&c.reverse(),c.map(d=>{const p=n.formatYearDropdown(d,r);return{value:l(d),label:p,disabled:!1}})}const Pt=e=>e instanceof HTMLElement?e:null,ln=e=>[...e.querySelectorAll("[data-animated-month]")??[]],xu=e=>Pt(e.querySelector("[data-animated-month]")),cn=e=>Pt(e.querySelector("[data-animated-caption]")),un=e=>Pt(e.querySelector("[data-animated-weeks]")),Nu=e=>Pt(e.querySelector("[data-animated-nav]")),Du=e=>Pt(e.querySelector("[data-animated-weekdays]"));function Iu(e,t,{classNames:n,months:r,focused:o,dateLib:i}){const s=b.useRef(null),a=b.useRef(r),l=b.useRef(!1);b.useLayoutEffect(()=>{const u=a.current;if(a.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||u.length===0||r.length!==u.length)return;const f=i.isSameMonth(r[0].date,u[0].date),c=i.isAfter(r[0].date,u[0].date),d=c?n[le.caption_after_enter]:n[le.caption_before_enter],p=c?n[le.weeks_after_enter]:n[le.weeks_before_enter],h=s.current,v=e.current.cloneNode(!0);if(v instanceof HTMLElement?(ln(v).forEach(E=>{if(!(E instanceof HTMLElement))return;const M=xu(E);M&&E.contains(M)&&E.removeChild(M);const C=cn(E);C&&C.classList.remove(d);const O=un(E);O&&O.classList.remove(p)}),s.current=v):s.current=null,l.current||f||o)return;const S=h instanceof HTMLElement?ln(h):[],y=ln(e.current);if(y?.every(m=>m instanceof HTMLElement)&&S&&S.every(m=>m instanceof HTMLElement)){l.current=!0,e.current.style.isolation="isolate";const m=Nu(e.current);m&&(m.style.zIndex="1"),y.forEach((E,M)=>{const C=S[M];if(!C)return;E.style.position="relative",E.style.overflow="hidden";const O=cn(E);O&&O.classList.add(d);const D=un(E);D&&D.classList.add(p);const j=()=>{l.current=!1,e.current&&(e.current.style.isolation=""),m&&(m.style.zIndex=""),O&&O.classList.remove(d),D&&D.classList.remove(p),E.style.position="",E.style.overflow="",E.contains(C)&&E.removeChild(C)};C.style.pointerEvents="none",C.style.position="absolute",C.style.overflow="hidden",C.setAttribute("aria-hidden","true");const Z=Du(C);Z&&(Z.style.opacity="0");const $=cn(C);$&&($.classList.add(c?n[le.caption_before_exit]:n[le.caption_after_exit]),$.addEventListener("animationend",j));const oe=un(C);oe&&oe.classList.add(c?n[le.weeks_before_exit]:n[le.weeks_after_exit]),E.insertBefore(C,E.firstChild)})}})}function Wu(e,t,n,r){const o=e[0],i=e[e.length-1],{ISOWeek:s,fixedWeeks:a,broadcastCalendar:l}=n??{},{addDays:u,differenceInCalendarDays:f,differenceInCalendarMonths:c,endOfBroadcastWeek:d,endOfISOWeek:p,endOfMonth:h,endOfWeek:v,isAfter:S,startOfBroadcastWeek:y,startOfISOWeek:m,startOfWeek:E}=r,M=l?y(o,r):s?m(o):E(o),C=l?d(i):s?p(h(i)):v(h(i)),O=t&&(l?d(t):s?p(t):v(t)),D=O&&S(C,O)?O:C,j=f(D,M),Z=c(i,o)+1,$=[];for(let fe=0;fe<=j;fe++){const X=u(M,fe);$.push(X)}const ue=(l?35:42)*Z;if(a&&$.length{const o=r.weeks.reduce((i,s)=>i.concat(s.days.slice()),t.slice());return n.concat(o.slice())},t.slice())}function Au(e,t,n,r){const{numberOfMonths:o=1}=n,i=[];for(let s=0;st)break;i.push(a)}return i}function Tr(e,t,n,r){const{month:o,defaultMonth:i,today:s=r.today(),numberOfMonths:a=1}=e;let l=o||i||s;const{differenceInCalendarMonths:u,addMonths:f,startOfMonth:c}=r;if(n&&u(n,l){const y=n.broadcastCalendar?c(S,r):n.ISOWeek?d(S):p(S),m=n.broadcastCalendar?i(S):n.ISOWeek?s(a(S)):l(a(S)),E=t.filter(D=>D>=y&&D<=m),M=n.broadcastCalendar?35:42;if(n.fixedWeeks&&E.length{const Z=M-E.length;return j>m&&j<=o(m,Z)});E.push(...D)}const C=E.reduce((D,j)=>{const Z=n.ISOWeek?u(j):f(j),$=D.find(ue=>ue.weekNumber===Z),oe=new Eo(j,S,r);return $?$.days.push(oe):D.push(new Ic(Z,[oe])),D},[]),O=new Dc(S,C);return v.push(O),v},[]);return n.reverseMonths?h.reverse():h}function Fu(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:o,startOfDay:i,startOfMonth:s,endOfMonth:a,addYears:l,endOfYear:u,newDate:f,today:c}=t,{fromYear:d,toYear:p,fromMonth:h,toMonth:v}=e;!n&&h&&(n=h),!n&&d&&(n=t.newDate(d,0,1)),!r&&v&&(r=v),!r&&p&&(r=f(p,11,31));const S=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=s(n):d?n=f(d,0,1):!n&&S&&(n=o(l(e.today??c(),-100))),r?r=a(r):p?r=f(p,11,31):!r&&S&&(r=u(e.today??c())),[n&&i(n),r&&i(r)]}function ju(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:i=1}=n,{startOfMonth:s,addMonths:a,differenceInCalendarMonths:l}=r,u=o?i:1,f=s(e);if(!t)return a(f,u);if(!(l(t,e)n.concat(r.weeks.slice()),t.slice())}function zt(e,t){const[n,r]=b.useState(e);return[t===void 0?n:t,r]}function $u(e,t){const[n,r]=Fu(e,t),{startOfMonth:o,endOfMonth:i}=t,s=Tr(e,n,r,t),[a,l]=zt(s,e.month?s:void 0);b.useEffect(()=>{const M=Tr(e,n,r,t);l(M)},[e.timeZone]);const{months:u,weeks:f,days:c,previousMonth:d,nextMonth:p}=b.useMemo(()=>{const M=Au(a,r,{numberOfMonths:e.numberOfMonths},t),C=Wu(M,e.endMonth?i(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),O=_u(M,C,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),D=Lu(O),j=Ru(O),Z=Bu(a,n,e,t),$=ju(a,r,e,t);return{months:O,weeks:D,days:j,previousMonth:Z,nextMonth:$}},[t,a.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:h,onMonthChange:v}=e,S=M=>f.some(C=>C.days.some(O=>O.isEqualTo(M))),y=M=>{if(h)return;let C=o(M);n&&Co(r)&&(C=o(r)),l(C),v?.(C)};return{months:u,weeks:f,days:c,navStart:n,navEnd:r,previousMonth:d,nextMonth:p,goToMonth:y,goToDay:M=>{S(M)||y(M.date)}}}var Se;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Se||(Se={}));function Mr(e){return!e[J.disabled]&&!e[J.hidden]&&!e[J.outside]}function Hu(e,t,n,r){let o,i=-1;for(const s of e){const a=t(s);Mr(a)&&(a[J.focused]&&iMr(t(s)))),o}function zu(e,t,n,r,o,i,s){const{ISOWeek:a,broadcastCalendar:l}=i,{addDays:u,addMonths:f,addWeeks:c,addYears:d,endOfBroadcastWeek:p,endOfISOWeek:h,endOfWeek:v,max:S,min:y,startOfBroadcastWeek:m,startOfISOWeek:E,startOfWeek:M}=s;let O={day:u,week:c,month:f,year:d,startOfWeek:D=>l?m(D,s):a?E(D):M(D),endOfWeek:D=>l?p(D):a?h(D):v(D)}[e](n,t==="after"?1:-1);return t==="before"&&r?O=S([r,O]):t==="after"&&o&&(O=y([o,O])),O}function jo(e,t,n,r,o,i,s,a=0){if(a>365)return;const l=zu(e,t,n.date,r,o,i,s),u=!!(i.disabled&&Re(l,i.disabled,s)),f=!!(i.hidden&&Re(l,i.hidden,s)),c=l,d=new Eo(l,c,s);return!u&&!f?d:jo(e,t,d,r,o,i,s,a+1)}function Uu(e,t,n,r,o){const{autoFocus:i}=e,[s,a]=b.useState(),l=Hu(t.days,n,r||(()=>!1),s),[u,f]=b.useState(i?l:void 0);return{isFocusTarget:v=>!!l?.isEqualTo(v),setFocused:f,focused:u,blur:()=>{a(u),f(void 0)},moveFocus:(v,S)=>{if(!u)return;const y=jo(v,S,u,t.navStart,t.navEnd,e,o);y&&(e.disableNavigation&&!t.days.some(E=>E.isEqualTo(y))||(t.goToDay(y),f(y)))}}}function Yu(e,t){const{selected:n,required:r,onSelect:o}=e,[i,s]=zt(n,o?n:void 0),a=o?n:i,{isSameDay:l}=t,u=p=>a?.some(h=>l(h,p))??!1,{min:f,max:c}=e;return{selected:a,select:(p,h,v)=>{let S=[...a??[]];if(u(p)){if(a?.length===f||r&&a?.length===1)return;S=a?.filter(y=>!l(y,p))}else a?.length===c?S=[p]:S=[...S,p];return o||s(S),o?.(S,p,h,v),S},isSelected:u}}function qu(e,t,n=0,r=0,o=!1,i=Pe){const{from:s,to:a}=t||{},{isSameDay:l,isAfter:u,isBefore:f}=i;let c;if(!s&&!a)c={from:e,to:n>0?void 0:e};else if(s&&!a)l(s,e)?n===0?c={from:s,to:e}:o?c={from:s,to:void 0}:c=void 0:f(e,s)?c={from:e,to:s}:c={from:s,to:e};else if(s&&a)if(l(s,e)&&l(a,e))o?c={from:s,to:a}:c=void 0;else if(l(s,e))c={from:s,to:n>0?void 0:e};else if(l(a,e))c={from:e,to:n>0?void 0:e};else if(f(e,s))c={from:e,to:a};else if(u(e,s))c={from:s,to:e};else if(u(e,a))c={from:s,to:e};else throw new Error("Invalid range");if(c?.from&&c?.to){const d=i.differenceInCalendarDays(c.to,c.from);r>0&&d>r?c={from:e,to:void 0}:n>1&&dtypeof a!="function").some(a=>typeof a=="boolean"?a:n.isDate(a)?We(e,a,!1,n):To(a,n)?a.some(l=>We(e,l,!1,n)):Ht(a)?a.from&&a.to?Pr(e,{from:a.from,to:a.to},n):!1:Co(a)?Gu(e,a.dayOfWeek,n):Nn(a)?n.isAfter(a.before,a.after)?Pr(e,{from:n.addDays(a.after,1),to:n.addDays(a.before,-1)},n):Re(e.from,a,n)||Re(e.to,a,n):Dn(a)||In(a)?Re(e.from,a,n)||Re(e.to,a,n):!1))return!0;const s=r.filter(a=>typeof a=="function");if(s.length){let a=e.from;const l=n.differenceInCalendarDays(e.to,e.from);for(let u=0;u<=l;u++){if(s.some(f=>f(a)))return!0;a=n.addDays(a,1)}}return!1}function Ku(e,t){const{disabled:n,excludeDisabled:r,selected:o,required:i,onSelect:s}=e,[a,l]=zt(o,s?o:void 0),u=s?o:a;return{selected:u,select:(d,p,h)=>{const{min:v,max:S}=e,y=d?qu(d,u,v,S,i,t):void 0;return r&&n&&y?.from&&y.to&&Vu({from:y.from,to:y.to},n,t)&&(y.from=d,y.to=void 0),s||l(y),s?.(y,d,p,h),y},isSelected:d=>u&&We(u,d,!1,t)}}function Zu(e,t){const{selected:n,required:r,onSelect:o}=e,[i,s]=zt(n,o?n:void 0),a=o?n:i,{isSameDay:l}=t;return{selected:a,select:(c,d,p)=>{let h=c;return!r&&a&&a&&l(c,a)&&(h=void 0),o||s(h),o?.(h,c,d,p),h},isSelected:c=>a?l(a,c):!1}}function Ju(e,t){const n=Zu(e,t),r=Yu(e,t),o=Ku(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return o;default:return}}function ee(e,t){return e instanceof Ie&&e.timeZone===t?e:new Ie(e,t)}function xr(e,t){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?ee(e,t):Array.isArray(e)?e.map(n=>n instanceof Date?ee(n,t):n):Ht(e)?{...e,from:e.from?ee(e.from,t):e.from,to:e.to?ee(e.to,t):e.to}:Nn(e)?{before:ee(e.before,t),after:ee(e.after,t)}:Dn(e)?{after:ee(e.after,t)}:In(e)?{before:ee(e.before,t)}:e}function fn(e,t){return e&&(Array.isArray(e)?e.map(n=>xr(n,t)):xr(e,t))}function sf(e){let t=e;const n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&(t.today=ee(t.today,n)),t.month&&(t.month=ee(t.month,n)),t.defaultMonth&&(t.defaultMonth=ee(t.defaultMonth,n)),t.startMonth&&(t.startMonth=ee(t.startMonth,n)),t.endMonth&&(t.endMonth=ee(t.endMonth,n)),t.mode==="single"&&t.selected?t.selected=ee(t.selected,n):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(F=>ee(F,n)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?ee(t.selected.from,n):t.selected.from,to:t.selected.to?ee(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=fn(t.disabled,n)),t.hidden!==void 0&&(t.hidden=fn(t.hidden,n)),t.modifiers)){const F={};Object.keys(t.modifiers).forEach(Y=>{F[Y]=fn(t.modifiers?.[Y],n)}),t.modifiers=F}const{components:r,formatters:o,labels:i,dateLib:s,locale:a,classNames:l}=b.useMemo(()=>{const F={...So,...t.locale},Y=new ce({locale:F,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib);return{dateLib:Y,components:lu(t.components),formatters:bu(t.formatters),labels:ku(t.labels,Y.options),locale:F,classNames:{...uu(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:s.today()});const{captionLayout:u,mode:f,navLayout:c,numberOfMonths:d=1,onDayBlur:p,onDayClick:h,onDayFocus:v,onDayKeyDown:S,onDayMouseEnter:y,onDayMouseLeave:m,onNextClick:E,onPrevClick:M,showWeekNumber:C,styles:O}=t,{formatCaption:D,formatDay:j,formatMonthDropdown:Z,formatWeekNumber:$,formatWeekNumberHeader:oe,formatWeekdayName:ue,formatYearDropdown:fe}=o,X=$u(t,s),{days:de,months:Ae,navStart:Le,navEnd:qe,previousMonth:ie,nextMonth:se,goToMonth:pe}=X,k=su(de,t,Le,qe,s),{isSelected:R,select:B,selected:W}=Ju(t,s)??{},{blur:U,focused:V,isFocusTarget:ne,moveFocus:Q,setFocused:xe}=Uu(t,X,k,R??(()=>!1),s),{labelDayButton:Bo,labelGridcell:Lo,labelGrid:$o,labelMonthDropdown:Ho,labelNav:An,labelPrevious:zo,labelNext:Uo,labelWeekday:Yo,labelWeekNumber:qo,labelWeekNumberHeader:Go,labelYearDropdown:Vo}=i,Ko=b.useMemo(()=>Mu(s,t.ISOWeek,t.broadcastCalendar,t.today),[s,t.ISOWeek,t.broadcastCalendar,t.today]),_n=f!==void 0||h!==void 0,Ut=b.useCallback(()=>{ie&&(pe(ie),M?.(ie))},[ie,pe,M]),Yt=b.useCallback(()=>{se&&(pe(se),E?.(se))},[pe,se,E]),Zo=b.useCallback((F,Y)=>_=>{_.preventDefault(),_.stopPropagation(),xe(F),!Y.disabled&&(B?.(F.date,Y,_),h?.(F.date,Y,_))},[B,h,xe]),Jo=b.useCallback((F,Y)=>_=>{xe(F),v?.(F.date,Y,_)},[v,xe]),Xo=b.useCallback((F,Y)=>_=>{U(),p?.(F.date,Y,_)},[U,p]),Qo=b.useCallback((F,Y)=>_=>{const G={ArrowLeft:[_.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[_.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[_.shiftKey?"year":"week","after"],ArrowUp:[_.shiftKey?"year":"week","before"],PageUp:[_.shiftKey?"year":"month","before"],PageDown:[_.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(G[_.key]){_.preventDefault(),_.stopPropagation();const[Oe,H]=G[_.key];Q(Oe,H)}S?.(F.date,Y,_)},[Q,S,t.dir]),ei=b.useCallback((F,Y)=>_=>{y?.(F.date,Y,_)},[y]),ti=b.useCallback((F,Y)=>_=>{m?.(F.date,Y,_)},[m]),ni=b.useCallback(F=>Y=>{const _=Number(Y.target.value),G=s.setMonth(s.startOfMonth(F),_);pe(G)},[s,pe]),ri=b.useCallback(F=>Y=>{const _=Number(Y.target.value),G=s.setYear(s.startOfMonth(F),_);pe(G)},[s,pe]),{className:oi,style:ii}=b.useMemo(()=>({className:[l[I.Root],t.className].filter(Boolean).join(" "),style:{...O?.[I.Root],...t.style}}),[l,t.className,t.style,O]),si=cu(t),Fn=b.useRef(null);Iu(Fn,!!t.animate,{classNames:l,months:Ae,focused:V,dateLib:s});const ai={dayPickerProps:t,selected:W,select:B,isSelected:R,months:Ae,nextMonth:se,previousMonth:ie,goToMonth:pe,getModifiers:k,components:r,classNames:l,styles:O,labels:i,formatters:o};return w.createElement(ko.Provider,{value:ai},w.createElement(r.Root,{rootRef:t.animate?Fn:void 0,className:oi,style:ii,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...si},w.createElement(r.Months,{className:l[I.Months],style:O?.[I.Months]},!t.hideNavigation&&!c&&w.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[I.Nav],style:O?.[I.Nav],"aria-label":An(),onPreviousClick:Ut,onNextClick:Yt,previousMonth:ie,nextMonth:se}),Ae.map((F,Y)=>w.createElement(r.Month,{"data-animated-month":t.animate?"true":void 0,className:l[I.Month],style:O?.[I.Month],key:Y,displayIndex:Y,calendarMonth:F},c==="around"&&!t.hideNavigation&&Y===0&&w.createElement(r.PreviousMonthButton,{type:"button",className:l[I.PreviousMonthButton],tabIndex:ie?void 0:-1,"aria-disabled":ie?void 0:!0,"aria-label":zo(ie),onClick:Ut,"data-animated-button":t.animate?"true":void 0},w.createElement(r.Chevron,{disabled:ie?void 0:!0,className:l[I.Chevron],orientation:t.dir==="rtl"?"right":"left"})),w.createElement(r.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:l[I.MonthCaption],style:O?.[I.MonthCaption],calendarMonth:F,displayIndex:Y},u?.startsWith("dropdown")?w.createElement(r.DropdownNav,{className:l[I.Dropdowns],style:O?.[I.Dropdowns]},(()=>{const _=u==="dropdown"||u==="dropdown-months"?w.createElement(r.MonthsDropdown,{key:"month",className:l[I.MonthsDropdown],"aria-label":Ho(),classNames:l,components:r,disabled:!!t.disableNavigation,onChange:ni(F.date),options:Cu(F.date,Le,qe,o,s),style:O?.[I.Dropdown],value:s.getMonth(F.date)}):w.createElement("span",{key:"month"},Z(F.date,s)),G=u==="dropdown"||u==="dropdown-years"?w.createElement(r.YearsDropdown,{key:"year",className:l[I.YearsDropdown],"aria-label":Vo(s.options),classNames:l,components:r,disabled:!!t.disableNavigation,onChange:ri(F.date),options:Pu(Le,qe,o,s,!!t.reverseYears),style:O?.[I.Dropdown],value:s.getYear(F.date)}):w.createElement("span",{key:"year"},fe(F.date,s));return s.getMonthYearOrder()==="year-first"?[G,_]:[_,G]})(),w.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},D(F.date,s.options,s))):w.createElement(r.CaptionLabel,{className:l[I.CaptionLabel],role:"status","aria-live":"polite"},D(F.date,s.options,s))),c==="around"&&!t.hideNavigation&&Y===d-1&&w.createElement(r.NextMonthButton,{type:"button",className:l[I.NextMonthButton],tabIndex:se?void 0:-1,"aria-disabled":se?void 0:!0,"aria-label":Uo(se),onClick:Yt,"data-animated-button":t.animate?"true":void 0},w.createElement(r.Chevron,{disabled:se?void 0:!0,className:l[I.Chevron],orientation:t.dir==="rtl"?"left":"right"})),Y===d-1&&c==="after"&&!t.hideNavigation&&w.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[I.Nav],style:O?.[I.Nav],"aria-label":An(),onPreviousClick:Ut,onNextClick:Yt,previousMonth:ie,nextMonth:se}),w.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":f==="multiple"||f==="range","aria-label":$o(F.date,s.options,s)||void 0,className:l[I.MonthGrid],style:O?.[I.MonthGrid]},!t.hideWeekdays&&w.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:l[I.Weekdays],style:O?.[I.Weekdays]},C&&w.createElement(r.WeekNumberHeader,{"aria-label":Go(s.options),className:l[I.WeekNumberHeader],style:O?.[I.WeekNumberHeader],scope:"col"},oe()),Ko.map(_=>w.createElement(r.Weekday,{"aria-label":Yo(_,s.options,s),className:l[I.Weekday],key:String(_),style:O?.[I.Weekday],scope:"col"},ue(_,s.options,s)))),w.createElement(r.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:l[I.Weeks],style:O?.[I.Weeks]},F.weeks.map(_=>w.createElement(r.Week,{className:l[I.Week],key:_.weekNumber,style:O?.[I.Week],week:_},C&&w.createElement(r.WeekNumber,{week:_,style:O?.[I.WeekNumber],"aria-label":qo(_.weekNumber,{locale:a}),className:l[I.WeekNumber],scope:"row",role:"rowheader"},$(_.weekNumber,s)),_.days.map(G=>{const{date:Oe}=G,H=k(G);if(H[J.focused]=!H.hidden&&!!V?.isEqualTo(G),H[ge.selected]=R?.(Oe)||H.selected,Ht(W)){const{from:qt,to:Gt}=W;H[ge.range_start]=!!(qt&&Gt&&s.isSameDay(Oe,qt)),H[ge.range_end]=!!(qt&&Gt&&s.isSameDay(Oe,Gt)),H[ge.range_middle]=We(W,Oe,!0,s)}const li=Tu(H,O,t.modifiersStyles),ci=au(H,l,t.modifiersClassNames),ui=!_n&&!H.hidden?Lo(Oe,H,s.options,s):void 0;return w.createElement(r.Day,{key:`${G.isoDate}_${G.displayMonthId}`,day:G,modifiers:H,className:ci.join(" "),style:li,role:"gridcell","aria-selected":H.selected||void 0,"aria-label":ui,"data-day":G.isoDate,"data-month":G.outside?G.dateMonthId:void 0,"data-selected":H.selected||void 0,"data-disabled":H.disabled||void 0,"data-hidden":H.hidden||void 0,"data-outside":G.outside||void 0,"data-focused":H.focused||void 0,"data-today":H.today||void 0},!H.hidden&&_n?w.createElement(r.DayButton,{className:l[I.DayButton],style:O?.[I.DayButton],type:"button",day:G,modifiers:H,disabled:!H.focused&&H.disabled||void 0,"aria-disabled":H.focused&&H.disabled||void 0,tabIndex:ne(G)?0:-1,"aria-label":Bo(Oe,H,s.options,s),onClick:Zo(G,H),onBlur:Xo(G,H),onFocus:Jo(G,H),onKeyDown:Qo(G,H),onMouseEnter:ei(G,H),onMouseLeave:ti(G,H)},j(Oe,s.options,s)):!H.hidden&&j(G.date,s.options,s))})))))))),t.footer&&w.createElement(r.Footer,{className:l[I.Footer],style:O?.[I.Footer],role:"status","aria-live":"polite"},t.footer)))}export{sf as D,nf as _,rf as c,uu as g,of as z}; diff --git a/webui/dist/assets/misc-DyBU7ISD.js b/webui/dist/assets/misc-DyBU7ISD.js deleted file mode 100644 index 922264e9..00000000 --- a/webui/dist/assets/misc-DyBU7ISD.js +++ /dev/null @@ -1,27 +0,0 @@ -import{k as Lo,u as Ve,R as Bo,o as $o,O as Ho,C as Uo,r as ct}from"./radix-core-C3XKqQJw.js";import{r as b,j as zo,R as w,c as Et,b as kt}from"./router-CWhjJi2n.js";import{g as Dt}from"./react-vendor-Dtc2IqVY.js";import{ai as T}from"./charts-Dhri-zxi.js";import{a as Yo,b as qo,d as Go,e as Vo,f as Ko,g as Zo,h as Jo,i as Xo,j as Qo,k as ei,l as ti,m as ni,n as ri,o as oi,p as ii,q as si,r as ai,s as li,t as ci,u as ui,v as fi,w as di,x as pi,y as hi,z as mi,A as yi,B as vi,C as gi,D as bi,E as wi,F as Oi,G as Si,H as cr}from"./utils-CCeOswSm.js";var Sn=1,Ei=.9,ki=.8,Ci=.17,$t=.1,Ht=.999,Ti=.9999,Mi=.99,xi=/[\\\/_+.#"@\[\(\{&]/,Ni=/[\\\/_+.#"@\[\(\{&]/g,Pi=/[\s-]/,ur=/[\s-]/g;function Qt(e,t,n,r,o,i,a){if(i===t.length)return o===e.length?Sn:Mi;var s=`${o},${i}`;if(a[s]!==void 0)return a[s];for(var l=r.charAt(i),u=n.indexOf(l,o),f=0,c,d,p,h;u>=0;)c=Qt(e,t,n,r,u+1,i+1,a),c>f&&(u===o?c*=Sn:xi.test(e.charAt(u-1))?(c*=ki,p=e.slice(o,u-1).match(Ni),p&&o>0&&(c*=Math.pow(Ht,p.length))):Pi.test(e.charAt(u-1))?(c*=Ei,h=e.slice(o,u-1).match(ur),h&&o>0&&(c*=Math.pow(Ht,h.length))):(c*=Ci,o>0&&(c*=Math.pow(Ht,u-o))),e.charAt(u)!==t.charAt(i)&&(c*=Ti)),(c<$t&&n.charAt(u-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(u-1)!==r.charAt(i))&&(d=Qt(e,t,n,r,u+1,i+2,a),d*$t>c&&(c=d*$t)),c>f&&(f=c),u=n.indexOf(l,u+1);return a[s]=f,f}function En(e){return e.toLowerCase().replace(ur," ")}function Di(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Qt(e,t,En(e),En(t),0,0,{})}var Ii=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_e=Ii.reduce((e,t)=>{const n=Lo(`Primitive.${t}`),r=b.forwardRef((o,i)=>{const{asChild:a,...s}=o,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),zo.jsx(l,{...s,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),nt='[cmdk-group=""]',Ut='[cmdk-group-items=""]',Ri='[cmdk-group-heading=""]',fr='[cmdk-item=""]',kn=`${fr}:not([aria-disabled="true"])`,en="cmdk-item-select",qe="data-value",Wi=(e,t,n)=>Di(e,t,n),dr=b.createContext(void 0),dt=()=>b.useContext(dr),pr=b.createContext(void 0),cn=()=>b.useContext(pr),hr=b.createContext(void 0),mr=b.forwardRef((e,t)=>{let n=Ge(()=>{var k,W;return{search:"",value:(W=(k=e.value)!=null?k:e.defaultValue)!=null?W:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ge(()=>new Set),o=Ge(()=>new Map),i=Ge(()=>new Map),a=Ge(()=>new Set),s=yr(e),{label:l,children:u,value:f,onValueChange:c,filter:d,shouldFilter:p,loop:h,disablePointerSelection:v=!1,vimBindings:O=!0,...y}=e,m=Ve(),S=Ve(),D=Ve(),E=b.useRef(null),C=Yi();Be(()=>{if(f!==void 0){let k=f.trim();n.current.value=k,M.emit()}},[f]),Be(()=>{C(6,Me)},[]);let M=b.useMemo(()=>({subscribe:k=>(a.current.add(k),()=>a.current.delete(k)),snapshot:()=>n.current,setState:(k,W,F)=>{var R,U,G,ee;if(!Object.is(n.current[k],W)){if(n.current[k]=W,k==="search")re(),Y(),C(1,Q);else if(k==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let X=document.getElementById(D);X?X.focus():(R=document.getElementById(m))==null||R.focus()}if(C(7,()=>{var X;n.current.selectedItemId=(X=le())==null?void 0:X.id,M.emit()}),F||C(5,Me),((U=s.current)==null?void 0:U.value)!==void 0){let X=W??"";(ee=(G=s.current).onValueChange)==null||ee.call(G,X);return}}M.emit()}},emit:()=>{a.current.forEach(k=>k())}}),[]),j=b.useMemo(()=>({value:(k,W,F)=>{var R;W!==((R=i.current.get(k))==null?void 0:R.value)&&(i.current.set(k,{value:W,keywords:F}),n.current.filtered.items.set(k,J(W,F)),C(2,()=>{Y(),M.emit()}))},item:(k,W)=>(r.current.add(k),W&&(o.current.has(W)?o.current.get(W).add(k):o.current.set(W,new Set([k]))),C(3,()=>{re(),Y(),n.current.value||Q(),M.emit()}),()=>{i.current.delete(k),r.current.delete(k),n.current.filtered.items.delete(k);let F=le();C(4,()=>{re(),F?.getAttribute("id")===k&&Q(),M.emit()})}),group:k=>(o.current.has(k)||o.current.set(k,new Set),()=>{i.current.delete(k),o.current.delete(k)}),filter:()=>s.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:m,inputId:D,labelId:S,listInnerRef:E}),[]);function J(k,W){var F,R;let U=(R=(F=s.current)==null?void 0:F.filter)!=null?R:Wi;return k?U(k,n.current.search,W):0}function Y(){if(!n.current.search||s.current.shouldFilter===!1)return;let k=n.current.filtered.items,W=[];n.current.filtered.groups.forEach(R=>{let U=o.current.get(R),G=0;U.forEach(ee=>{let X=k.get(ee);G=Math.max(X,G)}),W.push([R,G])});let F=E.current;de().sort((R,U)=>{var G,ee;let X=R.getAttribute("id"),ze=U.getAttribute("id");return((G=k.get(ze))!=null?G:0)-((ee=k.get(X))!=null?ee:0)}).forEach(R=>{let U=R.closest(Ut);U?U.appendChild(R.parentElement===U?R:R.closest(`${Ut} > *`)):F.appendChild(R.parentElement===F?R:R.closest(`${Ut} > *`))}),W.sort((R,U)=>U[1]-R[1]).forEach(R=>{var U;let G=(U=E.current)==null?void 0:U.querySelector(`${nt}[${qe}="${encodeURIComponent(R[0])}"]`);G?.parentElement.appendChild(G)})}function Q(){let k=de().find(F=>F.getAttribute("aria-disabled")!=="true"),W=k?.getAttribute(qe);M.setState("value",W||void 0)}function re(){var k,W,F,R;if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let U=0;for(let G of r.current){let ee=(W=(k=i.current.get(G))==null?void 0:k.value)!=null?W:"",X=(R=(F=i.current.get(G))==null?void 0:F.keywords)!=null?R:[],ze=J(ee,X);n.current.filtered.items.set(G,ze),ze>0&&U++}for(let[G,ee]of o.current)for(let X of ee)if(n.current.filtered.items.get(X)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=U}function Me(){var k,W,F;let R=le();R&&(((k=R.parentElement)==null?void 0:k.firstChild)===R&&((F=(W=R.closest(nt))==null?void 0:W.querySelector(Ri))==null||F.scrollIntoView({block:"nearest"})),R.scrollIntoView({block:"nearest"}))}function le(){var k;return(k=E.current)==null?void 0:k.querySelector(`${fr}[aria-selected="true"]`)}function de(){var k;return Array.from(((k=E.current)==null?void 0:k.querySelectorAll(kn))||[])}function Ie(k){let W=de()[k];W&&M.setState("value",W.getAttribute(qe))}function je(k){var W;let F=le(),R=de(),U=R.findIndex(ee=>ee===F),G=R[U+k];(W=s.current)!=null&&W.loop&&(G=U+k<0?R[R.length-1]:U+k===R.length?R[0]:R[U+k]),G&&M.setState("value",G.getAttribute(qe))}function ie(k){let W=le(),F=W?.closest(nt),R;for(;F&&!R;)F=k>0?Ui(F,nt):zi(F,nt),R=F?.querySelector(kn);R?M.setState("value",R.getAttribute(qe)):je(k)}let se=()=>Ie(de().length-1),pe=k=>{k.preventDefault(),k.metaKey?se():k.altKey?ie(1):je(1)},Ue=k=>{k.preventDefault(),k.metaKey?Ie(0):k.altKey?ie(-1):je(-1)};return b.createElement(_e.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:k=>{var W;(W=y.onKeyDown)==null||W.call(y,k);let F=k.nativeEvent.isComposing||k.keyCode===229;if(!(k.defaultPrevented||F))switch(k.key){case"n":case"j":{O&&k.ctrlKey&&pe(k);break}case"ArrowDown":{pe(k);break}case"p":case"k":{O&&k.ctrlKey&&Ue(k);break}case"ArrowUp":{Ue(k);break}case"Home":{k.preventDefault(),Ie(0);break}case"End":{k.preventDefault(),se();break}case"Enter":{k.preventDefault();let R=le();if(R){let U=new Event(en);R.dispatchEvent(U)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:Gi},l),It(e,k=>b.createElement(pr.Provider,{value:M},b.createElement(dr.Provider,{value:j},k))))}),Ai=b.forwardRef((e,t)=>{var n,r;let o=Ve(),i=b.useRef(null),a=b.useContext(hr),s=dt(),l=yr(e),u=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;Be(()=>{if(!u)return s.item(o,a?.id)},[u]);let f=vr(o,i,[e.value,e.children,i],e.keywords),c=cn(),d=We(C=>C.value&&C.value===f.current),p=We(C=>u||s.filter()===!1?!0:C.search?C.filtered.items.get(o)>0:!0);b.useEffect(()=>{let C=i.current;if(!(!C||e.disabled))return C.addEventListener(en,h),()=>C.removeEventListener(en,h)},[p,e.onSelect,e.disabled]);function h(){var C,M;v(),(M=(C=l.current).onSelect)==null||M.call(C,f.current)}function v(){c.setState("value",f.current,!0)}if(!p)return null;let{disabled:O,value:y,onSelect:m,forceMount:S,keywords:D,...E}=e;return b.createElement(_e.div,{ref:ct(i,t),...E,id:o,"cmdk-item":"",role:"option","aria-disabled":!!O,"aria-selected":!!d,"data-disabled":!!O,"data-selected":!!d,onPointerMove:O||s.getDisablePointerSelection()?void 0:v,onClick:O?void 0:h},e.children)}),_i=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,a=Ve(),s=b.useRef(null),l=b.useRef(null),u=Ve(),f=dt(),c=We(p=>o||f.filter()===!1?!0:p.search?p.filtered.groups.has(a):!0);Be(()=>f.group(a),[]),vr(a,s,[e.value,e.heading,l]);let d=b.useMemo(()=>({id:a,forceMount:o}),[o]);return b.createElement(_e.div,{ref:ct(s,t),...i,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),It(e,p=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(hr.Provider,{value:d},p))))}),ji=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=b.useRef(null),i=We(a=>!a.search);return!n&&!i?null:b.createElement(_e.div,{ref:ct(o,t),...r,"cmdk-separator":"",role:"separator"})}),Fi=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=cn(),a=We(u=>u.search),s=We(u=>u.selectedItemId),l=dt();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(_e.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":s,id:l.inputId,type:"text",value:o?e.value:a,onChange:u=>{o||i.setState("search",u.target.value),n?.(u.target.value)}})}),Li=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=b.useRef(null),a=b.useRef(null),s=We(u=>u.selectedItemId),l=dt();return b.useEffect(()=>{if(a.current&&i.current){let u=a.current,f=i.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let p=u.offsetHeight;f.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return d.observe(u),()=>{cancelAnimationFrame(c),d.unobserve(u)}}},[]),b.createElement(_e.div,{ref:ct(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:l.listId},It(e,u=>b.createElement("div",{ref:ct(a,l.listInnerRef),"cmdk-list-sizer":""},u)))}),Bi=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:a,...s}=e;return b.createElement(Bo,{open:n,onOpenChange:r},b.createElement($o,{container:a},b.createElement(Ho,{"cmdk-overlay":"",className:o}),b.createElement(Uo,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(mr,{ref:t,...s}))))}),$i=b.forwardRef((e,t)=>We(n=>n.filtered.count===0)?b.createElement(_e.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Hi=b.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return b.createElement(_e.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},It(e,a=>b.createElement("div",{"aria-hidden":!0},a)))}),ou=Object.assign(mr,{List:Li,Item:Ai,Input:Fi,Group:_i,Separator:ji,Dialog:Bi,Empty:$i,Loading:Hi});function Ui(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function zi(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function yr(e){let t=b.useRef(e);return Be(()=>{t.current=e}),t}var Be=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Ge(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function We(e){let t=cn(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function vr(e,t,n,r=[]){let o=b.useRef(),i=dt();return Be(()=>{var a;let s=(()=>{var u;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():o.current}})(),l=r.map(u=>u.trim());i.value(e,s,l),(a=t.current)==null||a.setAttribute(qe,s),o.current=s}),o}var Yi=()=>{let[e,t]=b.useState(),n=Ge(()=>new Map);return Be(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function qi(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function It({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(qi(t),{ref:t.ref},n(t.props.children)):n(t)}var Gi={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function gr(e){return t=>typeof t===e}var Vi=gr("function"),Ki=e=>e===null,Cn=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Tn=e=>!Zi(e)&&!Ki(e)&&(Vi(e)||typeof e=="object"),Zi=gr("undefined");function Ji(e,t){const{length:n}=e;if(n!==t.length)return!1;for(let r=n;r--!==0;)if(!oe(e[r],t[r]))return!1;return!0}function Xi(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function Qi(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!oe(n[1],t.get(n[0])))return!1;return!0}function es(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function oe(e,t){if(e===t)return!0;if(e&&Tn(e)&&t&&Tn(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return Ji(e,t);if(e instanceof Map&&t instanceof Map)return Qi(e,t);if(e instanceof Set&&t instanceof Set)return es(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Xi(e,t);if(Cn(e)&&Cn(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(let o=n.length;o--!==0;){const i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!oe(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}var ts=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],ns=["bigint","boolean","null","number","string","symbol","undefined"];function Rt(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(rs(t))return t}function ge(e){return t=>Rt(t)===e}function rs(e){return ts.includes(e)}function Qe(e){return t=>typeof t===e}function os(e){return ns.includes(e)}var is=["innerHTML","ownerDocument","style","attributes","nodeValue"];function x(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(x.array(e))return"Array";if(x.plainFunction(e))return"Function";const t=Rt(e);return t||"Object"}x.array=Array.isArray;x.arrayOf=(e,t)=>!x.array(e)&&!x.function(t)?!1:e.every(n=>t(n));x.asyncGeneratorFunction=e=>Rt(e)==="AsyncGeneratorFunction";x.asyncFunction=ge("AsyncFunction");x.bigint=Qe("bigint");x.boolean=e=>e===!0||e===!1;x.date=ge("Date");x.defined=e=>!x.undefined(e);x.domElement=e=>x.object(e)&&!x.plainObject(e)&&e.nodeType===1&&x.string(e.nodeName)&&is.every(t=>t in e);x.empty=e=>x.string(e)&&e.length===0||x.array(e)&&e.length===0||x.object(e)&&!x.map(e)&&!x.set(e)&&Object.keys(e).length===0||x.set(e)&&e.size===0||x.map(e)&&e.size===0;x.error=ge("Error");x.function=Qe("function");x.generator=e=>x.iterable(e)&&x.function(e.next)&&x.function(e.throw);x.generatorFunction=ge("GeneratorFunction");x.instanceOf=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype;x.iterable=e=>!x.nullOrUndefined(e)&&x.function(e[Symbol.iterator]);x.map=ge("Map");x.nan=e=>Number.isNaN(e);x.null=e=>e===null;x.nullOrUndefined=e=>x.null(e)||x.undefined(e);x.number=e=>Qe("number")(e)&&!x.nan(e);x.numericString=e=>x.string(e)&&e.length>0&&!Number.isNaN(Number(e));x.object=e=>!x.nullOrUndefined(e)&&(x.function(e)||typeof e=="object");x.oneOf=(e,t)=>x.array(e)?e.indexOf(t)>-1:!1;x.plainFunction=ge("Function");x.plainObject=e=>{if(Rt(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};x.primitive=e=>x.null(e)||os(typeof e);x.promise=ge("Promise");x.propertyOf=(e,t,n)=>{if(!x.object(e)||!t)return!1;const r=e[t];return x.function(n)?n(r):x.defined(r)};x.regexp=ge("RegExp");x.set=ge("Set");x.string=Qe("string");x.symbol=Qe("symbol");x.undefined=Qe("undefined");x.weakMap=ge("WeakMap");x.weakSet=ge("WeakSet");var N=x;function ss(...e){return e.every(t=>N.string(t)||N.array(t)||N.plainObject(t))}function as(e,t,n){return br(e,t)?[e,t].every(N.array)?!e.some(Dn(n))&&t.some(Dn(n)):[e,t].every(N.plainObject)?!Object.entries(e).some(Pn(n))&&Object.entries(t).some(Pn(n)):t===n:!1}function Mn(e,t,n){const{actual:r,key:o,previous:i,type:a}=n,s=Ee(e,o),l=Ee(t,o);let u=[s,l].every(N.number)&&(a==="increased"?sl);return N.undefined(r)||(u=u&&l===r),N.undefined(i)||(u=u&&s===i),u}function xn(e,t,n){const{key:r,type:o,value:i}=n,a=Ee(e,r),s=Ee(t,r),l=o==="added"?a:s,u=o==="added"?s:a;if(!N.nullOrUndefined(i)){if(N.defined(l)){if(N.array(l)||N.plainObject(l))return as(l,u,i)}else return oe(u,i);return!1}return[a,s].every(N.array)?!u.every(un(l)):[a,s].every(N.plainObject)?ls(Object.keys(l),Object.keys(u)):![a,s].every(f=>N.primitive(f)&&N.defined(f))&&(o==="added"?!N.defined(a)&&N.defined(s):N.defined(a)&&!N.defined(s))}function Nn(e,t,{key:n}={}){let r=Ee(e,n),o=Ee(t,n);if(!br(r,o))throw new TypeError("Inputs have different types");if(!ss(r,o))throw new TypeError("Inputs don't have length");return[r,o].every(N.plainObject)&&(r=Object.keys(r),o=Object.keys(o)),[r,o]}function Pn(e){return([t,n])=>N.array(e)?oe(e,n)||e.some(r=>oe(r,n)||N.array(n)&&un(n)(r)):N.plainObject(e)&&e[t]?!!e[t]&&oe(e[t],n):oe(e,n)}function ls(e,t){return t.some(n=>!e.includes(n))}function Dn(e){return t=>N.array(e)?e.some(n=>oe(n,t)||N.array(t)&&un(t)(n)):oe(e,t)}function rt(e,t){return N.array(e)?e.some(n=>oe(n,t)):oe(e,t)}function un(e){return t=>e.some(n=>oe(n,t))}function br(...e){return e.every(N.array)||e.every(N.number)||e.every(N.plainObject)||e.every(N.string)}function Ee(e,t){return N.plainObject(e)||N.array(e)?N.string(t)?t.split(".").reduce((r,o)=>r&&r[o],e):N.number(t)?e[t]:e:e}function Mt(e,t){if([e,t].some(N.nullOrUndefined))throw new Error("Missing required parameters");if(![e,t].every(f=>N.plainObject(f)||N.array(f)))throw new Error("Expected plain objects or array");return{added:(f,c)=>{try{return xn(e,t,{key:f,type:"added",value:c})}catch{return!1}},changed:(f,c,d)=>{try{const p=Ee(e,f),h=Ee(t,f),v=N.defined(c),O=N.defined(d);if(v||O){const y=O?rt(d,p):!rt(c,p),m=rt(c,h);return y&&m}return[p,h].every(N.array)||[p,h].every(N.plainObject)?!oe(p,h):p!==h}catch{return!1}},changedFrom:(f,c,d)=>{if(!N.defined(f))return!1;try{const p=Ee(e,f),h=Ee(t,f),v=N.defined(d);return rt(c,p)&&(v?rt(d,h):!v)}catch{return!1}},decreased:(f,c,d)=>{if(!N.defined(f))return!1;try{return Mn(e,t,{key:f,actual:c,previous:d,type:"decreased"})}catch{return!1}},emptied:f=>{try{const[c,d]=Nn(e,t,{key:f});return!!c.length&&!d.length}catch{return!1}},filled:f=>{try{const[c,d]=Nn(e,t,{key:f});return!c.length&&!!d.length}catch{return!1}},increased:(f,c,d)=>{if(!N.defined(f))return!1;try{return Mn(e,t,{key:f,actual:c,previous:d,type:"increased"})}catch{return!1}},removed:(f,c)=>{try{return xn(e,t,{key:f,type:"removed",value:c})}catch{return!1}}}}var zt,In;function cs(){if(In)return zt;In=1;var e=new Error("Element already at target scroll position"),t=new Error("Scroll cancelled"),n=Math.min,r=Date.now;zt={left:o("scrollLeft"),top:o("scrollTop")};function o(s){return function(u,f,c,d){c=c||{},typeof c=="function"&&(d=c,c={}),typeof d!="function"&&(d=a);var p=r(),h=u[s],v=c.ease||i,O=isNaN(c.duration)?350:+c.duration,y=!1;return h===f?d(e,u[s]):requestAnimationFrame(S),m;function m(){y=!0}function S(D){if(y)return d(t,u[s]);var E=r(),C=n(1,(E-p)/O),M=v(C);u[s]=M*(f-h)+h,C<1?requestAnimationFrame(S):requestAnimationFrame(function(){d(null,u[s])})}}}function i(s){return .5*(1-Math.cos(Math.PI*s))}function a(){}return zt}var us=cs();const fs=Dt(us);var Ct={exports:{}},ds=Ct.exports,Rn;function ps(){return Rn||(Rn=1,(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(ds,function(){function t(r){var o=getComputedStyle(r,null).getPropertyValue("overflow");return o.indexOf("scroll")>-1||o.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var o=r.parentNode;o.parentNode;){if(t(o))return o;o=o.parentNode}return document.scrollingElement||document.documentElement}}return n})})(Ct)),Ct.exports}var hs=ps();const wr=Dt(hs);var Yt,Wn;function ms(){if(Wn)return Yt;Wn=1;var e=function(r){return Object.prototype.hasOwnProperty.call(r,"props")},t=function(r,o){return r+n(o)},n=function(r){return r===null||typeof r=="boolean"||typeof r>"u"?"":typeof r=="number"?r.toString():typeof r=="string"?r:Array.isArray(r)?r.reduce(t,""):e(r)&&Object.prototype.hasOwnProperty.call(r.props,"children")?n(r.props.children):""};return n.default=n,Yt=n,Yt}var ys=ms();const An=Dt(ys);var qt,_n;function vs(){if(_n)return qt;_n=1;var e=function(m){return t(m)&&!n(m)};function t(y){return!!y&&typeof y=="object"}function n(y){var m=Object.prototype.toString.call(y);return m==="[object RegExp]"||m==="[object Date]"||i(y)}var r=typeof Symbol=="function"&&Symbol.for,o=r?Symbol.for("react.element"):60103;function i(y){return y.$$typeof===o}function a(y){return Array.isArray(y)?[]:{}}function s(y,m){return m.clone!==!1&&m.isMergeableObject(y)?v(a(y),y,m):y}function l(y,m,S){return y.concat(m).map(function(D){return s(D,S)})}function u(y,m){if(!m.customMerge)return v;var S=m.customMerge(y);return typeof S=="function"?S:v}function f(y){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(y).filter(function(m){return Object.propertyIsEnumerable.call(y,m)}):[]}function c(y){return Object.keys(y).concat(f(y))}function d(y,m){try{return m in y}catch{return!1}}function p(y,m){return d(y,m)&&!(Object.hasOwnProperty.call(y,m)&&Object.propertyIsEnumerable.call(y,m))}function h(y,m,S){var D={};return S.isMergeableObject(y)&&c(y).forEach(function(E){D[E]=s(y[E],S)}),c(m).forEach(function(E){p(y,E)||(d(y,E)&&S.isMergeableObject(m[E])?D[E]=u(E,S)(y[E],m[E],S):D[E]=s(m[E],S))}),D}function v(y,m,S){S=S||{},S.arrayMerge=S.arrayMerge||l,S.isMergeableObject=S.isMergeableObject||e,S.cloneUnlessOtherwiseSpecified=s;var D=Array.isArray(m),E=Array.isArray(y),C=D===E;return C?D?S.arrayMerge(y,m,S):h(y,m,S):s(m,S)}v.all=function(m,S){if(!Array.isArray(m))throw new Error("first argument should be an array");return m.reduce(function(D,E){return v(D,E,S)},{})};var O=v;return qt=O,qt}var gs=vs();const ye=Dt(gs);var pt=typeof window<"u"&&typeof document<"u"&&typeof navigator<"u",bs=(function(){for(var e=["Edge","Trident","Firefox"],t=0;t=0)return 1;return 0})();function ws(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}function Os(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},bs))}}var Ss=pt&&window.Promise,Es=Ss?ws:Os;function Or(e){var t={};return e&&t.toString.call(e)==="[object Function]"}function He(e,t){if(e.nodeType!==1)return[];var n=e.ownerDocument.defaultView,r=n.getComputedStyle(e,null);return t?r[t]:r}function fn(e){return e.nodeName==="HTML"?e:e.parentNode||e.host}function ht(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=He(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+r)?e:ht(fn(e))}function Sr(e){return e&&e.referenceNode?e.referenceNode:e}var jn=pt&&!!(window.MSInputMethodContext&&document.documentMode),Fn=pt&&/MSIE 10/.test(navigator.userAgent);function et(e){return e===11?jn:e===10?Fn:jn||Fn}function Ke(e){if(!e)return document.documentElement;for(var t=et(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var r=n&&n.nodeName;return!r||r==="BODY"||r==="HTML"?e?e.ownerDocument.documentElement:document.documentElement:["TH","TD","TABLE"].indexOf(n.nodeName)!==-1&&He(n,"position")==="static"?Ke(n):n}function ks(e){var t=e.nodeName;return t==="BODY"?!1:t==="HTML"||Ke(e.firstElementChild)===e}function tn(e){return e.parentNode!==null?tn(e.parentNode):e}function xt(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?e:t,o=n?t:e,i=document.createRange();i.setStart(r,0),i.setEnd(o,0);var a=i.commonAncestorContainer;if(e!==a&&t!==a||r.contains(o))return ks(a)?a:Ke(a);var s=tn(e);return s.host?xt(s.host,t):xt(e,tn(t).host)}function Ze(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top",n=t==="top"?"scrollTop":"scrollLeft",r=e.nodeName;if(r==="BODY"||r==="HTML"){var o=e.ownerDocument.documentElement,i=e.ownerDocument.scrollingElement||o;return i[n]}return e[n]}function Cs(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=Ze(t,"top"),o=Ze(t,"left"),i=n?-1:1;return e.top+=r*i,e.bottom+=r*i,e.left+=o*i,e.right+=o*i,e}function Ln(e,t){var n=t==="x"?"Left":"Top",r=n==="Left"?"Right":"Bottom";return parseFloat(e["border"+n+"Width"])+parseFloat(e["border"+r+"Width"])}function Bn(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],et(10)?parseInt(n["offset"+e])+parseInt(r["margin"+(e==="Height"?"Top":"Left")])+parseInt(r["margin"+(e==="Height"?"Bottom":"Right")]):0)}function Er(e){var t=e.body,n=e.documentElement,r=et(10)&&getComputedStyle(n);return{height:Bn("Height",t,n,r),width:Bn("Width",t,n,r)}}var Ts=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Ms=(function(){function e(t,n){for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=et(10),o=t.nodeName==="HTML",i=nn(e),a=nn(t),s=ht(e),l=He(t),u=parseFloat(l.borderTopWidth),f=parseFloat(l.borderLeftWidth);n&&o&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var c=Ae({top:i.top-a.top-u,left:i.left-a.left-f,width:i.width,height:i.height});if(c.marginTop=0,c.marginLeft=0,!r&&o){var d=parseFloat(l.marginTop),p=parseFloat(l.marginLeft);c.top-=u-d,c.bottom-=u-d,c.left-=f-p,c.right-=f-p,c.marginTop=d,c.marginLeft=p}return(r&&!n?t.contains(s):t===s&&s.nodeName!=="BODY")&&(c=Cs(c,t)),c}function xs(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=e.ownerDocument.documentElement,r=dn(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),a=t?0:Ze(n),s=t?0:Ze(n,"left"),l={top:a-r.top+r.marginTop,left:s-r.left+r.marginLeft,width:o,height:i};return Ae(l)}function kr(e){var t=e.nodeName;if(t==="BODY"||t==="HTML")return!1;if(He(e,"position")==="fixed")return!0;var n=fn(e);return n?kr(n):!1}function Cr(e){if(!e||!e.parentElement||et())return document.documentElement;for(var t=e.parentElement;t&&He(t,"transform")==="none";)t=t.parentElement;return t||document.documentElement}function pn(e,t,n,r){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,i={top:0,left:0},a=o?Cr(e):xt(e,Sr(t));if(r==="viewport")i=xs(a,o);else{var s=void 0;r==="scrollParent"?(s=ht(fn(t)),s.nodeName==="BODY"&&(s=e.ownerDocument.documentElement)):r==="window"?s=e.ownerDocument.documentElement:s=r;var l=dn(s,a,o);if(s.nodeName==="HTML"&&!kr(a)){var u=Er(e.ownerDocument),f=u.height,c=u.width;i.top+=l.top-l.marginTop,i.bottom=f+l.top,i.left+=l.left-l.marginLeft,i.right=c+l.left}else i=l}n=n||0;var d=typeof n=="number";return i.left+=d?n:n.left||0,i.top+=d?n:n.top||0,i.right-=d?n:n.right||0,i.bottom-=d?n:n.bottom||0,i}function Ns(e){var t=e.width,n=e.height;return t*n}function Tr(e,t,n,r,o){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(e.indexOf("auto")===-1)return e;var a=pn(n,r,i,o),s={top:{width:a.width,height:t.top-a.top},right:{width:a.right-t.right,height:a.height},bottom:{width:a.width,height:a.bottom-t.bottom},left:{width:t.left-a.left,height:a.height}},l=Object.keys(s).map(function(d){return he({key:d},s[d],{area:Ns(s[d])})}).sort(function(d,p){return p.area-d.area}),u=l.filter(function(d){var p=d.width,h=d.height;return p>=n.clientWidth&&h>=n.clientHeight}),f=u.length>0?u[0].key:l[0].key,c=e.split("-")[1];return f+(c?"-"+c:"")}function Mr(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o=r?Cr(t):xt(t,Sr(n));return dn(n,o,r)}function xr(e){var t=e.ownerDocument.defaultView,n=t.getComputedStyle(e),r=parseFloat(n.marginTop||0)+parseFloat(n.marginBottom||0),o=parseFloat(n.marginLeft||0)+parseFloat(n.marginRight||0),i={width:e.offsetWidth+o,height:e.offsetHeight+r};return i}function Nt(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(n){return t[n]})}function Nr(e,t,n){n=n.split("-")[0];var r=xr(e),o={width:r.width,height:r.height},i=["right","left"].indexOf(n)!==-1,a=i?"top":"left",s=i?"left":"top",l=i?"height":"width",u=i?"width":"height";return o[a]=t[a]+t[l]/2-r[l]/2,n===s?o[s]=t[s]-r[u]:o[s]=t[Nt(s)],o}function mt(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function Ps(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(o){return o[t]===n});var r=mt(e,function(o){return o[t]===n});return e.indexOf(r)}function Pr(e,t,n){var r=n===void 0?e:e.slice(0,Ps(e,"name",n));return r.forEach(function(o){o.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var i=o.function||o.fn;o.enabled&&Or(i)&&(t.offsets.popper=Ae(t.offsets.popper),t.offsets.reference=Ae(t.offsets.reference),t=i(t,o))}),t}function Ds(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=Mr(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=Tr(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=Nr(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=Pr(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function Dr(e,t){return e.some(function(n){var r=n.name,o=n.enabled;return o&&r===t})}function hn(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),r=0;ra[p]&&(e.offsets.popper[c]+=s[c]+h-a[p]),e.offsets.popper=Ae(e.offsets.popper);var v=s[c]+s[u]/2-h/2,O=He(e.instance.popper),y=parseFloat(O["margin"+f]),m=parseFloat(O["border"+f+"Width"]),S=v-e.offsets.popper[c]-y-m;return S=Math.max(Math.min(a[u]-h,S),0),e.arrowElement=r,e.offsets.arrow=(n={},Je(n,c,Math.round(S)),Je(n,d,""),n),e}function zs(e){return e==="end"?"start":e==="start"?"end":e}var Ar=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],Gt=Ar.slice(3);function $n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=Gt.indexOf(e),r=Gt.slice(n+1).concat(Gt.slice(0,n));return t?r.reverse():r}var Vt={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function Ys(e,t){if(Dr(e.instance.modifiers,"inner")||e.flipped&&e.placement===e.originalPlacement)return e;var n=pn(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),r=e.placement.split("-")[0],o=Nt(r),i=e.placement.split("-")[1]||"",a=[];switch(t.behavior){case Vt.FLIP:a=[r,o];break;case Vt.CLOCKWISE:a=$n(r);break;case Vt.COUNTERCLOCKWISE:a=$n(r,!0);break;default:a=t.behavior}return a.forEach(function(s,l){if(r!==s||a.length===l+1)return e;r=e.placement.split("-")[0],o=Nt(r);var u=e.offsets.popper,f=e.offsets.reference,c=Math.floor,d=r==="left"&&c(u.right)>c(f.left)||r==="right"&&c(u.left)c(f.top)||r==="bottom"&&c(u.top)c(n.right),v=c(u.top)c(n.bottom),y=r==="left"&&p||r==="right"&&h||r==="top"&&v||r==="bottom"&&O,m=["top","bottom"].indexOf(r)!==-1,S=!!t.flipVariations&&(m&&i==="start"&&p||m&&i==="end"&&h||!m&&i==="start"&&v||!m&&i==="end"&&O),D=!!t.flipVariationsByContent&&(m&&i==="start"&&h||m&&i==="end"&&p||!m&&i==="start"&&O||!m&&i==="end"&&v),E=S||D;(d||y||E)&&(e.flipped=!0,(d||y)&&(r=a[l+1]),E&&(i=zs(i)),e.placement=r+(i?"-"+i:""),e.offsets.popper=he({},e.offsets.popper,Nr(e.instance.popper,e.offsets.reference,e.placement)),e=Pr(e.instance.modifiers,e,"flip"))}),e}function qs(e){var t=e.offsets,n=t.popper,r=t.reference,o=e.placement.split("-")[0],i=Math.floor,a=["top","bottom"].indexOf(o)!==-1,s=a?"right":"bottom",l=a?"left":"top",u=a?"width":"height";return n[s]i(r[s])&&(e.offsets.popper[l]=i(r[s])),e}function Gs(e,t,n,r){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+o[1],a=o[2];if(!i)return e;if(a.indexOf("%")===0){var s=void 0;switch(a){case"%p":s=n;break;case"%":case"%r":default:s=r}var l=Ae(s);return l[t]/100*i}else if(a==="vh"||a==="vw"){var u=void 0;return a==="vh"?u=Math.max(document.documentElement.clientHeight,window.innerHeight||0):u=Math.max(document.documentElement.clientWidth,window.innerWidth||0),u/100*i}else return i}function Vs(e,t,n,r){var o=[0,0],i=["right","left"].indexOf(r)!==-1,a=e.split(/(\+|\-)/).map(function(f){return f.trim()}),s=a.indexOf(mt(a,function(f){return f.search(/,|\s/)!==-1}));a[s]&&a[s].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,u=s!==-1?[a.slice(0,s).concat([a[s].split(l)[0]]),[a[s].split(l)[1]].concat(a.slice(s+1))]:[a];return u=u.map(function(f,c){var d=(c===1?!i:i)?"height":"width",p=!1;return f.reduce(function(h,v){return h[h.length-1]===""&&["+","-"].indexOf(v)!==-1?(h[h.length-1]=v,p=!0,h):p?(h[h.length-1]+=v,p=!1,h):h.concat(v)},[]).map(function(h){return Gs(h,d,t,n)})}),u.forEach(function(f,c){f.forEach(function(d,p){mn(d)&&(o[c]+=d*(f[p-1]==="-"?-1:1))})}),o}function Ks(e,t){var n=t.offset,r=e.placement,o=e.offsets,i=o.popper,a=o.reference,s=r.split("-")[0],l=void 0;return mn(+n)?l=[+n,0]:l=Vs(n,i,a,s),s==="left"?(i.top+=l[0],i.left-=l[1]):s==="right"?(i.top+=l[0],i.left+=l[1]):s==="top"?(i.left+=l[0],i.top-=l[1]):s==="bottom"&&(i.left+=l[0],i.top+=l[1]),e.popper=i,e}function Zs(e,t){var n=t.boundariesElement||Ke(e.instance.popper);e.instance.reference===n&&(n=Ke(n));var r=hn("transform"),o=e.instance.popper.style,i=o.top,a=o.left,s=o[r];o.top="",o.left="",o[r]="";var l=pn(e.instance.popper,e.instance.reference,t.padding,n,e.positionFixed);o.top=i,o.left=a,o[r]=s,t.boundaries=l;var u=t.priority,f=e.offsets.popper,c={primary:function(p){var h=f[p];return f[p]l[p]&&!t.escapeWithReference&&(v=Math.min(f[h],l[p]-(p==="right"?f.width:f.height))),Je({},h,v)}};return u.forEach(function(d){var p=["left","top"].indexOf(d)!==-1?"primary":"secondary";f=he({},f,c[p](d))}),e.offsets.popper=f,e}function Js(e){var t=e.placement,n=t.split("-")[0],r=t.split("-")[1];if(r){var o=e.offsets,i=o.reference,a=o.popper,s=["bottom","top"].indexOf(n)!==-1,l=s?"left":"top",u=s?"width":"height",f={start:Je({},l,i[l]),end:Je({},l,i[l]+i[u]-a[u])};e.offsets.popper=he({},a,f[r])}return e}function Xs(e){if(!Wr(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=mt(e.instance.modifiers,function(r){return r.name==="preventOverflow"}).boundaries;if(t.bottomn.right||t.top>n.bottom||t.right2&&arguments[2]!==void 0?arguments[2]:{};Ts(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=Es(this.update.bind(this)),this.options=he({},e.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=t&&t.jquery?t[0]:t,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(he({},e.Defaults.modifiers,o.modifiers)).forEach(function(a){r.options.modifiers[a]=he({},e.Defaults.modifiers[a]||{},o.modifiers?o.modifiers[a]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(a){return he({name:a},r.options.modifiers[a])}).sort(function(a,s){return a.order-s.order}),this.modifiers.forEach(function(a){a.enabled&&Or(a.onLoad)&&a.onLoad(r.reference,r.popper,r.options,a,r.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return Ms(e,[{key:"update",value:function(){return Ds.call(this)}},{key:"destroy",value:function(){return Is.call(this)}},{key:"enableEventListeners",value:function(){return Ws.call(this)}},{key:"disableEventListeners",value:function(){return _s.call(this)}}]),e})();ut.Utils=(typeof window<"u"?window:global).PopperUtils;ut.placements=Ar;ut.Defaults=ta;var na=["innerHTML","ownerDocument","style","attributes","nodeValue"],ra=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],oa=["bigint","boolean","null","number","string","symbol","undefined"];function Wt(e){var t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(ia(t))return t}function be(e){return function(t){return Wt(t)===e}}function ia(e){return ra.includes(e)}function tt(e){return function(t){return typeof t===e}}function sa(e){return oa.includes(e)}function g(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(g.array(e))return"Array";if(g.plainFunction(e))return"Function";var t=Wt(e);return t||"Object"}g.array=Array.isArray;g.arrayOf=function(e,t){return!g.array(e)&&!g.function(t)?!1:e.every(function(n){return t(n)})};g.asyncGeneratorFunction=function(e){return Wt(e)==="AsyncGeneratorFunction"};g.asyncFunction=be("AsyncFunction");g.bigint=tt("bigint");g.boolean=function(e){return e===!0||e===!1};g.date=be("Date");g.defined=function(e){return!g.undefined(e)};g.domElement=function(e){return g.object(e)&&!g.plainObject(e)&&e.nodeType===1&&g.string(e.nodeName)&&na.every(function(t){return t in e})};g.empty=function(e){return g.string(e)&&e.length===0||g.array(e)&&e.length===0||g.object(e)&&!g.map(e)&&!g.set(e)&&Object.keys(e).length===0||g.set(e)&&e.size===0||g.map(e)&&e.size===0};g.error=be("Error");g.function=tt("function");g.generator=function(e){return g.iterable(e)&&g.function(e.next)&&g.function(e.throw)};g.generatorFunction=be("GeneratorFunction");g.instanceOf=function(e,t){return!e||!t?!1:Object.getPrototypeOf(e)===t.prototype};g.iterable=function(e){return!g.nullOrUndefined(e)&&g.function(e[Symbol.iterator])};g.map=be("Map");g.nan=function(e){return Number.isNaN(e)};g.null=function(e){return e===null};g.nullOrUndefined=function(e){return g.null(e)||g.undefined(e)};g.number=function(e){return tt("number")(e)&&!g.nan(e)};g.numericString=function(e){return g.string(e)&&e.length>0&&!Number.isNaN(Number(e))};g.object=function(e){return!g.nullOrUndefined(e)&&(g.function(e)||typeof e=="object")};g.oneOf=function(e,t){return g.array(e)?e.indexOf(t)>-1:!1};g.plainFunction=be("Function");g.plainObject=function(e){if(Wt(e)!=="Object")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};g.primitive=function(e){return g.null(e)||sa(typeof e)};g.promise=be("Promise");g.propertyOf=function(e,t,n){if(!g.object(e)||!t)return!1;var r=e[t];return g.function(n)?n(r):g.defined(r)};g.regexp=be("RegExp");g.set=be("Set");g.string=tt("string");g.symbol=tt("symbol");g.undefined=tt("undefined");g.weakMap=be("WeakMap");g.weakSet=be("WeakSet");function _r(e){return function(t){return typeof t===e}}var aa=_r("function"),la=function(e){return e===null},Hn=function(e){return Object.prototype.toString.call(e).slice(8,-1)==="RegExp"},Un=function(e){return!ca(e)&&!la(e)&&(aa(e)||typeof e=="object")},ca=_r("undefined"),on=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function ua(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=n;r--!==0;)if(!ae(e[r],t[r]))return!1;return!0}function fa(e,t){if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e.buffer),r=new DataView(t.buffer),o=e.byteLength;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function da(e,t){var n,r,o,i;if(e.size!==t.size)return!1;try{for(var a=on(e.entries()),s=a.next();!s.done;s=a.next()){var l=s.value;if(!t.has(l[0]))return!1}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}try{for(var u=on(e.entries()),f=u.next();!f.done;f=u.next()){var l=f.value;if(!ae(l[1],t.get(l[0])))return!1}}catch(c){o={error:c}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}return!0}function pa(e,t){var n,r;if(e.size!==t.size)return!1;try{for(var o=on(e.entries()),i=o.next();!i.done;i=o.next()){var a=i.value;if(!t.has(a[0]))return!1}}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!0}function ae(e,t){if(e===t)return!0;if(e&&Un(e)&&t&&Un(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return ua(e,t);if(e instanceof Map&&t instanceof Map)return da(e,t);if(e instanceof Set&&t instanceof Set)return pa(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return fa(e,t);if(Hn(e)&&Hn(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(var o=n.length;o--!==0;){var i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!ae(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}function ha(){for(var e=[],t=0;tl);return g.undefined(r)||(u=u&&l===r),g.undefined(i)||(u=u&&s===i),u}function Yn(e,t,n){var r=n.key,o=n.type,i=n.value,a=ke(e,r),s=ke(t,r),l=o==="added"?a:s,u=o==="added"?s:a;if(!g.nullOrUndefined(i)){if(g.defined(l)){if(g.array(l)||g.plainObject(l))return ma(l,u,i)}else return ae(u,i);return!1}return[a,s].every(g.array)?!u.every(yn(l)):[a,s].every(g.plainObject)?ya(Object.keys(l),Object.keys(u)):![a,s].every(function(f){return g.primitive(f)&&g.defined(f)})&&(o==="added"?!g.defined(a)&&g.defined(s):g.defined(a)&&!g.defined(s))}function qn(e,t,n){var r=n===void 0?{}:n,o=r.key,i=ke(e,o),a=ke(t,o);if(!jr(i,a))throw new TypeError("Inputs have different types");if(!ha(i,a))throw new TypeError("Inputs don't have length");return[i,a].every(g.plainObject)&&(i=Object.keys(i),a=Object.keys(a)),[i,a]}function Gn(e){return function(t){var n=t[0],r=t[1];return g.array(e)?ae(e,r)||e.some(function(o){return ae(o,r)||g.array(r)&&yn(r)(o)}):g.plainObject(e)&&e[n]?!!e[n]&&ae(e[n],r):ae(e,r)}}function ya(e,t){return t.some(function(n){return!e.includes(n)})}function Vn(e){return function(t){return g.array(e)?e.some(function(n){return ae(n,t)||g.array(t)&&yn(t)(n)}):ae(e,t)}}function ot(e,t){return g.array(e)?e.some(function(n){return ae(n,t)}):ae(e,t)}function yn(e){return function(t){return e.some(function(n){return ae(n,t)})}}function jr(){for(var e=[],t=0;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function wa(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function Fr(e,t){if(e==null)return{};var n=wa(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oa(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xe(e)}function bt(e){var t=ba();return function(){var r=Pt(e),o;if(t){var i=Pt(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Oa(this,o)}}function Sa(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Lr(e){var t=Sa(e,"string");return typeof t=="symbol"?t:String(t)}var Ea={flip:{padding:20},preventOverflow:{padding:10}},ka="The typeValidator argument must be a function with the signature function(props, propName, componentName).",Ca="The error message is optional, but must be a string if provided.";function Ta(e,t,n,r){return typeof e=="boolean"?e:typeof e=="function"?e(t,n,r):e?!!e:!1}function Ma(e,t){return Object.hasOwnProperty.call(e,t)}function xa(e,t,n,r){return new Error("Required ".concat(e[t]," `").concat(t,"` was not specified in `").concat(n,"`."))}function Na(e,t){if(typeof e!="function")throw new TypeError(ka);if(t&&typeof t!="string")throw new TypeError(Ca)}function Zn(e,t,n){return Na(e,n),function(r,o,i){for(var a=arguments.length,s=new Array(a>3?a-3:0),l=3;l3&&arguments[3]!==void 0?arguments[3]:!1;e.addEventListener(t,n,r)}function Da(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;e.removeEventListener(t,n,r)}function Ia(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o;o=function(a){n(a),Da(e,t,o)},Pa(e,t,o,r)}function Jn(){}var Br=(function(e){gt(n,e);var t=bt(n);function n(){return yt(this,n),t.apply(this,arguments)}return vt(n,[{key:"componentDidMount",value:function(){Oe()&&(this.node||this.appendNode(),it||this.renderPortal())}},{key:"componentDidUpdate",value:function(){Oe()&&(it||this.renderPortal())}},{key:"componentWillUnmount",value:function(){!Oe()||!this.node||(it||Et.unmountComponentAtNode(this.node),this.node&&this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=void 0))}},{key:"appendNode",value:function(){var o=this.props,i=o.id,a=o.zIndex;this.node||(this.node=document.createElement("div"),i&&(this.node.id=i),a&&(this.node.style.zIndex=a),document.body.appendChild(this.node))}},{key:"renderPortal",value:function(){if(!Oe())return null;var o=this.props,i=o.children,a=o.setRef;if(this.node||this.appendNode(),it)return Et.createPortal(i,this.node);var s=Et.unstable_renderSubtreeIntoContainer(this,i.length>1?w.createElement("div",null,i):i[0],this.node);return a(s),null}},{key:"renderReact16",value:function(){var o=this.props,i=o.hasChildren,a=o.placement,s=o.target;return i?this.renderPortal():s||a==="center"?this.renderPortal():null}},{key:"render",value:function(){return it?this.renderReact16():null}}]),n})(w.Component);ne(Br,"propTypes",{children:T.oneOfType([T.element,T.array]),hasChildren:T.bool,id:T.oneOfType([T.string,T.number]),placement:T.string,setRef:T.func.isRequired,target:T.oneOfType([T.object,T.string]),zIndex:T.number});var $r=(function(e){gt(n,e);var t=bt(n);function n(){return yt(this,n),t.apply(this,arguments)}return vt(n,[{key:"parentStyle",get:function(){var o=this.props,i=o.placement,a=o.styles,s=a.arrow.length,l={pointerEvents:"none",position:"absolute",width:"100%"};return i.startsWith("top")?(l.bottom=0,l.left=0,l.right=0,l.height=s):i.startsWith("bottom")?(l.left=0,l.right=0,l.top=0,l.height=s):i.startsWith("left")?(l.right=0,l.top=0,l.bottom=0):i.startsWith("right")&&(l.left=0,l.top=0),l}},{key:"render",value:function(){var o=this.props,i=o.placement,a=o.setArrowRef,s=o.styles,l=s.arrow,u=l.color,f=l.display,c=l.length,d=l.margin,p=l.position,h=l.spread,v={display:f,position:p},O,y=h,m=c;return i.startsWith("top")?(O="0,0 ".concat(y/2,",").concat(m," ").concat(y,",0"),v.bottom=0,v.marginLeft=d,v.marginRight=d):i.startsWith("bottom")?(O="".concat(y,",").concat(m," ").concat(y/2,",0 0,").concat(m),v.top=0,v.marginLeft=d,v.marginRight=d):i.startsWith("left")?(m=h,y=c,O="0,0 ".concat(y,",").concat(m/2," 0,").concat(m),v.right=0,v.marginTop=d,v.marginBottom=d):i.startsWith("right")&&(m=h,y=c,O="".concat(y,",").concat(m," ").concat(y,",0 0,").concat(m/2),v.left=0,v.marginTop=d,v.marginBottom=d),w.createElement("div",{className:"__floater__arrow",style:this.parentStyle},w.createElement("span",{ref:a,style:v},w.createElement("svg",{width:y,height:m,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},w.createElement("polygon",{points:O,fill:u}))))}}]),n})(w.Component);ne($r,"propTypes",{placement:T.string.isRequired,setArrowRef:T.func.isRequired,styles:T.object.isRequired});var Ra=["color","height","width"];function Hr(e){var t=e.handleClick,n=e.styles,r=n.color,o=n.height,i=n.width,a=Fr(n,Ra);return w.createElement("button",{"aria-label":"close",onClick:t,style:a,type:"button"},w.createElement("svg",{width:"".concat(i,"px"),height:"".concat(o,"px"),viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid"},w.createElement("g",null,w.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:r}))))}Hr.propTypes={handleClick:T.func.isRequired,styles:T.object.isRequired};function Ur(e){var t=e.content,n=e.footer,r=e.handleClick,o=e.open,i=e.positionWrapper,a=e.showCloseButton,s=e.title,l=e.styles,u={content:w.isValidElement(t)?t:w.createElement("div",{className:"__floater__content",style:l.content},t)};return s&&(u.title=w.isValidElement(s)?s:w.createElement("div",{className:"__floater__title",style:l.title},s)),n&&(u.footer=w.isValidElement(n)?n:w.createElement("div",{className:"__floater__footer",style:l.footer},n)),(a||i)&&!g.boolean(o)&&(u.close=w.createElement(Hr,{styles:l.close,handleClick:r})),w.createElement("div",{className:"__floater__container",style:l.container},u.close,u.title,u.content,u.footer)}Ur.propTypes={content:T.node.isRequired,footer:T.node,handleClick:T.func.isRequired,open:T.bool,positionWrapper:T.bool.isRequired,showCloseButton:T.bool.isRequired,styles:T.object.isRequired,title:T.node};var zr=(function(e){gt(n,e);var t=bt(n);function n(){return yt(this,n),t.apply(this,arguments)}return vt(n,[{key:"style",get:function(){var o=this.props,i=o.disableAnimation,a=o.component,s=o.placement,l=o.hideArrow,u=o.status,f=o.styles,c=f.arrow.length,d=f.floater,p=f.floaterCentered,h=f.floaterClosing,v=f.floaterOpening,O=f.floaterWithAnimation,y=f.floaterWithComponent,m={};return l||(s.startsWith("top")?m.padding="0 0 ".concat(c,"px"):s.startsWith("bottom")?m.padding="".concat(c,"px 0 0"):s.startsWith("left")?m.padding="0 ".concat(c,"px 0 0"):s.startsWith("right")&&(m.padding="0 0 0 ".concat(c,"px"))),[$.OPENING,$.OPEN].indexOf(u)!==-1&&(m=K(K({},m),v)),u===$.CLOSING&&(m=K(K({},m),h)),u===$.OPEN&&!i&&(m=K(K({},m),O)),s==="center"&&(m=K(K({},m),p)),a&&(m=K(K({},m),y)),K(K({},d),m)}},{key:"render",value:function(){var o=this.props,i=o.component,a=o.handleClick,s=o.hideArrow,l=o.setFloaterRef,u=o.status,f={},c=["__floater"];return i?w.isValidElement(i)?f.content=w.cloneElement(i,{closeFn:a}):f.content=i({closeFn:a}):f.content=w.createElement(Ur,this.props),u===$.OPEN&&c.push("__floater__open"),s||(f.arrow=w.createElement($r,this.props)),w.createElement("div",{ref:l,className:c.join(" "),style:this.style},w.createElement("div",{className:"__floater__body"},f.content,f.arrow))}}]),n})(w.Component);ne(zr,"propTypes",{component:T.oneOfType([T.func,T.element]),content:T.node,disableAnimation:T.bool.isRequired,footer:T.node,handleClick:T.func.isRequired,hideArrow:T.bool.isRequired,open:T.bool,placement:T.string.isRequired,positionWrapper:T.bool.isRequired,setArrowRef:T.func.isRequired,setFloaterRef:T.func.isRequired,showCloseButton:T.bool,status:T.string.isRequired,styles:T.object.isRequired,title:T.node});var Yr=(function(e){gt(n,e);var t=bt(n);function n(){return yt(this,n),t.apply(this,arguments)}return vt(n,[{key:"render",value:function(){var o=this.props,i=o.children,a=o.handleClick,s=o.handleMouseEnter,l=o.handleMouseLeave,u=o.setChildRef,f=o.setWrapperRef,c=o.style,d=o.styles,p;if(i)if(w.Children.count(i)===1)if(!w.isValidElement(i))p=w.createElement("span",null,i);else{var h=g.function(i.type)?"innerRef":"ref";p=w.cloneElement(w.Children.only(i),ne({},h,u))}else p=i;return p?w.createElement("span",{ref:f,style:K(K({},d),c),onClick:a,onMouseEnter:s,onMouseLeave:l},p):null}}]),n})(w.Component);ne(Yr,"propTypes",{children:T.node,handleClick:T.func.isRequired,handleMouseEnter:T.func.isRequired,handleMouseLeave:T.func.isRequired,setChildRef:T.func.isRequired,setWrapperRef:T.func.isRequired,style:T.object,styles:T.object.isRequired});var Wa={zIndex:100};function Aa(e){var t=ye(Wa,e.options||{});return{wrapper:{cursor:"help",display:"inline-flex",flexDirection:"column",zIndex:t.zIndex},wrapperPosition:{left:-1e3,position:"absolute",top:-1e3,visibility:"hidden"},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:300,opacity:0,position:"relative",transition:"opacity 0.3s",visibility:"hidden",zIndex:t.zIndex},floaterOpening:{opacity:1,visibility:"visible"},floaterWithAnimation:{opacity:1,transition:"opacity 0.3s, transform 0.2s",visibility:"visible"},floaterWithComponent:{maxWidth:"100%"},floaterClosing:{opacity:0,visibility:"visible"},floaterCentered:{left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)"},container:{backgroundColor:"#fff",color:"#666",minHeight:60,minWidth:200,padding:20,position:"relative",zIndex:10},title:{borderBottom:"1px solid #555",color:"#555",fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",fontSize:0,height:15,outline:"none",padding:10,position:"absolute",right:0,top:0,width:15,WebkitAppearance:"none"},footer:{borderTop:"1px solid #ccc",fontSize:13,marginTop:10,paddingTop:5},arrow:{color:"#fff",display:"inline-flex",length:16,margin:8,position:"absolute",spread:32},options:t}}var _a=["arrow","flip","offset"],ja=["position","top","right","bottom","left"],vn=(function(e){gt(n,e);var t=bt(n);function n(r){var o;return yt(this,n),o=t.call(this,r),ne(xe(o),"setArrowRef",function(i){o.arrowRef=i}),ne(xe(o),"setChildRef",function(i){o.childRef=i}),ne(xe(o),"setFloaterRef",function(i){o.floaterRef=i}),ne(xe(o),"setWrapperRef",function(i){o.wrapperRef=i}),ne(xe(o),"handleTransitionEnd",function(){var i=o.state.status,a=o.props.callback;o.wrapperPopper&&o.wrapperPopper.instance.update(),o.setState({status:i===$.OPENING?$.OPEN:$.IDLE},function(){var s=o.state.status;a(s===$.OPEN?"open":"close",o.props)})}),ne(xe(o),"handleClick",function(){var i=o.props,a=i.event,s=i.open;if(!g.boolean(s)){var l=o.state,u=l.positionWrapper,f=l.status;(o.event==="click"||o.event==="hover"&&u)&&(St({title:"click",data:[{event:a,status:f===$.OPEN?"closing":"opening"}],debug:o.debug}),o.toggle())}}),ne(xe(o),"handleMouseEnter",function(){var i=o.props,a=i.event,s=i.open;if(!(g.boolean(s)||Kt())){var l=o.state.status;o.event==="hover"&&l===$.IDLE&&(St({title:"mouseEnter",data:[{key:"originalEvent",value:a}],debug:o.debug}),clearTimeout(o.eventDelayTimeout),o.toggle())}}),ne(xe(o),"handleMouseLeave",function(){var i=o.props,a=i.event,s=i.eventDelay,l=i.open;if(!(g.boolean(l)||Kt())){var u=o.state,f=u.status,c=u.positionWrapper;o.event==="hover"&&(St({title:"mouseLeave",data:[{key:"originalEvent",value:a}],debug:o.debug}),s?[$.OPENING,$.OPEN].indexOf(f)!==-1&&!c&&!o.eventDelayTimeout&&(o.eventDelayTimeout=setTimeout(function(){delete o.eventDelayTimeout,o.toggle()},s*1e3)):o.toggle($.IDLE))}}),o.state={currentPlacement:r.placement,needsUpdate:!1,positionWrapper:r.wrapperOptions.position&&!!r.target,status:$.INIT,statusWrapper:$.INIT},o._isMounted=!1,o.hasMounted=!1,Oe()&&window.addEventListener("load",function(){o.popper&&o.popper.instance.update(),o.wrapperPopper&&o.wrapperPopper.instance.update()}),o}return vt(n,[{key:"componentDidMount",value:function(){if(Oe()){var o=this.state.positionWrapper,i=this.props,a=i.children,s=i.open,l=i.target;this._isMounted=!0,St({title:"init",data:{hasChildren:!!a,hasTarget:!!l,isControlled:g.boolean(s),positionWrapper:o,target:this.target,floater:this.floaterRef},debug:this.debug}),this.hasMounted||(this.initPopper(),this.hasMounted=!0),!a&&l&&g.boolean(s)}}},{key:"componentDidUpdate",value:function(o,i){if(Oe()){var a=this.props,s=a.autoOpen,l=a.open,u=a.target,f=a.wrapperOptions,c=va(i,this.state),d=c.changedFrom,p=c.changed;if(o.open!==l){var h;g.boolean(l)&&(h=l?$.OPENING:$.CLOSING),this.toggle(h)}(o.wrapperOptions.position!==f.position||o.target!==u)&&this.changeWrapperPosition(this.props),p("status",$.IDLE)&&l?this.toggle($.OPEN):d("status",$.INIT,$.IDLE)&&s&&this.toggle($.OPEN),this.popper&&p("status",$.OPENING)&&this.popper.instance.update(),this.floaterRef&&(p("status",$.OPENING)||p("status",$.CLOSING))&&Ia(this.floaterRef,"transitionend",this.handleTransitionEnd),p("needsUpdate",!0)&&this.rebuildPopper()}}},{key:"componentWillUnmount",value:function(){Oe()&&(this._isMounted=!1,this.popper&&this.popper.instance.destroy(),this.wrapperPopper&&this.wrapperPopper.instance.destroy())}},{key:"initPopper",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.target,a=this.state.positionWrapper,s=this.props,l=s.disableFlip,u=s.getPopper,f=s.hideArrow,c=s.offset,d=s.placement,p=s.wrapperOptions,h=d==="top"||d==="bottom"?"flip":["right","bottom-end","top-end","left","top-start","bottom-start"];if(d==="center")this.setState({status:$.IDLE});else if(i&&this.floaterRef){var v=this.options,O=v.arrow,y=v.flip,m=v.offset,S=Fr(v,_a);new ut(i,this.floaterRef,{placement:d,modifiers:K({arrow:K({enabled:!f,element:this.arrowRef},O),flip:K({enabled:!l,behavior:h},y),offset:K({offset:"0, ".concat(c,"px")},m)},S),onCreate:function(C){var M;if(o.popper=C,!((M=o.floaterRef)!==null&&M!==void 0&&M.isConnected)){o.setState({needsUpdate:!0});return}u(C,"floater"),o._isMounted&&o.setState({currentPlacement:C.placement,status:$.IDLE}),d!==C.placement&&setTimeout(function(){C.instance.update()},1)},onUpdate:function(C){o.popper=C;var M=o.state.currentPlacement;o._isMounted&&C.placement!==M&&o.setState({currentPlacement:C.placement})}})}if(a){var D=g.undefined(p.offset)?0:p.offset;new ut(this.target,this.wrapperRef,{placement:p.placement||d,modifiers:{arrow:{enabled:!1},offset:{offset:"0, ".concat(D,"px")},flip:{enabled:!1}},onCreate:function(C){o.wrapperPopper=C,o._isMounted&&o.setState({statusWrapper:$.IDLE}),u(C,"wrapper"),d!==C.placement&&setTimeout(function(){C.instance.update()},1)}})}}},{key:"rebuildPopper",value:function(){var o=this;this.floaterRefInterval=setInterval(function(){var i;(i=o.floaterRef)!==null&&i!==void 0&&i.isConnected&&(clearInterval(o.floaterRefInterval),o.setState({needsUpdate:!1}),o.initPopper())},50)}},{key:"changeWrapperPosition",value:function(o){var i=o.target,a=o.wrapperOptions;this.setState({positionWrapper:a.position&&!!i})}},{key:"toggle",value:function(o){var i=this.state.status,a=i===$.OPEN?$.CLOSING:$.OPENING;g.undefined(o)||(a=o),this.setState({status:a})}},{key:"debug",get:function(){var o=this.props.debug;return o||Oe()&&"ReactFloaterDebug"in window&&!!window.ReactFloaterDebug}},{key:"event",get:function(){var o=this.props,i=o.disableHoverToClick,a=o.event;return a==="hover"&&Kt()&&!i?"click":a}},{key:"options",get:function(){var o=this.props.options;return ye(Ea,o||{})}},{key:"styles",get:function(){var o=this,i=this.state,a=i.status,s=i.positionWrapper,l=i.statusWrapper,u=this.props.styles,f=ye(Aa(u),u);if(s){var c;[$.IDLE].indexOf(a)===-1||[$.IDLE].indexOf(l)===-1?c=f.wrapperPosition:c=this.wrapperPopper.styles,f.wrapper=K(K({},f.wrapper),c)}if(this.target){var d=window.getComputedStyle(this.target);this.wrapperStyles?f.wrapper=K(K({},f.wrapper),this.wrapperStyles):["relative","static"].indexOf(d.position)===-1&&(this.wrapperStyles={},s||(ja.forEach(function(p){o.wrapperStyles[p]=d[p]}),f.wrapper=K(K({},f.wrapper),this.wrapperStyles),this.target.style.position="relative",this.target.style.top="auto",this.target.style.right="auto",this.target.style.bottom="auto",this.target.style.left="auto"))}return f}},{key:"target",get:function(){if(!Oe())return null;var o=this.props.target;return o?g.domElement(o)?o:document.querySelector(o):this.childRef||this.wrapperRef}},{key:"render",value:function(){var o=this.state,i=o.currentPlacement,a=o.positionWrapper,s=o.status,l=this.props,u=l.children,f=l.component,c=l.content,d=l.disableAnimation,p=l.footer,h=l.hideArrow,v=l.id,O=l.open,y=l.showCloseButton,m=l.style,S=l.target,D=l.title,E=w.createElement(Yr,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:m,styles:this.styles.wrapper},u),C={};return a?C.wrapperInPortal=E:C.wrapperAsChildren=E,w.createElement("span",null,w.createElement(Br,{hasChildren:!!u,id:v,placement:i,setRef:this.setFloaterRef,target:S,zIndex:this.styles.options.zIndex},w.createElement(zr,{component:f,content:c,disableAnimation:d,footer:p,handleClick:this.handleClick,hideArrow:h||i==="center",open:O,placement:i,positionWrapper:a,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:y,status:s,styles:this.styles,title:D}),C.wrapperInPortal),C.wrapperAsChildren)}}]),n})(w.Component);ne(vn,"propTypes",{autoOpen:T.bool,callback:T.func,children:T.node,component:Zn(T.oneOfType([T.func,T.element]),function(e){return!e.content}),content:Zn(T.node,function(e){return!e.component}),debug:T.bool,disableAnimation:T.bool,disableFlip:T.bool,disableHoverToClick:T.bool,event:T.oneOf(["hover","click"]),eventDelay:T.number,footer:T.node,getPopper:T.func,hideArrow:T.bool,id:T.oneOfType([T.string,T.number]),offset:T.number,open:T.bool,options:T.object,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto","center"]),showCloseButton:T.bool,style:T.object,styles:T.object,target:T.oneOfType([T.object,T.string]),title:T.node,wrapperOptions:T.shape({offset:T.number,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto"]),position:T.bool})});ne(vn,"defaultProps",{autoOpen:!1,callback:Jn,debug:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:"click",eventDelay:.4,getPopper:Jn,hideArrow:!1,offset:15,placement:"bottom",showCloseButton:!1,styles:{},target:null,wrapperOptions:{position:!1}});var Fa=Object.defineProperty,La=(e,t,n)=>t in e?Fa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t,n)=>La(e,typeof t!="symbol"?t+"":t,n),z={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update"},me={TOUR_START:"tour:start",STEP_BEFORE:"step:before",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found"},A={INIT:"init",READY:"ready",BEACON:"beacon",TOOLTIP:"tooltip",COMPLETE:"complete",ERROR:"error"},B={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"};function Re(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function qr(e){return e?e.getBoundingClientRect():null}function Ba(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,a)=>i-a),o=Math.floor(r.length/2);return r.length%2===0?(r[o-1]+r[o])/2:r[o]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function Ne(e){if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function $a(e){return!e||e.nodeType!==1?null:getComputedStyle(e)}function ft(e,t,n){if(!e)return Fe();const r=wr(e);if(r){if(r.isSameNode(Fe()))return n?document:Fe();if(!(r.scrollHeight>r.offsetHeight)&&!t)return r.style.overflow="initial",Fe()}return r}function At(e,t){if(!e)return!1;const n=ft(e,t);return n?!n.isSameNode(Fe()):!1}function Ha(e){return e.offsetParent!==document.body}function Xe(e,t="fixed"){if(!e||!(e instanceof HTMLElement))return!1;const{nodeName:n}=e,r=$a(e);return n==="BODY"||n==="HTML"?!1:r&&r.position===t?!0:e.parentNode?Xe(e.parentNode,t):!1}function Ua(e){var t;if(!e)return!1;let n=e;for(;n&&n!==document.body;){if(n instanceof HTMLElement){const{display:r,visibility:o}=getComputedStyle(n);if(r==="none"||o==="hidden")return!1}n=(t=n.parentElement)!=null?t:null}return!0}function za(e,t,n){var r,o,i;const a=qr(e),s=ft(e,n),l=At(e,n),u=Xe(e);let f=0,c=(r=a?.top)!=null?r:0;if(l&&u){const d=(o=e?.offsetTop)!=null?o:0,p=(i=s?.scrollTop)!=null?i:0;c=d-p}else s instanceof HTMLElement&&(f=s.scrollTop,!l&&!Xe(e)&&(c+=f),s.isSameNode(Fe())||(c+=Fe().scrollTop));return Math.floor(c-t)}function Ya(e,t,n){var r;if(!e)return 0;const{offsetTop:o=0,scrollTop:i=0}=(r=wr(e))!=null?r:{};let a=e.getBoundingClientRect().top+i;o&&(At(e,n)||Ha(e))&&(a-=o);const s=Math.floor(a-t);return s<0?0:s}function Fe(){var e;return(e=document.scrollingElement)!=null?e:document.documentElement}function qa(e,t){const{duration:n,element:r}=t;return new Promise((o,i)=>{const{scrollTop:a}=r,s=e>a?e-a:a-e;fs.top(r,e,{duration:s<100?50:n},l=>l&&l.message!=="Element already at target scroll position"?i(l):o())})}var st=kt.createPortal!==void 0;function Gr(e=navigator.userAgent){let t=e;return typeof window>"u"?t="node":document.documentMode?t="ie":/Edge/.test(e)?t="edge":window.opera||e.includes(" OPR/")?t="opera":typeof window.InstallTrigger<"u"?t="firefox":window.chrome?t="chrome":/(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(e)&&(t="safari"),t}function Tt(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Se(e,t={}){const{defaultValue:n,step:r,steps:o}=t;let i=An(e);if(i)(i.includes("{step}")||i.includes("{steps}"))&&r&&o&&(i=i.replace("{step}",r.toString()).replace("{steps}",o.toString()));else if(b.isValidElement(e)&&!Object.values(e.props).length&&Tt(e.type)==="function"){const a=e.type({});i=Se(a,t)}else i=An(n);return i}function Ga(e,t){return!N.plainObject(e)||!N.array(t)?!1:Object.keys(e).every(n=>t.includes(n))}function Va(e){const t=/^#?([\da-f])([\da-f])([\da-f])$/i,n=e.replace(t,(o,i,a,s)=>i+i+a+a+s+s),r=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(n);return r?[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]:[]}function Xn(e){return e.disableBeacon||e.placement==="center"}function Qn(){return!["chrome","safari","firefox","opera"].includes(Gr())}function $e({data:e,debug:t=!1,title:n,warn:r=!1}){const o=r?console.warn||console.error:console.log;t&&(n&&e?(console.groupCollapsed(`%creact-joyride: ${n}`,"color: #ff0044; font-weight: bold; font-size: 12px;"),Array.isArray(e)?e.forEach(i=>{N.plainObject(i)&&i.key?o.apply(console,[i.key,i.value]):o.apply(console,[i])}):o.apply(console,[e]),console.groupEnd()):console.error("Missing title or data props"))}function Ka(e){return Object.keys(e)}function Vr(e,...t){if(!N.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function Za(e,...t){if(!N.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function an(e,t,n){const r=i=>i.replace("{step}",String(t)).replace("{steps}",String(n));if(Tt(e)==="string")return r(e);if(!b.isValidElement(e))return e;const{children:o}=e.props;if(Tt(o)==="string"&&o.includes("{step}"))return b.cloneElement(e,{children:r(o)});if(Array.isArray(o))return b.cloneElement(e,{children:o.map(i=>typeof i=="string"?r(i):an(i,t,n))});if(Tt(e.type)==="function"&&!Object.values(e.props).length){const i=e.type({});return an(i,t,n)}return e}function Ja(e){const{isFirstStep:t,lifecycle:n,previousLifecycle:r,scrollToFirstStep:o,step:i,target:a}=e;return!i.disableScrolling&&(!t||o||n===A.TOOLTIP)&&i.placement!=="center"&&(!i.isFixed||!Xe(a))&&r!==n&&[A.BEACON,A.TOOLTIP].includes(n)}var Xa={options:{preventOverflow:{boundariesElement:"scrollParent"}},wrapperOptions:{offset:-18,position:!0}},Kr={back:"Back",close:"Close",last:"Last",next:"Next",nextLabelWithProgress:"Next (Step {step} of {steps})",open:"Open the dialog",skip:"Skip"},Qa={event:"click",placement:"bottom",offset:10,disableBeacon:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrollParentFix:!1,disableScrolling:!1,hideBackButton:!1,hideCloseButton:!1,hideFooter:!1,isFixed:!1,locale:Kr,showProgress:!1,showSkipButton:!1,spotlightClicks:!1,spotlightPadding:10},el={continuous:!1,debug:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrolling:!1,disableScrollParentFix:!1,getHelpers:void 0,hideBackButton:!1,run:!0,scrollOffset:20,scrollDuration:300,scrollToFirstStep:!1,showSkipButton:!1,showProgress:!1,spotlightClicks:!1,spotlightPadding:10,steps:[]},tl={arrowColor:"#fff",backgroundColor:"#fff",beaconSize:36,overlayColor:"rgba(0, 0, 0, 0.5)",primaryColor:"#f04",spotlightShadow:"0 0 15px rgba(0, 0, 0, 0.5)",textColor:"#333",width:380,zIndex:100},at={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",cursor:"pointer",fontSize:16,lineHeight:1,padding:8,WebkitAppearance:"none"},er={borderRadius:4,position:"absolute"};function nl(e,t){var n,r,o,i,a;const{floaterProps:s,styles:l}=e,u=ye((n=t.floaterProps)!=null?n:{},s??{}),f=ye(l??{},(r=t.styles)!=null?r:{}),c=ye(tl,f.options||{}),d=t.placement==="center"||t.disableBeacon;let{width:p}=c;window.innerWidth>480&&(p=380),"width"in c&&(p=typeof c.width=="number"&&window.innerWidthZr(n,t)):($e({title:"validateSteps",data:"steps must be an array",warn:!0,debug:t}),!1)}var Jr={action:"init",controlled:!1,index:0,lifecycle:A.INIT,origin:null,size:0,status:B.IDLE},nr=Ka(Vr(Jr,"controlled","size")),ol=class{constructor(e){P(this,"beaconPopper"),P(this,"tooltipPopper"),P(this,"data",new Map),P(this,"listener"),P(this,"store",new Map),P(this,"addListener",o=>{this.listener=o}),P(this,"setSteps",o=>{const{size:i,status:a}=this.getState(),s={size:o.length,status:a};this.data.set("steps",o),a===B.WAITING&&!i&&o.length&&(s.status=B.RUNNING),this.setState(s)}),P(this,"getPopper",o=>o==="beacon"?this.beaconPopper:this.tooltipPopper),P(this,"setPopper",(o,i)=>{o==="beacon"?this.beaconPopper=i:this.tooltipPopper=i}),P(this,"cleanupPoppers",()=>{this.beaconPopper=null,this.tooltipPopper=null}),P(this,"close",(o=null)=>{const{index:i,status:a}=this.getState();a===B.RUNNING&&this.setState({...this.getNextState({action:z.CLOSE,index:i+1,origin:o})})}),P(this,"go",o=>{const{controlled:i,status:a}=this.getState();if(i||a!==B.RUNNING)return;const s=this.getSteps()[o];this.setState({...this.getNextState({action:z.GO,index:o}),status:s?a:B.FINISHED})}),P(this,"info",()=>this.getState()),P(this,"next",()=>{const{index:o,status:i}=this.getState();i===B.RUNNING&&this.setState(this.getNextState({action:z.NEXT,index:o+1}))}),P(this,"open",()=>{const{status:o}=this.getState();o===B.RUNNING&&this.setState({...this.getNextState({action:z.UPDATE,lifecycle:A.TOOLTIP})})}),P(this,"prev",()=>{const{index:o,status:i}=this.getState();i===B.RUNNING&&this.setState({...this.getNextState({action:z.PREV,index:o-1})})}),P(this,"reset",(o=!1)=>{const{controlled:i}=this.getState();i||this.setState({...this.getNextState({action:z.RESET,index:0}),status:o?B.RUNNING:B.READY})}),P(this,"skip",()=>{const{status:o}=this.getState();o===B.RUNNING&&this.setState({action:z.SKIP,lifecycle:A.INIT,status:B.SKIPPED})}),P(this,"start",o=>{const{index:i,size:a}=this.getState();this.setState({...this.getNextState({action:z.START,index:N.number(o)?o:i},!0),status:a?B.RUNNING:B.WAITING})}),P(this,"stop",(o=!1)=>{const{index:i,status:a}=this.getState();[B.FINISHED,B.SKIPPED].includes(a)||this.setState({...this.getNextState({action:z.STOP,index:i+(o?1:0)}),status:B.PAUSED})}),P(this,"update",o=>{var i,a;if(!Ga(o,nr))throw new Error(`State is not valid. Valid keys: ${nr.join(", ")}`);this.setState({...this.getNextState({...this.getState(),...o,action:(i=o.action)!=null?i:z.UPDATE,origin:(a=o.origin)!=null?a:null},!0)})});const{continuous:t=!1,stepIndex:n,steps:r=[]}=e??{};this.setState({action:z.INIT,controlled:N.number(n),continuous:t,index:N.number(n)?n:0,lifecycle:A.INIT,origin:null,status:r.length?B.READY:B.IDLE},!0),this.beaconPopper=null,this.tooltipPopper=null,this.listener=null,this.setSteps(r)}getState(){return this.store.size?{action:this.store.get("action")||"",controlled:this.store.get("controlled")||!1,index:parseInt(this.store.get("index"),10),lifecycle:this.store.get("lifecycle")||"",origin:this.store.get("origin")||null,size:this.store.get("size")||0,status:this.store.get("status")||""}:{...Jr}}getNextState(e,t=!1){var n,r,o,i,a;const{action:s,controlled:l,index:u,size:f,status:c}=this.getState(),d=N.number(e.index)?e.index:u,p=l&&!t?u:Math.min(Math.max(d,0),f);return{action:(n=e.action)!=null?n:s,controlled:l,index:p,lifecycle:(r=e.lifecycle)!=null?r:A.INIT,origin:(o=e.origin)!=null?o:null,size:(i=e.size)!=null?i:f,status:p===f?B.FINISHED:(a=e.status)!=null?a:c}}getSteps(){const e=this.data.get("steps");return Array.isArray(e)?e:[]}hasUpdatedState(e){const t=JSON.stringify(e),n=JSON.stringify(this.getState());return t!==n}setState(e,t=!1){const n=this.getState(),{action:r,index:o,lifecycle:i,origin:a=null,size:s,status:l}={...n,...e};this.store.set("action",r),this.store.set("index",o),this.store.set("lifecycle",i),this.store.set("origin",a),this.store.set("size",s),this.store.set("status",l),t&&(this.store.set("controlled",e.controlled),this.store.set("continuous",e.continuous)),this.listener&&this.hasUpdatedState(n)&&this.listener(this.getState())}getHelpers(){return{close:this.close,go:this.go,info:this.info,next:this.next,open:this.open,prev:this.prev,reset:this.reset,skip:this.skip}}};function il(e){return new ol(e)}function sl({styles:e}){return b.createElement("div",{key:"JoyrideSpotlight",className:"react-joyride__spotlight","data-test-id":"spotlight",style:e})}var al=sl,ll=class extends b.Component{constructor(){super(...arguments),P(this,"isActive",!1),P(this,"resizeTimeout"),P(this,"scrollTimeout"),P(this,"scrollParent"),P(this,"state",{isScrolling:!1,mouseOverSpotlight:!1,showSpotlight:!0}),P(this,"hideSpotlight",()=>{const{continuous:e,disableOverlay:t,lifecycle:n}=this.props,r=[A.INIT,A.BEACON,A.COMPLETE,A.ERROR];return t||(e?r.includes(n):n!==A.TOOLTIP)}),P(this,"handleMouseMove",e=>{const{mouseOverSpotlight:t}=this.state,{height:n,left:r,position:o,top:i,width:a}=this.spotlightStyles,s=o==="fixed"?e.clientY:e.pageY,l=o==="fixed"?e.clientX:e.pageX,u=s>=i&&s<=i+n,c=l>=r&&l<=r+a&&u;c!==t&&this.updateState({mouseOverSpotlight:c})}),P(this,"handleScroll",()=>{const{target:e}=this.props,t=Ne(e);if(this.scrollParent!==document){const{isScrolling:n}=this.state;n||this.updateState({isScrolling:!0,showSpotlight:!1}),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateState({isScrolling:!1,showSpotlight:!0})},50)}else Xe(t,"sticky")&&this.updateState({})}),P(this,"handleResize",()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.isActive&&this.forceUpdate()},100)})}componentDidMount(){const{debug:e,disableScrolling:t,disableScrollParentFix:n=!1,target:r}=this.props,o=Ne(r);this.scrollParent=ft(o??document.body,n,!0),this.isActive=!0,window.addEventListener("resize",this.handleResize)}componentDidUpdate(e){var t;const{disableScrollParentFix:n,lifecycle:r,spotlightClicks:o,target:i}=this.props,{changed:a}=Mt(e,this.props);if(a("target")||a("disableScrollParentFix")){const s=Ne(i);this.scrollParent=ft(s??document.body,n,!0)}a("lifecycle",A.TOOLTIP)&&((t=this.scrollParent)==null||t.addEventListener("scroll",this.handleScroll,{passive:!0}),setTimeout(()=>{const{isScrolling:s}=this.state;s||this.updateState({showSpotlight:!0})},100)),(a("spotlightClicks")||a("disableOverlay")||a("lifecycle"))&&(o&&r===A.TOOLTIP?window.addEventListener("mousemove",this.handleMouseMove,!1):r!==A.TOOLTIP&&window.removeEventListener("mousemove",this.handleMouseMove))}componentWillUnmount(){var e;this.isActive=!1,window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimeout),clearTimeout(this.scrollTimeout),(e=this.scrollParent)==null||e.removeEventListener("scroll",this.handleScroll)}get overlayStyles(){const{mouseOverSpotlight:e}=this.state,{disableOverlayClose:t,placement:n,styles:r}=this.props;let o=r.overlay;return Qn()&&(o=n==="center"?r.overlayLegacyCenter:r.overlayLegacy),{cursor:t?"default":"pointer",height:Ba(),pointerEvents:e?"none":"auto",...o}}get spotlightStyles(){var e,t,n;const{showSpotlight:r}=this.state,{disableScrollParentFix:o=!1,spotlightClicks:i,spotlightPadding:a=0,styles:s,target:l}=this.props,u=Ne(l),f=qr(u),c=Xe(u),d=za(u,a,o);return{...Qn()?s.spotlightLegacy:s.spotlight,height:Math.round(((e=f?.height)!=null?e:0)+a*2),left:Math.round(((t=f?.left)!=null?t:0)-a),opacity:r?1:0,pointerEvents:i?"none":"auto",position:c?"fixed":"absolute",top:d,transition:"opacity 0.2s",width:Math.round(((n=f?.width)!=null?n:0)+a*2)}}updateState(e){this.isActive&&this.setState(t=>({...t,...e}))}render(){const{showSpotlight:e}=this.state,{onClickOverlay:t,placement:n}=this.props,{hideSpotlight:r,overlayStyles:o,spotlightStyles:i}=this;if(r())return null;let a=n!=="center"&&e&&b.createElement(al,{styles:i});if(Gr()==="safari"){const{mixBlendMode:s,zIndex:l,...u}=o;a=b.createElement("div",{style:{...u}},a),delete o.backgroundColor}return b.createElement("div",{className:"react-joyride__overlay","data-test-id":"overlay",onClick:t,role:"presentation",style:o},a)}},cl=class extends b.Component{constructor(){super(...arguments),P(this,"node",null)}componentDidMount(){const{id:e}=this.props;Re()&&(this.node=document.createElement("div"),this.node.id=e,document.body.appendChild(this.node),st||this.renderReact15())}componentDidUpdate(){Re()&&(st||this.renderReact15())}componentWillUnmount(){!Re()||!this.node||(st||kt.unmountComponentAtNode(this.node),this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=null))}renderReact15(){if(!Re())return;const{children:e}=this.props;this.node&&kt.unstable_renderSubtreeIntoContainer(this,e,this.node)}renderReact16(){if(!Re()||!st)return null;const{children:e}=this.props;return this.node?kt.createPortal(e,this.node):null}render(){return st?this.renderReact16():null}},ul=class{constructor(e,t){if(P(this,"element"),P(this,"options"),P(this,"canBeTabbed",n=>{const{tabIndex:r}=n;return r===null||r<0?!1:this.canHaveFocus(n)}),P(this,"canHaveFocus",n=>{const r=/input|select|textarea|button|object/,o=n.nodeName.toLowerCase();return(r.test(o)&&!n.getAttribute("disabled")||o==="a"&&!!n.getAttribute("href"))&&this.isVisible(n)}),P(this,"findValidTabElements",()=>[].slice.call(this.element.querySelectorAll("*"),0).filter(this.canBeTabbed)),P(this,"handleKeyDown",n=>{const{code:r="Tab"}=this.options;n.code===r&&this.interceptTab(n)}),P(this,"interceptTab",n=>{n.preventDefault();const r=this.findValidTabElements(),{shiftKey:o}=n;if(!r.length)return;let i=document.activeElement?r.indexOf(document.activeElement):0;i===-1||!o&&i+1===r.length?i=0:o&&i===0?i=r.length-1:i+=o?-1:1,r[i].focus()}),P(this,"isHidden",n=>{const r=n.offsetWidth<=0&&n.offsetHeight<=0,o=window.getComputedStyle(n);return r&&!n.innerHTML?!0:r&&o.getPropertyValue("overflow")!=="visible"||o.getPropertyValue("display")==="none"}),P(this,"isVisible",n=>{let r=n;for(;r;)if(r instanceof HTMLElement){if(r===document.body)break;if(this.isHidden(r))return!1;r=r.parentNode}return!0}),P(this,"removeScope",()=>{window.removeEventListener("keydown",this.handleKeyDown)}),P(this,"checkFocus",n=>{document.activeElement!==n&&(n.focus(),window.requestAnimationFrame(()=>this.checkFocus(n)))}),P(this,"setFocus",()=>{const{selector:n}=this.options;if(!n)return;const r=this.element.querySelector(n);r&&window.requestAnimationFrame(()=>this.checkFocus(r))}),!(e instanceof HTMLElement))throw new TypeError("Invalid parameter: element must be an HTMLElement");this.element=e,this.options=t,window.addEventListener("keydown",this.handleKeyDown,!1),this.setFocus()}},fl=class extends b.Component{constructor(e){if(super(e),P(this,"beacon",null),P(this,"setBeaconRef",o=>{this.beacon=o}),e.beaconComponent)return;const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="joyride-beacon-animation",e.nonce&&n.setAttribute("nonce",e.nonce),n.appendChild(document.createTextNode(` - @keyframes joyride-beacon-inner { - 20% { - opacity: 0.9; - } - - 90% { - opacity: 0.7; - } - } - - @keyframes joyride-beacon-outer { - 0% { - transform: scale(1); - } - - 45% { - opacity: 0.7; - transform: scale(0.75); - } - - 100% { - opacity: 0.9; - transform: scale(1); - } - } - `)),t.appendChild(n)}componentDidMount(){const{shouldFocus:e}=this.props;setTimeout(()=>{N.domElement(this.beacon)&&e&&this.beacon.focus()},0)}componentWillUnmount(){const e=document.getElementById("joyride-beacon-animation");e?.parentNode&&e.parentNode.removeChild(e)}render(){const{beaconComponent:e,continuous:t,index:n,isLastStep:r,locale:o,onClickOrHover:i,size:a,step:s,styles:l}=this.props,u=Se(o.open),f={"aria-label":u,onClick:i,onMouseEnter:i,ref:this.setBeaconRef,title:u};let c;if(e){const d=e;c=b.createElement(d,{continuous:t,index:n,isLastStep:r,size:a,step:s,...f})}else c=b.createElement("button",{key:"JoyrideBeacon",className:"react-joyride__beacon","data-test-id":"button-beacon",style:l.beacon,type:"button",...f},b.createElement("span",{style:l.beaconInner}),b.createElement("span",{style:l.beaconOuter}));return c}};function dl({styles:e,...t}){const{color:n,height:r,width:o,...i}=e;return w.createElement("button",{style:i,type:"button",...t},w.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof o=="number"?`${o}px`:o,xmlns:"http://www.w3.org/2000/svg"},w.createElement("g",null,w.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:n}))))}var pl=dl;function hl(e){const{backProps:t,closeProps:n,index:r,isLastStep:o,primaryProps:i,skipProps:a,step:s,tooltipProps:l}=e,{content:u,hideBackButton:f,hideCloseButton:c,hideFooter:d,showSkipButton:p,styles:h,title:v}=s,O={};return O.primary=b.createElement("button",{"data-test-id":"button-primary",style:h.buttonNext,type:"button",...i}),p&&!o&&(O.skip=b.createElement("button",{"aria-live":"off","data-test-id":"button-skip",style:h.buttonSkip,type:"button",...a})),!f&&r>0&&(O.back=b.createElement("button",{"data-test-id":"button-back",style:h.buttonBack,type:"button",...t})),O.close=!c&&b.createElement(pl,{"data-test-id":"button-close",styles:h.buttonClose,...n}),b.createElement("div",{key:"JoyrideTooltip","aria-label":Se(v??u),className:"react-joyride__tooltip",style:h.tooltip,...l},b.createElement("div",{style:h.tooltipContainer},v&&b.createElement("h1",{"aria-label":Se(v),style:h.tooltipTitle},v),b.createElement("div",{style:h.tooltipContent},u)),!d&&b.createElement("div",{style:h.tooltipFooter},b.createElement("div",{style:h.tooltipFooterSpacer},O.skip),O.back,O.primary),O.close)}var ml=hl,yl=class extends b.Component{constructor(){super(...arguments),P(this,"handleClickBack",e=>{e.preventDefault();const{helpers:t}=this.props;t.prev()}),P(this,"handleClickClose",e=>{e.preventDefault();const{helpers:t}=this.props;t.close("button_close")}),P(this,"handleClickPrimary",e=>{e.preventDefault();const{continuous:t,helpers:n}=this.props;if(!t){n.close("button_primary");return}n.next()}),P(this,"handleClickSkip",e=>{e.preventDefault();const{helpers:t}=this.props;t.skip()}),P(this,"getElementsProps",()=>{const{continuous:e,index:t,isLastStep:n,setTooltipRef:r,size:o,step:i}=this.props,{back:a,close:s,last:l,next:u,nextLabelWithProgress:f,skip:c}=i.locale,d=Se(a),p=Se(s),h=Se(l),v=Se(u),O=Se(c);let y=s,m=p;if(e){if(y=u,m=v,i.showProgress&&!n){const S=Se(f,{step:t+1,steps:o});y=an(f,t+1,o),m=S}n&&(y=l,m=h)}return{backProps:{"aria-label":d,children:a,"data-action":"back",onClick:this.handleClickBack,role:"button",title:d},closeProps:{"aria-label":p,children:s,"data-action":"close",onClick:this.handleClickClose,role:"button",title:p},primaryProps:{"aria-label":m,children:y,"data-action":"primary",onClick:this.handleClickPrimary,role:"button",title:m},skipProps:{"aria-label":O,children:c,"data-action":"skip",onClick:this.handleClickSkip,role:"button",title:O},tooltipProps:{"aria-modal":!0,ref:r,role:"alertdialog"}}})}render(){const{continuous:e,index:t,isLastStep:n,setTooltipRef:r,size:o,step:i}=this.props,{beaconComponent:a,tooltipComponent:s,...l}=i;let u;if(s){const f={...this.getElementsProps(),continuous:e,index:t,isLastStep:n,size:o,step:l,setTooltipRef:r},c=s;u=b.createElement(c,{...f})}else u=b.createElement(ml,{...this.getElementsProps(),continuous:e,index:t,isLastStep:n,size:o,step:i});return u}},vl=class extends b.Component{constructor(){super(...arguments),P(this,"scope",null),P(this,"tooltip",null),P(this,"handleClickHoverBeacon",e=>{const{step:t,store:n}=this.props;e.type==="mouseenter"&&t.event!=="hover"||n.update({lifecycle:A.TOOLTIP})}),P(this,"setTooltipRef",e=>{this.tooltip=e}),P(this,"setPopper",(e,t)=>{var n;const{action:r,lifecycle:o,step:i,store:a}=this.props;t==="wrapper"?a.setPopper("beacon",e):a.setPopper("tooltip",e),a.getPopper("beacon")&&(a.getPopper("tooltip")||i.placement==="center")&&o===A.INIT&&a.update({action:r,lifecycle:A.READY}),(n=i.floaterProps)!=null&&n.getPopper&&i.floaterProps.getPopper(e,t)}),P(this,"renderTooltip",e=>{const{continuous:t,helpers:n,index:r,size:o,step:i}=this.props;return b.createElement(yl,{continuous:t,helpers:n,index:r,isLastStep:r+1===o,setTooltipRef:this.setTooltipRef,size:o,step:i,...e})})}componentDidMount(){const{debug:e,index:t}=this.props;$e({title:`step:${t}`,data:[{key:"props",value:this.props}],debug:e})}componentDidUpdate(e){var t;const{action:n,callback:r,continuous:o,controlled:i,debug:a,helpers:s,index:l,lifecycle:u,shouldScroll:f,status:c,step:d,store:p}=this.props,{changed:h,changedFrom:v}=Mt(e,this.props),O=s.info(),y=o&&n!==z.CLOSE&&(l>0||n===z.PREV),m=h("action")||h("index")||h("lifecycle")||h("status"),S=v("lifecycle",[A.TOOLTIP,A.INIT],A.INIT),D=h("action",[z.NEXT,z.PREV,z.SKIP,z.CLOSE]),E=i&&l===e.index;if(D&&(S||E)&&r({...O,index:e.index,lifecycle:A.COMPLETE,step:e.step,type:me.STEP_AFTER}),d.placement==="center"&&c===B.RUNNING&&h("index")&&n!==z.START&&u===A.INIT&&p.update({lifecycle:A.READY}),m){const C=Ne(d.target),M=!!C;M&&Ua(C)?(v("status",B.READY,B.RUNNING)||v("lifecycle",A.INIT,A.READY))&&r({...O,step:d,type:me.STEP_BEFORE}):(console.warn(M?"Target not visible":"Target not mounted",d),r({...O,type:me.TARGET_NOT_FOUND,step:d}),i||p.update({index:l+(n===z.PREV?-1:1)}))}v("lifecycle",A.INIT,A.READY)&&p.update({lifecycle:Xn(d)||y?A.TOOLTIP:A.BEACON}),h("index")&&$e({title:`step:${u}`,data:[{key:"props",value:this.props}],debug:a}),h("lifecycle",A.BEACON)&&r({...O,step:d,type:me.BEACON}),h("lifecycle",A.TOOLTIP)&&(r({...O,step:d,type:me.TOOLTIP}),f&&this.tooltip&&(this.scope=new ul(this.tooltip,{selector:"[data-action=primary]"}),this.scope.setFocus())),v("lifecycle",[A.TOOLTIP,A.INIT],A.INIT)&&((t=this.scope)==null||t.removeScope(),p.cleanupPoppers())}componentWillUnmount(){var e;(e=this.scope)==null||e.removeScope()}get open(){const{lifecycle:e,step:t}=this.props;return Xn(t)||e===A.TOOLTIP}render(){const{continuous:e,debug:t,index:n,nonce:r,shouldScroll:o,size:i,step:a}=this.props,s=Ne(a.target);return!Zr(a)||!N.domElement(s)?null:b.createElement("div",{key:`JoyrideStep-${n}`,className:"react-joyride__step"},b.createElement(vn,{...a.floaterProps,component:this.renderTooltip,debug:t,getPopper:this.setPopper,id:`react-joyride-step-${n}`,open:this.open,placement:a.placement,target:a.target},b.createElement(fl,{beaconComponent:a.beaconComponent,continuous:e,index:n,isLastStep:n+1===i,locale:a.locale,nonce:r,onClickOrHover:this.handleClickHoverBeacon,shouldFocus:o,size:i,step:a,styles:a.styles})))}},Xr=class extends b.Component{constructor(e){super(e),P(this,"helpers"),P(this,"store"),P(this,"callback",a=>{const{callback:s}=this.props;N.function(s)&&s(a)}),P(this,"handleKeyboard",a=>{const{index:s,lifecycle:l}=this.state,{steps:u}=this.props,f=u[s];l===A.TOOLTIP&&a.code==="Escape"&&f&&!f.disableCloseOnEsc&&this.store.close("keyboard")}),P(this,"handleClickOverlay",()=>{const{index:a}=this.state,{steps:s}=this.props;Ye(this.props,s[a]).disableOverlayClose||this.helpers.close("overlay")}),P(this,"syncState",a=>{this.setState(a)});const{debug:t,getHelpers:n,run:r=!0,stepIndex:o}=e;this.store=il({...e,controlled:r&&N.number(o)}),this.helpers=this.store.getHelpers();const{addListener:i}=this.store;$e({title:"init",data:[{key:"props",value:this.props},{key:"state",value:this.state}],debug:t}),i(this.syncState),n&&n(this.helpers),this.state=this.store.getState()}componentDidMount(){if(!Re())return;const{debug:e,disableCloseOnEsc:t,run:n,steps:r}=this.props,{start:o}=this.store;tr(r,e)&&n&&o(),t||document.body.addEventListener("keydown",this.handleKeyboard,{passive:!0})}componentDidUpdate(e,t){if(!Re())return;const{action:n,controlled:r,index:o,status:i}=this.state,{debug:a,run:s,stepIndex:l,steps:u}=this.props,{stepIndex:f,steps:c}=e,{reset:d,setSteps:p,start:h,stop:v,update:O}=this.store,{changed:y}=Mt(e,this.props),{changed:m,changedFrom:S}=Mt(t,this.state),D=Ye(this.props,u[o]),E=!oe(c,u),C=N.number(l)&&y("stepIndex"),M=Ne(D.target);if(E&&(tr(u,a)?p(u):console.warn("Steps are not valid",u)),y("run")&&(s?h(l):v()),C){let Y=N.number(f)&&f=0?v:0,r===B.RUNNING&&qa(v,{element:h,duration:a}).then(()=>{setTimeout(()=>{var m;(m=this.store.getPopper("tooltip"))==null||m.instance.update()},10)})}}render(){if(!Re())return null;const{index:e,lifecycle:t,status:n}=this.state,{continuous:r=!1,debug:o=!1,nonce:i,scrollToFirstStep:a=!1,steps:s}=this.props,l=n===B.RUNNING,u={};if(l&&s[e]){const f=Ye(this.props,s[e]);u.step=b.createElement(vl,{...this.state,callback:this.callback,continuous:r,debug:o,helpers:this.helpers,nonce:i,shouldScroll:!f.disableScrolling&&(e!==0||a),step:f,store:this.store}),u.overlay=b.createElement(cl,{id:"react-joyride-portal"},b.createElement(ll,{...f,continuous:r,debug:o,lifecycle:t,onClickOverlay:this.handleClickOverlay}))}return b.createElement("div",{className:"react-joyride"},u.step,u.overlay)}};P(Xr,"defaultProps",el);var iu=Xr;function gl(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const bl={},lt={};function Le(e,t){try{const r=(bl[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return r in lt?lt[r]:rr(r,r.split(":"))}catch{if(e in lt)return lt[e];const n=e?.match(wl);return n?rr(e,n.slice(1)):NaN}}const wl=/([+-]\d\d):?(\d\d)?/;function rr(e,t){const n=+(t[0]||0),r=+(t[1]||0),o=+(t[2]||0)/60;return lt[e]=n*60+r>0?n*60+r+o:n*60-r-o}class Ce extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Le(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),Qr(this),ln(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new Ce(...n,t):new Ce(Date.now(),t)}withTimeZone(t){return new Ce(+this,t)}getTimezoneOffset(){const t=-Le(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),ln(this),+this}[Symbol.for("constructDateFrom")](t){return new Ce(+new Date(t),this.timeZone)}}const or=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!or.test(e))return;const t=e.replace(or,"$1UTC");Ce.prototype[t]&&(e.startsWith("get")?Ce.prototype[e]=function(){return this.internal[t]()}:(Ce.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),Ol(this),+this},Ce.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),ln(this),+this}))});function ln(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Le(e.timeZone,e)*60))}function Ol(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),Qr(e)}function Qr(e){const t=Le(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const o=-new Date(+e).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),a=o-i,s=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&s&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);const l=o-n;l&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+l);const u=new Date(+e);u.setUTCSeconds(0);const f=o>0?u.getSeconds():(u.getSeconds()-60)%60,c=Math.round(-(Le(e.timeZone,e)*60))%60;(c||f)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+c),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+c+f));const d=Le(e.timeZone,e),p=d>0?Math.floor(d):Math.ceil(d),v=-new Date(+e).getTimezoneOffset()-p,O=p!==n,y=v-l;if(O&&y){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+y);const m=Le(e.timeZone,e),S=m>0?Math.floor(m):Math.ceil(m),D=p-S;D&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+D),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+D))}}class te extends Ce{static tz(t,...n){return n.length?new te(...n,t):new te(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),o=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,o]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${r} ${n} ${o}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,o]=this.tzComponents();return`${t} GMT${n}${r}${o} (${gl(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),o=String(Math.abs(t)%60).padStart(2,"0");return[n,r,o]}withTimeZone(t){return new te(+this,t)}[Symbol.for("constructDateFrom")](t){return new te(+new Date(t),this.timeZone)}}const ir=5,Sl=4;function El(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,o=t.addDays(e,-r+1),i=t.addDays(o,ir*7-1);return t.getMonth(e)===t.getMonth(i)?ir:Sl}function eo(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function kl(e,t){const n=eo(e,t),r=El(e,t);return t.addDays(n,r*7-1)}class fe{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?te.tz(this.options.timeZone):new this.Date,this.newDate=(r,o,i)=>this.overrides?.newDate?this.overrides.newDate(r,o,i):this.options.timeZone?new te(r,o,i,this.options.timeZone):new Date(r,o,i),this.addDays=(r,o)=>this.overrides?.addDays?this.overrides.addDays(r,o):Yo(r,o),this.addMonths=(r,o)=>this.overrides?.addMonths?this.overrides.addMonths(r,o):qo(r,o),this.addWeeks=(r,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,o):Go(r,o),this.addYears=(r,o)=>this.overrides?.addYears?this.overrides.addYears(r,o):Vo(r,o),this.differenceInCalendarDays=(r,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,o):Ko(r,o),this.differenceInCalendarMonths=(r,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,o):Zo(r,o),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Jo(r),this.eachYearOfInterval=r=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Xo(r),i=new Set(o.map(s=>this.getYear(s)));if(i.size===o.length)return o;const a=[];return i.forEach(s=>{a.push(new Date(s,0,1))}),a},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):kl(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Qo(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):ei(r),this.endOfWeek=(r,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,o):ti(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):ni(r),this.format=(r,o,i)=>{const a=this.overrides?.format?this.overrides.format(r,o,this.options):ri(r,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(a):a},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):oi(r),this.getMonth=(r,o)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):ii(r,this.options),this.getYear=(r,o)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):si(r,this.options),this.getWeek=(r,o)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):ai(r,this.options),this.isAfter=(r,o)=>this.overrides?.isAfter?this.overrides.isAfter(r,o):li(r,o),this.isBefore=(r,o)=>this.overrides?.isBefore?this.overrides.isBefore(r,o):ci(r,o),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):ui(r),this.isSameDay=(r,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,o):fi(r,o),this.isSameMonth=(r,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,o):di(r,o),this.isSameYear=(r,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,o):pi(r,o),this.max=r=>this.overrides?.max?this.overrides.max(r):hi(r),this.min=r=>this.overrides?.min?this.overrides.min(r):mi(r),this.setMonth=(r,o)=>this.overrides?.setMonth?this.overrides.setMonth(r,o):yi(r,o),this.setYear=(r,o)=>this.overrides?.setYear?this.overrides.setYear(r,o):vi(r,o),this.startOfBroadcastWeek=(r,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):eo(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):gi(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):bi(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):wi(r),this.startOfWeek=(r,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Oi(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):Si(r),this.options={locale:cr,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let o=0;o<10;o++)r[o.toString()]=n.format(o);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&fe.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:o}=this.options,i=n?.code;if(i&&fe.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:o}).format(t)}catch{}const a=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,a)}}fe.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Te=new fe;class to{constructor(t,n,r=Te){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class Cl{constructor(t,n){this.date=t,this.weeks=n}}class Tl{constructor(t,n){this.days=n,this.weekNumber=t}}function Ml(e){return w.createElement("button",{...e})}function xl(e){return w.createElement("span",{...e})}function Nl(e){const{size:t=24,orientation:n="left",className:r}=e;return w.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&w.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&w.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&w.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&w.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function Pl(e){const{day:t,modifiers:n,...r}=e;return w.createElement("td",{...r})}function Dl(e){const{day:t,modifiers:n,...r}=e,o=w.useRef(null);return w.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),w.createElement("button",{ref:o,...r})}var I;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(I||(I={}));var Z;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(Z||(Z={}));var ve;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(ve||(ve={}));var ue;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(ue||(ue={}));function Il(e){const{options:t,className:n,components:r,classNames:o,...i}=e,a=[o[I.Dropdown],n].join(" "),s=t?.find(({value:l})=>l===i.value);return w.createElement("span",{"data-disabled":i.disabled,className:o[I.DropdownRoot]},w.createElement(r.Select,{className:a,...i},t?.map(({value:l,label:u,disabled:f})=>w.createElement(r.Option,{key:l,value:l,disabled:f},u))),w.createElement("span",{className:o[I.CaptionLabel],"aria-hidden":!0},s?.label,w.createElement(r.Chevron,{orientation:"down",size:18,className:o[I.Chevron]})))}function Rl(e){return w.createElement("div",{...e})}function Wl(e){return w.createElement("div",{...e})}function Al(e){const{calendarMonth:t,displayIndex:n,...r}=e;return w.createElement("div",{...r},e.children)}function _l(e){const{calendarMonth:t,displayIndex:n,...r}=e;return w.createElement("div",{...r})}function jl(e){return w.createElement("table",{...e})}function Fl(e){return w.createElement("div",{...e})}const no=b.createContext(void 0);function wt(){const e=b.useContext(no);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Ll(e){const{components:t}=wt();return w.createElement(t.Dropdown,{...e})}function Bl(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:o,...i}=e,{components:a,classNames:s,labels:{labelPrevious:l,labelNext:u}}=wt(),f=b.useCallback(d=>{o&&n?.(d)},[o,n]),c=b.useCallback(d=>{r&&t?.(d)},[r,t]);return w.createElement("nav",{...i},w.createElement(a.PreviousMonthButton,{type:"button",className:s[I.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":l(r),onClick:c},w.createElement(a.Chevron,{disabled:r?void 0:!0,className:s[I.Chevron],orientation:"left"})),w.createElement(a.NextMonthButton,{type:"button",className:s[I.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":u(o),onClick:f},w.createElement(a.Chevron,{disabled:o?void 0:!0,orientation:"right",className:s[I.Chevron]})))}function $l(e){const{components:t}=wt();return w.createElement(t.Button,{...e})}function Hl(e){return w.createElement("option",{...e})}function Ul(e){const{components:t}=wt();return w.createElement(t.Button,{...e})}function zl(e){const{rootRef:t,...n}=e;return w.createElement("div",{...n,ref:t})}function Yl(e){return w.createElement("select",{...e})}function ql(e){const{week:t,...n}=e;return w.createElement("tr",{...n})}function Gl(e){return w.createElement("th",{...e})}function Vl(e){return w.createElement("thead",{"aria-hidden":!0},w.createElement("tr",{...e}))}function Kl(e){const{week:t,...n}=e;return w.createElement("th",{...n})}function Zl(e){return w.createElement("th",{...e})}function Jl(e){return w.createElement("tbody",{...e})}function Xl(e){const{components:t}=wt();return w.createElement(t.Dropdown,{...e})}const Ql=Object.freeze(Object.defineProperty({__proto__:null,Button:Ml,CaptionLabel:xl,Chevron:Nl,Day:Pl,DayButton:Dl,Dropdown:Il,DropdownNav:Rl,Footer:Wl,Month:Al,MonthCaption:_l,MonthGrid:jl,Months:Fl,MonthsDropdown:Ll,Nav:Bl,NextMonthButton:$l,Option:Hl,PreviousMonthButton:Ul,Root:zl,Select:Yl,Week:ql,WeekNumber:Kl,WeekNumberHeader:Zl,Weekday:Gl,Weekdays:Vl,Weeks:Jl,YearsDropdown:Xl},Symbol.toStringTag,{value:"Module"}));function Pe(e,t,n=!1,r=Te){let{from:o,to:i}=e;const{differenceInCalendarDays:a,isSameDay:s}=r;return o&&i?(a(i,o)<0&&([o,i]=[i,o]),a(t,o)>=(n?1:0)&&a(i,t)>=(n?1:0)):!n&&i?s(i,t):!n&&o?s(o,t):!1}function ro(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function gn(e){return!!(e&&typeof e=="object"&&"from"in e)}function oo(e){return!!(e&&typeof e=="object"&&"after"in e)}function io(e){return!!(e&&typeof e=="object"&&"before"in e)}function so(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function ao(e,t){return Array.isArray(e)&&e.every(t.isDate)}function De(e,t,n=Te){const r=Array.isArray(t)?t:[t],{isSameDay:o,differenceInCalendarDays:i,isAfter:a}=n;return r.some(s=>{if(typeof s=="boolean")return s;if(n.isDate(s))return o(e,s);if(ao(s,n))return s.includes(e);if(gn(s))return Pe(s,e,!1,n);if(so(s))return Array.isArray(s.dayOfWeek)?s.dayOfWeek.includes(e.getDay()):s.dayOfWeek===e.getDay();if(ro(s)){const l=i(s.before,e),u=i(s.after,e),f=l>0,c=u<0;return a(s.before,s.after)?c&&f:f||c}return oo(s)?i(e,s.after)>0:io(s)?i(s.before,e)>0:typeof s=="function"?s(e):!1})}function ec(e,t,n,r,o){const{disabled:i,hidden:a,modifiers:s,showOutsideDays:l,broadcastCalendar:u,today:f}=t,{isSameDay:c,isSameMonth:d,startOfMonth:p,isBefore:h,endOfMonth:v,isAfter:O}=o,y=n&&p(n),m=r&&v(r),S={[Z.focused]:[],[Z.outside]:[],[Z.disabled]:[],[Z.hidden]:[],[Z.today]:[]},D={};for(const E of e){const{date:C,displayMonth:M}=E,j=!!(M&&!d(C,M)),J=!!(y&&h(C,y)),Y=!!(m&&O(C,m)),Q=!!(i&&De(C,i,o)),re=!!(a&&De(C,a,o))||J||Y||!u&&!l&&j||u&&l===!1&&j,Me=c(C,f??o.today());j&&S.outside.push(E),Q&&S.disabled.push(E),re&&S.hidden.push(E),Me&&S.today.push(E),s&&Object.keys(s).forEach(le=>{const de=s?.[le];de&&De(C,de,o)&&(D[le]?D[le].push(E):D[le]=[E])})}return E=>{const C={[Z.focused]:!1,[Z.disabled]:!1,[Z.hidden]:!1,[Z.outside]:!1,[Z.today]:!1},M={};for(const j in S){const J=S[j];C[j]=J.some(Y=>Y===E)}for(const j in D)M[j]=D[j].some(J=>J===E);return{...C,...M}}}function tc(e,t,n={}){return Object.entries(e).filter(([,o])=>o===!0).reduce((o,[i])=>(n[i]?o.push(n[i]):t[Z[i]]?o.push(t[Z[i]]):t[ve[i]]&&o.push(t[ve[i]]),o),[t[I.Day]])}function nc(e){return{...Ql,...e}}function rc(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function oc(){const e={};for(const t in I)e[I[t]]=`rdp-${I[t]}`;for(const t in Z)e[Z[t]]=`rdp-${Z[t]}`;for(const t in ve)e[ve[t]]=`rdp-${ve[t]}`;for(const t in ue)e[ue[t]]=`rdp-${ue[t]}`;return e}function lo(e,t,n){return(n??new fe(t)).formatMonthYear(e)}const ic=lo;function sc(e,t,n){return(n??new fe(t)).format(e,"d")}function ac(e,t=Te){return t.format(e,"LLLL")}function lc(e,t,n){return(n??new fe(t)).format(e,"cccccc")}function cc(e,t=Te){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function uc(){return""}function co(e,t=Te){return t.format(e,"yyyy")}const fc=co,dc=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:lo,formatDay:sc,formatMonthCaption:ic,formatMonthDropdown:ac,formatWeekNumber:cc,formatWeekNumberHeader:uc,formatWeekdayName:lc,formatYearCaption:fc,formatYearDropdown:co},Symbol.toStringTag,{value:"Module"}));function pc(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...dc,...e}}function hc(e,t,n,r,o){const{startOfMonth:i,startOfYear:a,endOfYear:s,eachMonthOfInterval:l,getMonth:u}=o;return l({start:a(e),end:s(e)}).map(d=>{const p=r.formatMonthDropdown(d,o),h=u(d),v=t&&di(n)||!1;return{value:h,label:p,disabled:v}})}function mc(e,t={},n={}){let r={...t?.[I.Day]};return Object.entries(e).filter(([,o])=>o===!0).forEach(([o])=>{r={...r,...n?.[o]}}),r}function yc(e,t,n){const r=e.today(),o=t?e.startOfISOWeek(r):e.startOfWeek(r),i=[];for(let a=0;a<7;a++){const s=e.addDays(o,a);i.push(s)}return i}function vc(e,t,n,r,o=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:a,eachYearOfInterval:s,getYear:l}=r,u=i(e),f=a(t),c=s({start:u,end:f});return o&&c.reverse(),c.map(d=>{const p=n.formatYearDropdown(d,r);return{value:l(d),label:p,disabled:!1}})}function uo(e,t,n,r){let o=(r??new fe(n)).format(e,"PPPP");return t.today&&(o=`Today, ${o}`),t.selected&&(o=`${o}, selected`),o}const gc=uo;function fo(e,t,n){return(n??new fe(t)).formatMonthYear(e)}const bc=fo;function wc(e,t,n,r){let o=(r??new fe(n)).format(e,"PPPP");return t?.today&&(o=`Today, ${o}`),o}function Oc(e){return"Choose the Month"}function Sc(){return""}function Ec(e){return"Go to the Next Month"}function kc(e){return"Go to the Previous Month"}function Cc(e,t,n){return(n??new fe(t)).format(e,"cccc")}function Tc(e,t){return`Week ${e}`}function Mc(e){return"Week Number"}function xc(e){return"Choose the Year"}const Nc=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:bc,labelDay:gc,labelDayButton:uo,labelGrid:fo,labelGridcell:wc,labelMonthDropdown:Oc,labelNav:Sc,labelNext:Ec,labelPrevious:kc,labelWeekNumber:Tc,labelWeekNumberHeader:Mc,labelWeekday:Cc,labelYearDropdown:xc},Symbol.toStringTag,{value:"Module"})),Ot=e=>e instanceof HTMLElement?e:null,Zt=e=>[...e.querySelectorAll("[data-animated-month]")??[]],Pc=e=>Ot(e.querySelector("[data-animated-month]")),Jt=e=>Ot(e.querySelector("[data-animated-caption]")),Xt=e=>Ot(e.querySelector("[data-animated-weeks]")),Dc=e=>Ot(e.querySelector("[data-animated-nav]")),Ic=e=>Ot(e.querySelector("[data-animated-weekdays]"));function Rc(e,t,{classNames:n,months:r,focused:o,dateLib:i}){const a=b.useRef(null),s=b.useRef(r),l=b.useRef(!1);b.useLayoutEffect(()=>{const u=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||u.length===0||r.length!==u.length)return;const f=i.isSameMonth(r[0].date,u[0].date),c=i.isAfter(r[0].date,u[0].date),d=c?n[ue.caption_after_enter]:n[ue.caption_before_enter],p=c?n[ue.weeks_after_enter]:n[ue.weeks_before_enter],h=a.current,v=e.current.cloneNode(!0);if(v instanceof HTMLElement?(Zt(v).forEach(S=>{if(!(S instanceof HTMLElement))return;const D=Pc(S);D&&S.contains(D)&&S.removeChild(D);const E=Jt(S);E&&E.classList.remove(d);const C=Xt(S);C&&C.classList.remove(p)}),a.current=v):a.current=null,l.current||f||o)return;const O=h instanceof HTMLElement?Zt(h):[],y=Zt(e.current);if(y?.every(m=>m instanceof HTMLElement)&&O&&O.every(m=>m instanceof HTMLElement)){l.current=!0,e.current.style.isolation="isolate";const m=Dc(e.current);m&&(m.style.zIndex="1"),y.forEach((S,D)=>{const E=O[D];if(!E)return;S.style.position="relative",S.style.overflow="hidden";const C=Jt(S);C&&C.classList.add(d);const M=Xt(S);M&&M.classList.add(p);const j=()=>{l.current=!1,e.current&&(e.current.style.isolation=""),m&&(m.style.zIndex=""),C&&C.classList.remove(d),M&&M.classList.remove(p),S.style.position="",S.style.overflow="",S.contains(E)&&S.removeChild(E)};E.style.pointerEvents="none",E.style.position="absolute",E.style.overflow="hidden",E.setAttribute("aria-hidden","true");const J=Ic(E);J&&(J.style.opacity="0");const Y=Jt(E);Y&&(Y.classList.add(c?n[ue.caption_before_exit]:n[ue.caption_after_exit]),Y.addEventListener("animationend",j));const Q=Xt(E);Q&&Q.classList.add(c?n[ue.weeks_before_exit]:n[ue.weeks_after_exit]),S.insertBefore(E,S.firstChild)})}})}function Wc(e,t,n,r){const o=e[0],i=e[e.length-1],{ISOWeek:a,fixedWeeks:s,broadcastCalendar:l}=n??{},{addDays:u,differenceInCalendarDays:f,differenceInCalendarMonths:c,endOfBroadcastWeek:d,endOfISOWeek:p,endOfMonth:h,endOfWeek:v,isAfter:O,startOfBroadcastWeek:y,startOfISOWeek:m,startOfWeek:S}=r,D=l?y(o,r):a?m(o):S(o),E=l?d(i):a?p(h(i)):v(h(i)),C=f(E,D),M=c(i,o)+1,j=[];for(let Q=0;Q<=C;Q++){const re=u(D,Q);if(t&&O(re,t))break;j.push(re)}const Y=(l?35:42)*M;if(s&&j.length{const o=r.weeks.reduce((i,a)=>i.concat(a.days.slice()),t.slice());return n.concat(o.slice())},t.slice())}function _c(e,t,n,r){const{numberOfMonths:o=1}=n,i=[];for(let a=0;at)break;i.push(s)}return i}function sr(e,t,n,r){const{month:o,defaultMonth:i,today:a=r.today(),numberOfMonths:s=1}=e;let l=o||i||a;const{differenceInCalendarMonths:u,addMonths:f,startOfMonth:c}=r;if(n&&u(n,l){const y=n.broadcastCalendar?c(O,r):n.ISOWeek?d(O):p(O),m=n.broadcastCalendar?i(O):n.ISOWeek?a(s(O)):l(s(O)),S=t.filter(M=>M>=y&&M<=m),D=n.broadcastCalendar?35:42;if(n.fixedWeeks&&S.length{const J=D-S.length;return j>m&&j<=o(m,J)});S.push(...M)}const E=S.reduce((M,j)=>{const J=n.ISOWeek?u(j):f(j),Y=M.find(re=>re.weekNumber===J),Q=new to(j,O,r);return Y?Y.days.push(Q):M.push(new Tl(J,[Q])),M},[]),C=new Cl(O,E);return v.push(C),v},[]);return n.reverseMonths?h.reverse():h}function Fc(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:o,startOfDay:i,startOfMonth:a,endOfMonth:s,addYears:l,endOfYear:u,newDate:f,today:c}=t,{fromYear:d,toYear:p,fromMonth:h,toMonth:v}=e;!n&&h&&(n=h),!n&&d&&(n=t.newDate(d,0,1)),!r&&v&&(r=v),!r&&p&&(r=f(p,11,31));const O=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=a(n):d?n=f(d,0,1):!n&&O&&(n=o(l(e.today??c(),-100))),r?r=s(r):p?r=f(p,11,31):!r&&O&&(r=u(e.today??c())),[n&&i(n),r&&i(r)]}function Lc(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:i=1}=n,{startOfMonth:a,addMonths:s,differenceInCalendarMonths:l}=r,u=o?i:1,f=a(e);if(!t)return s(f,u);if(!(l(t,e)n.concat(r.weeks.slice()),t.slice())}function _t(e,t){const[n,r]=b.useState(e);return[t===void 0?n:t,r]}function Hc(e,t){const[n,r]=Fc(e,t),{startOfMonth:o,endOfMonth:i}=t,a=sr(e,n,r,t),[s,l]=_t(a,e.month?a:void 0);b.useEffect(()=>{const C=sr(e,n,r,t);l(C)},[e.timeZone]);const u=_c(s,r,e,t),f=Wc(u,e.endMonth?i(e.endMonth):void 0,e,t),c=jc(u,f,e,t),d=$c(c),p=Ac(c),h=Bc(s,n,e,t),v=Lc(s,r,e,t),{disableNavigation:O,onMonthChange:y}=e,m=C=>d.some(M=>M.days.some(j=>j.isEqualTo(C))),S=C=>{if(O)return;let M=o(C);n&&Mo(r)&&(M=o(r)),l(M),y?.(M)};return{months:c,weeks:d,days:p,navStart:n,navEnd:r,previousMonth:h,nextMonth:v,goToMonth:S,goToDay:C=>{m(C)||S(C.date)}}}var we;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(we||(we={}));function ar(e){return!e[Z.disabled]&&!e[Z.hidden]&&!e[Z.outside]}function Uc(e,t,n,r){let o,i=-1;for(const a of e){const s=t(a);ar(s)&&(s[Z.focused]&&iar(t(a)))),o}function zc(e,t,n,r,o,i,a){const{ISOWeek:s,broadcastCalendar:l}=i,{addDays:u,addMonths:f,addWeeks:c,addYears:d,endOfBroadcastWeek:p,endOfISOWeek:h,endOfWeek:v,max:O,min:y,startOfBroadcastWeek:m,startOfISOWeek:S,startOfWeek:D}=a;let C={day:u,week:c,month:f,year:d,startOfWeek:M=>l?m(M,a):s?S(M):D(M),endOfWeek:M=>l?p(M):s?h(M):v(M)}[e](n,t==="after"?1:-1);return t==="before"&&r?C=O([r,C]):t==="after"&&o&&(C=y([o,C])),C}function po(e,t,n,r,o,i,a,s=0){if(s>365)return;const l=zc(e,t,n.date,r,o,i,a),u=!!(i.disabled&&De(l,i.disabled,a)),f=!!(i.hidden&&De(l,i.hidden,a)),c=l,d=new to(l,c,a);return!u&&!f?d:po(e,t,d,r,o,i,a,s+1)}function Yc(e,t,n,r,o){const{autoFocus:i}=e,[a,s]=b.useState(),l=Uc(t.days,n,r||(()=>!1),a),[u,f]=b.useState(i?l:void 0);return{isFocusTarget:v=>!!l?.isEqualTo(v),setFocused:f,focused:u,blur:()=>{s(u),f(void 0)},moveFocus:(v,O)=>{if(!u)return;const y=po(v,O,u,t.navStart,t.navEnd,e,o);y&&(e.disableNavigation&&!t.days.some(S=>S.isEqualTo(y))||(t.goToDay(y),f(y)))}}}function qc(e,t){const{selected:n,required:r,onSelect:o}=e,[i,a]=_t(n,o?n:void 0),s=o?n:i,{isSameDay:l}=t,u=p=>s?.some(h=>l(h,p))??!1,{min:f,max:c}=e;return{selected:s,select:(p,h,v)=>{let O=[...s??[]];if(u(p)){if(s?.length===f||r&&s?.length===1)return;O=s?.filter(y=>!l(y,p))}else s?.length===c?O=[p]:O=[...O,p];return o||a(O),o?.(O,p,h,v),O},isSelected:u}}function Gc(e,t,n=0,r=0,o=!1,i=Te){const{from:a,to:s}=t||{},{isSameDay:l,isAfter:u,isBefore:f}=i;let c;if(!a&&!s)c={from:e,to:n>0?void 0:e};else if(a&&!s)l(a,e)?n===0?c={from:a,to:e}:o?c={from:a,to:void 0}:c=void 0:f(e,a)?c={from:e,to:a}:c={from:a,to:e};else if(a&&s)if(l(a,e)&&l(s,e))o?c={from:a,to:s}:c=void 0;else if(l(a,e))c={from:a,to:n>0?void 0:e};else if(l(s,e))c={from:e,to:n>0?void 0:e};else if(f(e,a))c={from:e,to:s};else if(u(e,a))c={from:a,to:e};else if(u(e,s))c={from:a,to:e};else throw new Error("Invalid range");if(c?.from&&c?.to){const d=i.differenceInCalendarDays(c.to,c.from);r>0&&d>r?c={from:e,to:void 0}:n>1&&dtypeof s!="function").some(s=>typeof s=="boolean"?s:n.isDate(s)?Pe(e,s,!1,n):ao(s,n)?s.some(l=>Pe(e,l,!1,n)):gn(s)?s.from&&s.to?lr(e,{from:s.from,to:s.to},n):!1:so(s)?Vc(e,s.dayOfWeek,n):ro(s)?n.isAfter(s.before,s.after)?lr(e,{from:n.addDays(s.after,1),to:n.addDays(s.before,-1)},n):De(e.from,s,n)||De(e.to,s,n):oo(s)||io(s)?De(e.from,s,n)||De(e.to,s,n):!1))return!0;const a=r.filter(s=>typeof s=="function");if(a.length){let s=e.from;const l=n.differenceInCalendarDays(e.to,e.from);for(let u=0;u<=l;u++){if(a.some(f=>f(s)))return!0;s=n.addDays(s,1)}}return!1}function Zc(e,t){const{disabled:n,excludeDisabled:r,selected:o,required:i,onSelect:a}=e,[s,l]=_t(o,a?o:void 0),u=a?o:s;return{selected:u,select:(d,p,h)=>{const{min:v,max:O}=e,y=d?Gc(d,u,v,O,i,t):void 0;return r&&n&&y?.from&&y.to&&Kc({from:y.from,to:y.to},n,t)&&(y.from=d,y.to=void 0),a||l(y),a?.(y,d,p,h),y},isSelected:d=>u&&Pe(u,d,!1,t)}}function Jc(e,t){const{selected:n,required:r,onSelect:o}=e,[i,a]=_t(n,o?n:void 0),s=o?n:i,{isSameDay:l}=t;return{selected:s,select:(c,d,p)=>{let h=c;return!r&&s&&s&&l(c,s)&&(h=void 0),o||a(h),o?.(h,c,d,p),h},isSelected:c=>s?l(s,c):!1}}function Xc(e,t){const n=Jc(e,t),r=qc(e,t),o=Zc(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return o;default:return}}function su(e){let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new te(t.today,t.timeZone)),t.month&&(t.month=new te(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new te(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new te(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new te(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new te(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(L=>new te(L,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new te(t.selected.from,t.timeZone):void 0,to:t.selected.to?new te(t.selected.to,t.timeZone):void 0}));const{components:n,formatters:r,labels:o,dateLib:i,locale:a,classNames:s}=b.useMemo(()=>{const L={...cr,...t.locale};return{dateLib:new fe({locale:L,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:nc(t.components),formatters:pc(t.formatters),labels:{...Nc,...t.labels},locale:L,classNames:{...oc(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:l,mode:u,navLayout:f,numberOfMonths:c=1,onDayBlur:d,onDayClick:p,onDayFocus:h,onDayKeyDown:v,onDayMouseEnter:O,onDayMouseLeave:y,onNextClick:m,onPrevClick:S,showWeekNumber:D,styles:E}=t,{formatCaption:C,formatDay:M,formatMonthDropdown:j,formatWeekNumber:J,formatWeekNumberHeader:Y,formatWeekdayName:Q,formatYearDropdown:re}=r,Me=Hc(t,i),{days:le,months:de,navStart:Ie,navEnd:je,previousMonth:ie,nextMonth:se,goToMonth:pe}=Me,Ue=ec(le,t,Ie,je,i),{isSelected:k,select:W,selected:F}=Xc(t,i)??{},{blur:R,focused:U,isFocusTarget:G,moveFocus:ee,setFocused:X}=Yc(t,Me,Ue,k??(()=>!1),i),{labelDayButton:ze,labelGridcell:ho,labelGrid:mo,labelMonthDropdown:yo,labelNav:bn,labelPrevious:vo,labelNext:go,labelWeekday:bo,labelWeekNumber:wo,labelWeekNumberHeader:Oo,labelYearDropdown:So}=o,Eo=b.useMemo(()=>yc(i,t.ISOWeek),[i,t.ISOWeek]),wn=u!==void 0||p!==void 0,jt=b.useCallback(()=>{ie&&(pe(ie),S?.(ie))},[ie,pe,S]),Ft=b.useCallback(()=>{se&&(pe(se),m?.(se))},[pe,se,m]),ko=b.useCallback((L,V)=>_=>{_.preventDefault(),_.stopPropagation(),X(L),W?.(L.date,V,_),p?.(L.date,V,_)},[W,p,X]),Co=b.useCallback((L,V)=>_=>{X(L),h?.(L.date,V,_)},[h,X]),To=b.useCallback((L,V)=>_=>{R(),d?.(L.date,V,_)},[R,d]),Mo=b.useCallback((L,V)=>_=>{const q={ArrowLeft:[_.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[_.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[_.shiftKey?"year":"week","after"],ArrowUp:[_.shiftKey?"year":"week","before"],PageUp:[_.shiftKey?"year":"month","before"],PageDown:[_.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(q[_.key]){_.preventDefault(),_.stopPropagation();const[ce,H]=q[_.key];ee(ce,H)}v?.(L.date,V,_)},[ee,v,t.dir]),xo=b.useCallback((L,V)=>_=>{O?.(L.date,V,_)},[O]),No=b.useCallback((L,V)=>_=>{y?.(L.date,V,_)},[y]),Po=b.useCallback(L=>V=>{const _=Number(V.target.value),q=i.setMonth(i.startOfMonth(L),_);pe(q)},[i,pe]),Do=b.useCallback(L=>V=>{const _=Number(V.target.value),q=i.setYear(i.startOfMonth(L),_);pe(q)},[i,pe]),{className:Io,style:Ro}=b.useMemo(()=>({className:[s[I.Root],t.className].filter(Boolean).join(" "),style:{...E?.[I.Root],...t.style}}),[s,t.className,t.style,E]),Wo=rc(t),On=b.useRef(null);Rc(On,!!t.animate,{classNames:s,months:de,focused:U,dateLib:i});const Ao={dayPickerProps:t,selected:F,select:W,isSelected:k,months:de,nextMonth:se,previousMonth:ie,goToMonth:pe,getModifiers:Ue,components:n,classNames:s,styles:E,labels:o,formatters:r};return w.createElement(no.Provider,{value:Ao},w.createElement(n.Root,{rootRef:t.animate?On:void 0,className:Io,style:Ro,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...Wo},w.createElement(n.Months,{className:s[I.Months],style:E?.[I.Months]},!t.hideNavigation&&!f&&w.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:s[I.Nav],style:E?.[I.Nav],"aria-label":bn(),onPreviousClick:jt,onNextClick:Ft,previousMonth:ie,nextMonth:se}),de.map((L,V)=>w.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:s[I.Month],style:E?.[I.Month],key:V,displayIndex:V,calendarMonth:L},f==="around"&&!t.hideNavigation&&V===0&&w.createElement(n.PreviousMonthButton,{type:"button",className:s[I.PreviousMonthButton],tabIndex:ie?void 0:-1,"aria-disabled":ie?void 0:!0,"aria-label":vo(ie),onClick:jt,"data-animated-button":t.animate?"true":void 0},w.createElement(n.Chevron,{disabled:ie?void 0:!0,className:s[I.Chevron],orientation:t.dir==="rtl"?"right":"left"})),w.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:s[I.MonthCaption],style:E?.[I.MonthCaption],calendarMonth:L,displayIndex:V},l?.startsWith("dropdown")?w.createElement(n.DropdownNav,{className:s[I.Dropdowns],style:E?.[I.Dropdowns]},(()=>{const _=l==="dropdown"||l==="dropdown-months"?w.createElement(n.MonthsDropdown,{key:"month",className:s[I.MonthsDropdown],"aria-label":yo(),classNames:s,components:n,disabled:!!t.disableNavigation,onChange:Po(L.date),options:hc(L.date,Ie,je,r,i),style:E?.[I.Dropdown],value:i.getMonth(L.date)}):w.createElement("span",{key:"month"},j(L.date,i)),q=l==="dropdown"||l==="dropdown-years"?w.createElement(n.YearsDropdown,{key:"year",className:s[I.YearsDropdown],"aria-label":So(i.options),classNames:s,components:n,disabled:!!t.disableNavigation,onChange:Do(L.date),options:vc(Ie,je,r,i,!!t.reverseYears),style:E?.[I.Dropdown],value:i.getYear(L.date)}):w.createElement("span",{key:"year"},re(L.date,i));return i.getMonthYearOrder()==="year-first"?[q,_]:[_,q]})(),w.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},C(L.date,i.options,i))):w.createElement(n.CaptionLabel,{className:s[I.CaptionLabel],role:"status","aria-live":"polite"},C(L.date,i.options,i))),f==="around"&&!t.hideNavigation&&V===c-1&&w.createElement(n.NextMonthButton,{type:"button",className:s[I.NextMonthButton],tabIndex:se?void 0:-1,"aria-disabled":se?void 0:!0,"aria-label":go(se),onClick:Ft,"data-animated-button":t.animate?"true":void 0},w.createElement(n.Chevron,{disabled:se?void 0:!0,className:s[I.Chevron],orientation:t.dir==="rtl"?"left":"right"})),V===c-1&&f==="after"&&!t.hideNavigation&&w.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:s[I.Nav],style:E?.[I.Nav],"aria-label":bn(),onPreviousClick:jt,onNextClick:Ft,previousMonth:ie,nextMonth:se}),w.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":mo(L.date,i.options,i)||void 0,className:s[I.MonthGrid],style:E?.[I.MonthGrid]},!t.hideWeekdays&&w.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:s[I.Weekdays],style:E?.[I.Weekdays]},D&&w.createElement(n.WeekNumberHeader,{"aria-label":Oo(i.options),className:s[I.WeekNumberHeader],style:E?.[I.WeekNumberHeader],scope:"col"},Y()),Eo.map(_=>w.createElement(n.Weekday,{"aria-label":bo(_,i.options,i),className:s[I.Weekday],key:String(_),style:E?.[I.Weekday],scope:"col"},Q(_,i.options,i)))),w.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:s[I.Weeks],style:E?.[I.Weeks]},L.weeks.map(_=>w.createElement(n.Week,{className:s[I.Week],key:_.weekNumber,style:E?.[I.Week],week:_},D&&w.createElement(n.WeekNumber,{week:_,style:E?.[I.WeekNumber],"aria-label":wo(_.weekNumber,{locale:a}),className:s[I.WeekNumber],scope:"row",role:"rowheader"},J(_.weekNumber,i)),_.days.map(q=>{const{date:ce}=q,H=Ue(q);if(H[Z.focused]=!H.hidden&&!!U?.isEqualTo(q),H[ve.selected]=k?.(ce)||H.selected,gn(F)){const{from:Lt,to:Bt}=F;H[ve.range_start]=!!(Lt&&Bt&&i.isSameDay(ce,Lt)),H[ve.range_end]=!!(Lt&&Bt&&i.isSameDay(ce,Bt)),H[ve.range_middle]=Pe(F,ce,!0,i)}const _o=mc(H,E,t.modifiersStyles),jo=tc(H,s,t.modifiersClassNames),Fo=!wn&&!H.hidden?ho(ce,H,i.options,i):void 0;return w.createElement(n.Day,{key:`${i.format(ce,"yyyy-MM-dd")}_${i.format(q.displayMonth,"yyyy-MM")}`,day:q,modifiers:H,className:jo.join(" "),style:_o,role:"gridcell","aria-selected":H.selected||void 0,"aria-label":Fo,"data-day":i.format(ce,"yyyy-MM-dd"),"data-month":q.outside?i.format(ce,"yyyy-MM"):void 0,"data-selected":H.selected||void 0,"data-disabled":H.disabled||void 0,"data-hidden":H.hidden||void 0,"data-outside":q.outside||void 0,"data-focused":H.focused||void 0,"data-today":H.today||void 0},!H.hidden&&wn?w.createElement(n.DayButton,{className:s[I.DayButton],style:E?.[I.DayButton],type:"button",day:q,modifiers:H,disabled:H.disabled||void 0,tabIndex:G(q)?0:-1,"aria-label":ze(ce,H,i.options,i),onClick:ko(q,H),onBlur:To(q,H),onFocus:Co(q,H),onKeyDown:Mo(q,H),onMouseEnter:xo(q,H),onMouseLeave:No(q,H)},M(ce,i.options,i)):!H.hidden&&M(q.date,i.options,i))})))))))),t.footer&&w.createElement(n.Footer,{className:s[I.Footer],style:E?.[I.Footer],role:"status","aria-live":"polite"},t.footer)))}export{su as D,ou as _,iu as c,oc as g}; diff --git a/webui/dist/assets/radix-core-C3XKqQJw.js b/webui/dist/assets/radix-core-9dEfQl-6.js similarity index 99% rename from webui/dist/assets/radix-core-C3XKqQJw.js rename to webui/dist/assets/radix-core-9dEfQl-6.js index d16e79af..b91c3865 100644 --- a/webui/dist/assets/radix-core-C3XKqQJw.js +++ b/webui/dist/assets/radix-core-9dEfQl-6.js @@ -1,4 +1,4 @@ -import{r as i,j as v,R as Ee,a as sn,b as Ye,c as ds}from"./router-CWhjJi2n.js";function N(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function fs(e,t){const n=i.createContext(t),o=s=>{const{children:a,...c}=s,l=i.useMemo(()=>c,Object.values(c));return v.jsx(n.Provider,{value:l,children:a})};o.displayName=e+"Provider";function r(s){const a=i.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function Oe(e,t=[]){let n=[];function o(s,a){const c=i.createContext(a),l=n.length;n=[...n,a];const u=p=>{const{scope:y,children:h,...x}=p,d=y?.[e]?.[l]||c,m=i.useMemo(()=>x,Object.values(x));return v.jsx(d.Provider,{value:m,children:h})};u.displayName=s+"Provider";function f(p,y){const h=y?.[e]?.[l]||c,x=i.useContext(h);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,f]}const r=()=>{const s=n.map(a=>i.createContext(a));return function(c){const l=c?.[e]||s;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return r.scopeName=e,[o,ps(r,...t)]}function ps(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((c,{useScope:l,scopeName:u})=>{const p=l(s)[`__scope${u}`];return{...c,...p}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Pn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function $e(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Pn(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(vs);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function ms(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=ys(r),c=gs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hs=Symbol("radix.slottable");function vs(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hs}function gs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function ys(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function eo(e){const t=e+"CollectionProvider",[n,o]=Oe(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=d=>{const{scope:m,children:w}=d,g=Ee.useRef(null),C=Ee.useRef(new Map).current;return v.jsx(r,{scope:m,itemMap:C,collectionRef:g,children:w})};a.displayName=t;const c=e+"CollectionSlot",l=An(c),u=Ee.forwardRef((d,m)=>{const{scope:w,children:g}=d,C=s(c,w),b=B(m,C.collectionRef);return v.jsx(l,{ref:b,children:g})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",y=An(f),h=Ee.forwardRef((d,m)=>{const{scope:w,children:g,...C}=d,b=Ee.useRef(null),E=B(m,b),R=s(f,w);return Ee.useEffect(()=>(R.itemMap.set(b,{ref:b,...C}),()=>void R.itemMap.delete(b))),v.jsx(y,{[p]:"",ref:E,children:g})});h.displayName=f;function x(d){const m=s(e+"CollectionConsumer",d);return Ee.useCallback(()=>{const g=m.collectionRef.current;if(!g)return[];const C=Array.from(g.querySelectorAll(`[${p}]`));return Array.from(m.itemMap.values()).sort((R,S)=>C.indexOf(R.ref.current)-C.indexOf(S.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:h},x,o]}var z=globalThis?.document?i.useLayoutEffect:()=>{},ws=sn[" useId ".trim().toString()]||(()=>{}),xs=0;function Se(e){const[t,n]=i.useState(ws());return z(()=>{n(o=>o??String(xs++))},[e]),t?`radix-${t}`:""}function Cs(e){const t=bs(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Ss);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function bs(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Rs(r),c=Ts(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Es=Symbol("radix.slottable");function Ss(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Es}function Ts(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Rs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ps=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=Ps.reduce((e,t)=>{const n=Cs(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function to(e,t){e&&Ye.flushSync(()=>e.dispatchEvent(t))}function ee(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>t.current?.(...n),[])}var As=sn[" useInsertionEffect ".trim().toString()]||z;function ke({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Os({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:r;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const p=f.current;p!==c&&console.warn(`${o} is changing from ${p?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,o])}const u=i.useCallback(f=>{if(c){const p=Is(f)?f(e):f;p!==e&&a.current?.(p)}else s(f)},[c,e,s,a]);return[l,u]}function Os({defaultProp:e,onChange:t}){const[n,o]=i.useState(e),r=i.useRef(n),s=i.useRef(t);return As(()=>{s.current=t},[t]),i.useEffect(()=>{r.current!==n&&(s.current?.(n),r.current=n)},[n,r]),[n,o,s]}function Is(e){return typeof e=="function"}var Ns=i.createContext(void 0);function _s(e){const t=i.useContext(Ns);return e||t||"ltr"}function Ds(e,t){return i.useReducer((n,o)=>t[n][o]??n,e)}var ye=e=>{const{present:t,children:n}=e,o=Ms(t),r=typeof n=="function"?n({present:o.isPresent}):i.Children.only(n),s=B(o.ref,Ls(r));return typeof n=="function"||o.isPresent?i.cloneElement(r,{ref:s}):null};ye.displayName="Presence";function Ms(e){const[t,n]=i.useState(),o=i.useRef(null),r=i.useRef(e),s=i.useRef("none"),a=e?"mounted":"unmounted",[c,l]=Ds(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=Je(o.current);s.current=c==="mounted"?u:"none"},[c]),z(()=>{const u=o.current,f=r.current;if(f!==e){const y=s.current,h=Je(u);e?l("MOUNT"):h==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&y!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),z(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,p=h=>{const d=Je(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&d&&(l("ANIMATION_END"),!r.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},y=h=>{h.target===t&&(s.current=Je(o.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function Je(e){return e?.animationName||"none"}function Ls(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function On(e,[t,n]){return Math.min(n,Math.max(t,e))}var ks=Symbol.for("react.lazy"),lt=sn[" use ".trim().toString()];function js(e){return typeof e=="object"&&e!==null&&"then"in e}function no(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ks&&"_payload"in e&&js(e._payload)}function oo(e){const t=Fs(e),n=i.forwardRef((o,r)=>{let{children:s,...a}=o;no(s)&&typeof lt=="function"&&(s=lt(s._payload));const c=i.Children.toArray(s),l=c.find(Ws);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Ul=oo("Slot");function Fs(e){const t=i.forwardRef((n,o)=>{let{children:r,...s}=n;if(no(r)&&typeof lt=="function"&&(r=lt(r._payload)),i.isValidElement(r)){const a=Vs(r),c=Bs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $s=Symbol("radix.slottable");function Ws(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$s}function Bs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Vs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ro(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function so(e){const[t,n]=i.useState(void 0);return z(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,c;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;a=u.inlineSize,c=u.blockSize}else a=e.offsetWidth,c=e.offsetHeight;n({width:a,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var Hs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Us=Hs.reduce((e,t)=>{const n=oo(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Ks="Label",io=i.forwardRef((e,t)=>v.jsx(Us.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));io.displayName=Ks;var Kl=io;function zs(e,t=globalThis?.document){const n=ee(e);i.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Ys="DismissableLayer",Ut="dismissableLayer.update",Xs="dismissableLayer.pointerDownOutside",Gs="dismissableLayer.focusOutside",In,ao=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xe=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...l}=e,u=i.useContext(ao),[f,p]=i.useState(null),y=f?.ownerDocument??globalThis?.document,[,h]=i.useState({}),x=B(t,S=>p(S)),d=Array.from(u.layers),[m]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=d.indexOf(m),g=f?d.indexOf(f):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,b=g>=w,E=Zs(S=>{const O=S.target,M=[...u.branches].some(L=>L.contains(O));!b||M||(r?.(S),a?.(S),S.defaultPrevented||c?.())},y),R=Qs(S=>{const O=S.target;[...u.branches].some(L=>L.contains(O))||(s?.(S),a?.(S),S.defaultPrevented||c?.())},y);return zs(S=>{g===u.layers.size-1&&(o?.(S),!S.defaultPrevented&&c&&(S.preventDefault(),c()))},y),i.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(In=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Nn(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=In)}},[f,y,n,u]),i.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Nn())},[f,u]),i.useEffect(()=>{const S=()=>h({});return document.addEventListener(Ut,S),()=>document.removeEventListener(Ut,S)},[]),v.jsx(D.div,{...l,ref:x,style:{pointerEvents:C?b?"auto":"none":void 0,...e.style},onFocusCapture:N(e.onFocusCapture,R.onFocusCapture),onBlurCapture:N(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:N(e.onPointerDownCapture,E.onPointerDownCapture)})});Xe.displayName=Ys;var qs="DismissableLayerBranch",co=i.forwardRef((e,t)=>{const n=i.useContext(ao),o=i.useRef(null),r=B(t,o);return i.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(D.div,{...e,ref:r})});co.displayName=qs;function Zs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1),r=i.useRef(()=>{});return i.useEffect(()=>{const s=c=>{if(c.target&&!o.current){let l=function(){lo(Xs,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Qs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1);return i.useEffect(()=>{const r=s=>{s.target&&!o.current&&lo(Gs,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Nn(){const e=new CustomEvent(Ut);document.dispatchEvent(e)}function lo(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?to(r,s):r.dispatchEvent(s)}var Js=Xe,ei=co,Mt="focusScope.autoFocusOnMount",Lt="focusScope.autoFocusOnUnmount",_n={bubbles:!1,cancelable:!0},ti="FocusScope",an=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[c,l]=i.useState(null),u=ee(r),f=ee(s),p=i.useRef(null),y=B(t,d=>l(d)),h=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(o){let d=function(C){if(h.paused||!c)return;const b=C.target;c.contains(b)?p.current=b:me(p.current,{select:!0})},m=function(C){if(h.paused||!c)return;const b=C.relatedTarget;b!==null&&(c.contains(b)||me(p.current,{select:!0}))},w=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&me(c)};document.addEventListener("focusin",d),document.addEventListener("focusout",m);const g=new MutationObserver(w);return c&&g.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",m),g.disconnect()}}},[o,c,h.paused]),i.useEffect(()=>{if(c){Mn.add(h);const d=document.activeElement;if(!c.contains(d)){const w=new CustomEvent(Mt,_n);c.addEventListener(Mt,u),c.dispatchEvent(w),w.defaultPrevented||(ni(ai(uo(c)),{select:!0}),document.activeElement===d&&me(c))}return()=>{c.removeEventListener(Mt,u),setTimeout(()=>{const w=new CustomEvent(Lt,_n);c.addEventListener(Lt,f),c.dispatchEvent(w),w.defaultPrevented||me(d??document.body,{select:!0}),c.removeEventListener(Lt,f),Mn.remove(h)},0)}}},[c,u,f,h]);const x=i.useCallback(d=>{if(!n&&!o||h.paused)return;const m=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,w=document.activeElement;if(m&&w){const g=d.currentTarget,[C,b]=oi(g);C&&b?!d.shiftKey&&w===b?(d.preventDefault(),n&&me(C,{select:!0})):d.shiftKey&&w===C&&(d.preventDefault(),n&&me(b,{select:!0})):w===g&&d.preventDefault()}},[n,o,h.paused]);return v.jsx(D.div,{tabIndex:-1,...a,ref:y,onKeyDown:x})});an.displayName=ti;function ni(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(me(o,{select:t}),document.activeElement!==n)return}function oi(e){const t=uo(e),n=Dn(t,e),o=Dn(t.reverse(),e);return[n,o]}function uo(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Dn(e,t){for(const n of e)if(!ri(n,{upTo:t}))return n}function ri(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function si(e){return e instanceof HTMLInputElement&&"select"in e}function me(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&si(e)&&t&&e.select()}}var Mn=ii();function ii(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ln(e,t),e.unshift(t)},remove(t){e=Ln(e,t),e[0]?.resume()}}}function Ln(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function ai(e){return e.filter(t=>t.tagName!=="A")}var ci="Portal",Ge=i.forwardRef((e,t)=>{const{container:n,...o}=e,[r,s]=i.useState(!1);z(()=>s(!0),[]);const a=n||r&&globalThis?.document?.body;return a?ds.createPortal(v.jsx(D.div,{...o,ref:t}),a):null});Ge.displayName=ci;var kt=0;function fo(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kn()),document.body.insertAdjacentElement("beforeend",e[1]??kn()),kt++,()=>{kt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),kt--}},[])}function kn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var se=function(){return se=Object.assign||function(t){for(var n,o=1,r=arguments.length;o"u")return Ti;var t=Ri(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},Ai=vo(),Me="data-scroll-locked",Oi=function(e,t,n,o){var r=e.left,s=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),` +import{r as i,j as v,R as Ee,a as sn,b as Ye,c as ds}from"./router-Bz250laD.js";function N(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function fs(e,t){const n=i.createContext(t),o=s=>{const{children:a,...c}=s,l=i.useMemo(()=>c,Object.values(c));return v.jsx(n.Provider,{value:l,children:a})};o.displayName=e+"Provider";function r(s){const a=i.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function Oe(e,t=[]){let n=[];function o(s,a){const c=i.createContext(a),l=n.length;n=[...n,a];const u=p=>{const{scope:y,children:h,...x}=p,d=y?.[e]?.[l]||c,m=i.useMemo(()=>x,Object.values(x));return v.jsx(d.Provider,{value:m,children:h})};u.displayName=s+"Provider";function f(p,y){const h=y?.[e]?.[l]||c,x=i.useContext(h);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,f]}const r=()=>{const s=n.map(a=>i.createContext(a));return function(c){const l=c?.[e]||s;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return r.scopeName=e,[o,ps(r,...t)]}function ps(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((c,{useScope:l,scopeName:u})=>{const p=l(s)[`__scope${u}`];return{...c,...p}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Pn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function $e(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Pn(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(vs);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function ms(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=ys(r),c=gs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hs=Symbol("radix.slottable");function vs(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hs}function gs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function ys(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function eo(e){const t=e+"CollectionProvider",[n,o]=Oe(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=d=>{const{scope:m,children:w}=d,g=Ee.useRef(null),C=Ee.useRef(new Map).current;return v.jsx(r,{scope:m,itemMap:C,collectionRef:g,children:w})};a.displayName=t;const c=e+"CollectionSlot",l=An(c),u=Ee.forwardRef((d,m)=>{const{scope:w,children:g}=d,C=s(c,w),b=B(m,C.collectionRef);return v.jsx(l,{ref:b,children:g})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",y=An(f),h=Ee.forwardRef((d,m)=>{const{scope:w,children:g,...C}=d,b=Ee.useRef(null),E=B(m,b),R=s(f,w);return Ee.useEffect(()=>(R.itemMap.set(b,{ref:b,...C}),()=>void R.itemMap.delete(b))),v.jsx(y,{[p]:"",ref:E,children:g})});h.displayName=f;function x(d){const m=s(e+"CollectionConsumer",d);return Ee.useCallback(()=>{const g=m.collectionRef.current;if(!g)return[];const C=Array.from(g.querySelectorAll(`[${p}]`));return Array.from(m.itemMap.values()).sort((R,S)=>C.indexOf(R.ref.current)-C.indexOf(S.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:h},x,o]}var z=globalThis?.document?i.useLayoutEffect:()=>{},ws=sn[" useId ".trim().toString()]||(()=>{}),xs=0;function Se(e){const[t,n]=i.useState(ws());return z(()=>{n(o=>o??String(xs++))},[e]),t?`radix-${t}`:""}function Cs(e){const t=bs(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Ss);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function bs(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Rs(r),c=Ts(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Es=Symbol("radix.slottable");function Ss(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Es}function Ts(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Rs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ps=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=Ps.reduce((e,t)=>{const n=Cs(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function to(e,t){e&&Ye.flushSync(()=>e.dispatchEvent(t))}function ee(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>t.current?.(...n),[])}var As=sn[" useInsertionEffect ".trim().toString()]||z;function ke({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Os({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:r;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const p=f.current;p!==c&&console.warn(`${o} is changing from ${p?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,o])}const u=i.useCallback(f=>{if(c){const p=Is(f)?f(e):f;p!==e&&a.current?.(p)}else s(f)},[c,e,s,a]);return[l,u]}function Os({defaultProp:e,onChange:t}){const[n,o]=i.useState(e),r=i.useRef(n),s=i.useRef(t);return As(()=>{s.current=t},[t]),i.useEffect(()=>{r.current!==n&&(s.current?.(n),r.current=n)},[n,r]),[n,o,s]}function Is(e){return typeof e=="function"}var Ns=i.createContext(void 0);function _s(e){const t=i.useContext(Ns);return e||t||"ltr"}function Ds(e,t){return i.useReducer((n,o)=>t[n][o]??n,e)}var ye=e=>{const{present:t,children:n}=e,o=Ms(t),r=typeof n=="function"?n({present:o.isPresent}):i.Children.only(n),s=B(o.ref,Ls(r));return typeof n=="function"||o.isPresent?i.cloneElement(r,{ref:s}):null};ye.displayName="Presence";function Ms(e){const[t,n]=i.useState(),o=i.useRef(null),r=i.useRef(e),s=i.useRef("none"),a=e?"mounted":"unmounted",[c,l]=Ds(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=Je(o.current);s.current=c==="mounted"?u:"none"},[c]),z(()=>{const u=o.current,f=r.current;if(f!==e){const y=s.current,h=Je(u);e?l("MOUNT"):h==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&y!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),z(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,p=h=>{const d=Je(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&d&&(l("ANIMATION_END"),!r.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},y=h=>{h.target===t&&(s.current=Je(o.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function Je(e){return e?.animationName||"none"}function Ls(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function On(e,[t,n]){return Math.min(n,Math.max(t,e))}var ks=Symbol.for("react.lazy"),lt=sn[" use ".trim().toString()];function js(e){return typeof e=="object"&&e!==null&&"then"in e}function no(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ks&&"_payload"in e&&js(e._payload)}function oo(e){const t=Fs(e),n=i.forwardRef((o,r)=>{let{children:s,...a}=o;no(s)&&typeof lt=="function"&&(s=lt(s._payload));const c=i.Children.toArray(s),l=c.find(Ws);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Ul=oo("Slot");function Fs(e){const t=i.forwardRef((n,o)=>{let{children:r,...s}=n;if(no(r)&&typeof lt=="function"&&(r=lt(r._payload)),i.isValidElement(r)){const a=Vs(r),c=Bs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $s=Symbol("radix.slottable");function Ws(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$s}function Bs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Vs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ro(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function so(e){const[t,n]=i.useState(void 0);return z(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,c;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;a=u.inlineSize,c=u.blockSize}else a=e.offsetWidth,c=e.offsetHeight;n({width:a,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var Hs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Us=Hs.reduce((e,t)=>{const n=oo(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Ks="Label",io=i.forwardRef((e,t)=>v.jsx(Us.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));io.displayName=Ks;var Kl=io;function zs(e,t=globalThis?.document){const n=ee(e);i.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Ys="DismissableLayer",Ut="dismissableLayer.update",Xs="dismissableLayer.pointerDownOutside",Gs="dismissableLayer.focusOutside",In,ao=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xe=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...l}=e,u=i.useContext(ao),[f,p]=i.useState(null),y=f?.ownerDocument??globalThis?.document,[,h]=i.useState({}),x=B(t,S=>p(S)),d=Array.from(u.layers),[m]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=d.indexOf(m),g=f?d.indexOf(f):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,b=g>=w,E=Zs(S=>{const O=S.target,M=[...u.branches].some(L=>L.contains(O));!b||M||(r?.(S),a?.(S),S.defaultPrevented||c?.())},y),R=Qs(S=>{const O=S.target;[...u.branches].some(L=>L.contains(O))||(s?.(S),a?.(S),S.defaultPrevented||c?.())},y);return zs(S=>{g===u.layers.size-1&&(o?.(S),!S.defaultPrevented&&c&&(S.preventDefault(),c()))},y),i.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(In=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Nn(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=In)}},[f,y,n,u]),i.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Nn())},[f,u]),i.useEffect(()=>{const S=()=>h({});return document.addEventListener(Ut,S),()=>document.removeEventListener(Ut,S)},[]),v.jsx(D.div,{...l,ref:x,style:{pointerEvents:C?b?"auto":"none":void 0,...e.style},onFocusCapture:N(e.onFocusCapture,R.onFocusCapture),onBlurCapture:N(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:N(e.onPointerDownCapture,E.onPointerDownCapture)})});Xe.displayName=Ys;var qs="DismissableLayerBranch",co=i.forwardRef((e,t)=>{const n=i.useContext(ao),o=i.useRef(null),r=B(t,o);return i.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(D.div,{...e,ref:r})});co.displayName=qs;function Zs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1),r=i.useRef(()=>{});return i.useEffect(()=>{const s=c=>{if(c.target&&!o.current){let l=function(){lo(Xs,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Qs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1);return i.useEffect(()=>{const r=s=>{s.target&&!o.current&&lo(Gs,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Nn(){const e=new CustomEvent(Ut);document.dispatchEvent(e)}function lo(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?to(r,s):r.dispatchEvent(s)}var Js=Xe,ei=co,Mt="focusScope.autoFocusOnMount",Lt="focusScope.autoFocusOnUnmount",_n={bubbles:!1,cancelable:!0},ti="FocusScope",an=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[c,l]=i.useState(null),u=ee(r),f=ee(s),p=i.useRef(null),y=B(t,d=>l(d)),h=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(o){let d=function(C){if(h.paused||!c)return;const b=C.target;c.contains(b)?p.current=b:me(p.current,{select:!0})},m=function(C){if(h.paused||!c)return;const b=C.relatedTarget;b!==null&&(c.contains(b)||me(p.current,{select:!0}))},w=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&me(c)};document.addEventListener("focusin",d),document.addEventListener("focusout",m);const g=new MutationObserver(w);return c&&g.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",m),g.disconnect()}}},[o,c,h.paused]),i.useEffect(()=>{if(c){Mn.add(h);const d=document.activeElement;if(!c.contains(d)){const w=new CustomEvent(Mt,_n);c.addEventListener(Mt,u),c.dispatchEvent(w),w.defaultPrevented||(ni(ai(uo(c)),{select:!0}),document.activeElement===d&&me(c))}return()=>{c.removeEventListener(Mt,u),setTimeout(()=>{const w=new CustomEvent(Lt,_n);c.addEventListener(Lt,f),c.dispatchEvent(w),w.defaultPrevented||me(d??document.body,{select:!0}),c.removeEventListener(Lt,f),Mn.remove(h)},0)}}},[c,u,f,h]);const x=i.useCallback(d=>{if(!n&&!o||h.paused)return;const m=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,w=document.activeElement;if(m&&w){const g=d.currentTarget,[C,b]=oi(g);C&&b?!d.shiftKey&&w===b?(d.preventDefault(),n&&me(C,{select:!0})):d.shiftKey&&w===C&&(d.preventDefault(),n&&me(b,{select:!0})):w===g&&d.preventDefault()}},[n,o,h.paused]);return v.jsx(D.div,{tabIndex:-1,...a,ref:y,onKeyDown:x})});an.displayName=ti;function ni(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(me(o,{select:t}),document.activeElement!==n)return}function oi(e){const t=uo(e),n=Dn(t,e),o=Dn(t.reverse(),e);return[n,o]}function uo(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Dn(e,t){for(const n of e)if(!ri(n,{upTo:t}))return n}function ri(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function si(e){return e instanceof HTMLInputElement&&"select"in e}function me(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&si(e)&&t&&e.select()}}var Mn=ii();function ii(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ln(e,t),e.unshift(t)},remove(t){e=Ln(e,t),e[0]?.resume()}}}function Ln(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function ai(e){return e.filter(t=>t.tagName!=="A")}var ci="Portal",Ge=i.forwardRef((e,t)=>{const{container:n,...o}=e,[r,s]=i.useState(!1);z(()=>s(!0),[]);const a=n||r&&globalThis?.document?.body;return a?ds.createPortal(v.jsx(D.div,{...o,ref:t}),a):null});Ge.displayName=ci;var kt=0;function fo(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kn()),document.body.insertAdjacentElement("beforeend",e[1]??kn()),kt++,()=>{kt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),kt--}},[])}function kn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var se=function(){return se=Object.assign||function(t){for(var n,o=1,r=arguments.length;o"u")return Ti;var t=Ri(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},Ai=vo(),Me="data-scroll-locked",Oi=function(e,t,n,o){var r=e.left,s=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),` .`.concat(ui,` { overflow: hidden `).concat(o,`; padding-right: `).concat(c,"px ").concat(o,`; diff --git a/webui/dist/assets/radix-extra-DnIxMvW0.js b/webui/dist/assets/radix-extra-DDK-u9dm.js similarity index 99% rename from webui/dist/assets/radix-extra-DnIxMvW0.js rename to webui/dist/assets/radix-extra-DDK-u9dm.js index c88d08e4..513ee94e 100644 --- a/webui/dist/assets/radix-extra-DnIxMvW0.js +++ b/webui/dist/assets/radix-extra-DDK-u9dm.js @@ -1,4 +1,4 @@ -import{r as i,j as u,d as Po}from"./router-CWhjJi2n.js";import{c as k,a as ke,u as re,P as A,b as P,d as T,e as ne,f as G,g as F,h as V,i as Z,j as be,k as Se,l as Ve,m as Be,n as He,O as Co,o as Ro,W as Ao,C as Eo,T as yo,D as _o,p as ze,R as To,q as Do,r as Io,s as No,t as Ke,v as jo,w as Oo,x as Mo,F as Lo,y as Fo,z as $o,A as ko,B as We,E as Vo}from"./radix-core-C3XKqQJw.js";var pe="rovingFocusGroup.onEntryFocus",Bo={bubbles:!1,cancelable:!0},J="RovingFocusGroup",[ve,Ue,Ho]=ke(J),[zo,Ge]=k(J,[Ho]),[Ko,Wo]=zo(J),Ye=i.forwardRef((e,t)=>u.jsx(ve.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(ve.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Uo,{...e,ref:t})})}));Ye.displayName=J;var Uo=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,orientation:n,loop:r=!1,dir:a,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,v=i.useRef(null),m=T(t,v),g=ne(a),[S,h]=G({prop:s,defaultProp:c??null,onChange:l,caller:J}),[b,C]=i.useState(!1),x=F(d),w=Ue(o),D=i.useRef(!1),[j,O]=i.useState(0);return i.useEffect(()=>{const y=v.current;if(y)return y.addEventListener(pe,x),()=>y.removeEventListener(pe,x)},[x]),u.jsx(Ko,{scope:o,orientation:n,dir:g,loop:r,currentTabStopId:S,onItemFocus:i.useCallback(y=>h(y),[h]),onItemShiftTab:i.useCallback(()=>C(!0),[]),onFocusableItemAdd:i.useCallback(()=>O(y=>y+1),[]),onFocusableItemRemove:i.useCallback(()=>O(y=>y-1),[]),children:u.jsx(A.div,{tabIndex:b||j===0?-1:0,"data-orientation":n,...p,ref:m,style:{outline:"none",...e.style},onMouseDown:P(e.onMouseDown,()=>{D.current=!0}),onFocus:P(e.onFocus,y=>{const E=!D.current;if(y.target===y.currentTarget&&E&&!b){const _=new CustomEvent(pe,Bo);if(y.currentTarget.dispatchEvent(_),!_.defaultPrevented){const R=w().filter(I=>I.focusable),M=R.find(I=>I.active),X=R.find(I=>I.id===S),q=[M,X,...R].filter(Boolean).map(I=>I.ref.current);Ze(q,f)}}D.current=!1}),onBlur:P(e.onBlur,()=>C(!1))})})}),Xe="RovingFocusGroupItem",qe=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,focusable:n=!0,active:r=!1,tabStopId:a,children:s,...c}=e,l=re(),d=a||l,f=Wo(Xe,o),p=f.currentTabStopId===d,v=Ue(o),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:S}=f;return i.useEffect(()=>{if(n)return m(),()=>g()},[n,m,g]),u.jsx(ve.ItemSlot,{scope:o,id:d,focusable:n,active:r,children:u.jsx(A.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...c,ref:t,onMouseDown:P(e.onMouseDown,h=>{n?f.onItemFocus(d):h.preventDefault()}),onFocus:P(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:P(e.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){f.onItemShiftTab();return}if(h.target!==h.currentTarget)return;const b=Xo(h,f.orientation,f.dir);if(b!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let x=v().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const w=x.indexOf(h.currentTarget);x=f.loop?qo(x,w+1):x.slice(w+1)}setTimeout(()=>Ze(x))}}),children:typeof s=="function"?s({isCurrentTabStop:p,hasTabStop:S!=null}):s})})});qe.displayName=Xe;var Go={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Yo(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Xo(e,t,o){const n=Yo(e.key,o);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Go[n]}function Ze(e,t=!1){const o=document.activeElement;for(const n of e)if(n===o||(n.focus({preventScroll:t}),document.activeElement!==o))return}function qo(e,t){return e.map((o,n)=>e[(t+n)%e.length])}var Zo=Ye,Jo=qe,ae="Tabs",[Qo]=k(ae,[Ge]),Je=Ge(),[er,xe]=Qo(ae),Qe=i.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,onValueChange:r,defaultValue:a,orientation:s="horizontal",dir:c,activationMode:l="automatic",...d}=e,f=ne(c),[p,v]=G({prop:n,onChange:r,defaultProp:a??"",caller:ae});return u.jsx(er,{scope:o,baseId:re(),value:p,onValueChange:v,orientation:s,dir:f,activationMode:l,children:u.jsx(A.div,{dir:f,"data-orientation":s,...d,ref:t})})});Qe.displayName=ae;var et="TabsList",tt=i.forwardRef((e,t)=>{const{__scopeTabs:o,loop:n=!0,...r}=e,a=xe(et,o),s=Je(o);return u.jsx(Zo,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:n,children:u.jsx(A.div,{role:"tablist","aria-orientation":a.orientation,...r,ref:t})})});tt.displayName=et;var ot="TabsTrigger",rt=i.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,disabled:r=!1,...a}=e,s=xe(ot,o),c=Je(o),l=st(s.baseId,n),d=it(s.baseId,n),f=n===s.value;return u.jsx(Jo,{asChild:!0,...c,focusable:!r,active:f,children:u.jsx(A.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...a,ref:t,onMouseDown:P(e.onMouseDown,p=>{!r&&p.button===0&&p.ctrlKey===!1?s.onValueChange(n):p.preventDefault()}),onKeyDown:P(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&s.onValueChange(n)}),onFocus:P(e.onFocus,()=>{const p=s.activationMode!=="manual";!f&&!r&&p&&s.onValueChange(n)})})})});rt.displayName=ot;var nt="TabsContent",at=i.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,forceMount:r,children:a,...s}=e,c=xe(nt,o),l=st(c.baseId,n),d=it(c.baseId,n),f=n===c.value,p=i.useRef(f);return i.useEffect(()=>{const v=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(v)},[]),u.jsx(V,{present:r||f,children:({present:v})=>u.jsx(A.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!v,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:v&&a})})});at.displayName=nt;function st(e,t){return`${e}-trigger-${t}`}function it(e,t){return`${e}-content-${t}`}var Fn=Qe,$n=tt,kn=rt,Vn=at;function tr(e,t){return i.useReducer((o,n)=>t[o][n]??o,e)}var we="ScrollArea",[ct]=k(we),[or,N]=ct(we),lt=i.forwardRef((e,t)=>{const{__scopeScrollArea:o,type:n="hover",dir:r,scrollHideDelay:a=600,...s}=e,[c,l]=i.useState(null),[d,f]=i.useState(null),[p,v]=i.useState(null),[m,g]=i.useState(null),[S,h]=i.useState(null),[b,C]=i.useState(0),[x,w]=i.useState(0),[D,j]=i.useState(!1),[O,y]=i.useState(!1),E=T(t,R=>l(R)),_=ne(r);return u.jsx(or,{scope:o,type:n,dir:_,scrollHideDelay:a,scrollArea:c,viewport:d,onViewportChange:f,content:p,onContentChange:v,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:D,onScrollbarXEnabledChange:j,scrollbarY:S,onScrollbarYChange:h,scrollbarYEnabled:O,onScrollbarYEnabledChange:y,onCornerWidthChange:C,onCornerHeightChange:w,children:u.jsx(A.div,{dir:_,...s,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});lt.displayName=we;var ut="ScrollAreaViewport",dt=i.forwardRef((e,t)=>{const{__scopeScrollArea:o,children:n,nonce:r,...a}=e,s=N(ut,o),c=i.useRef(null),l=T(t,c,s.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),u.jsx(A.div,{"data-radix-scroll-area-viewport":"",...a,ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});dt.displayName=ut;var L="ScrollAreaScrollbar",rr=i.forwardRef((e,t)=>{const{forceMount:o,...n}=e,r=N(L,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:s}=r,c=e.orientation==="horizontal";return i.useEffect(()=>(c?a(!0):s(!0),()=>{c?a(!1):s(!1)}),[c,a,s]),r.type==="hover"?u.jsx(nr,{...n,ref:t,forceMount:o}):r.type==="scroll"?u.jsx(ar,{...n,ref:t,forceMount:o}):r.type==="auto"?u.jsx(ft,{...n,ref:t,forceMount:o}):r.type==="always"?u.jsx(Pe,{...n,ref:t}):null});rr.displayName=L;var nr=i.forwardRef((e,t)=>{const{forceMount:o,...n}=e,r=N(L,e.__scopeScrollArea),[a,s]=i.useState(!1);return i.useEffect(()=>{const c=r.scrollArea;let l=0;if(c){const d=()=>{window.clearTimeout(l),s(!0)},f=()=>{l=window.setTimeout(()=>s(!1),r.scrollHideDelay)};return c.addEventListener("pointerenter",d),c.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",d),c.removeEventListener("pointerleave",f)}}},[r.scrollArea,r.scrollHideDelay]),u.jsx(V,{present:o||a,children:u.jsx(ft,{"data-state":a?"visible":"hidden",...n,ref:t})})}),ar=i.forwardRef((e,t)=>{const{forceMount:o,...n}=e,r=N(L,e.__scopeScrollArea),a=e.orientation==="horizontal",s=ie(()=>l("SCROLL_END"),100),[c,l]=tr("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return i.useEffect(()=>{if(c==="idle"){const d=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(d)}},[c,r.scrollHideDelay,l]),i.useEffect(()=>{const d=r.viewport,f=a?"scrollLeft":"scrollTop";if(d){let p=d[f];const v=()=>{const m=d[f];p!==m&&(l("SCROLL"),s()),p=m};return d.addEventListener("scroll",v),()=>d.removeEventListener("scroll",v)}},[r.viewport,a,l,s]),u.jsx(V,{present:o||c!=="hidden",children:u.jsx(Pe,{"data-state":c==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:P(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:P(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),ft=i.forwardRef((e,t)=>{const o=N(L,e.__scopeScrollArea),{forceMount:n,...r}=e,[a,s]=i.useState(!1),c=e.orientation==="horizontal",l=ie(()=>{if(o.viewport){const d=o.viewport.offsetWidth{const{orientation:o="vertical",...n}=e,r=N(L,e.__scopeScrollArea),a=i.useRef(null),s=i.useRef(0),[c,l]=i.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=ht(c.viewport,c.content),f={...n,sizes:c,onSizesChange:l,hasThumb:d>0&&d<1,onThumbChange:v=>a.current=v,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:v=>s.current=v};function p(v,m){return fr(v,s.current,c,m)}return o==="horizontal"?u.jsx(sr,{...f,ref:t,onThumbPositionChange:()=>{if(r.viewport&&a.current){const v=r.viewport.scrollLeft,m=Oe(v,c,r.dir);a.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:v=>{r.viewport&&(r.viewport.scrollLeft=v)},onDragScroll:v=>{r.viewport&&(r.viewport.scrollLeft=p(v,r.dir))}}):o==="vertical"?u.jsx(ir,{...f,ref:t,onThumbPositionChange:()=>{if(r.viewport&&a.current){const v=r.viewport.scrollTop,m=Oe(v,c);a.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:v=>{r.viewport&&(r.viewport.scrollTop=v)},onDragScroll:v=>{r.viewport&&(r.viewport.scrollTop=p(v))}}):null}),sr=i.forwardRef((e,t)=>{const{sizes:o,onSizesChange:n,...r}=e,a=N(L,e.__scopeScrollArea),[s,c]=i.useState(),l=i.useRef(null),d=T(t,l,a.onScrollbarXChange);return i.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(vt,{"data-orientation":"horizontal",...r,ref:d,sizes:o,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":se(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,p)=>{if(a.viewport){const v=a.viewport.scrollLeft+f.deltaX;e.onWheelScroll(v),bt(v,p)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&s&&n({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:te(s.paddingLeft),paddingEnd:te(s.paddingRight)}})}})}),ir=i.forwardRef((e,t)=>{const{sizes:o,onSizesChange:n,...r}=e,a=N(L,e.__scopeScrollArea),[s,c]=i.useState(),l=i.useRef(null),d=T(t,l,a.onScrollbarYChange);return i.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(vt,{"data-orientation":"vertical",...r,ref:d,sizes:o,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":se(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,p)=>{if(a.viewport){const v=a.viewport.scrollTop+f.deltaY;e.onWheelScroll(v),bt(v,p)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&s&&n({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:te(s.paddingTop),paddingEnd:te(s.paddingBottom)}})}})}),[cr,pt]=ct(L),vt=i.forwardRef((e,t)=>{const{__scopeScrollArea:o,sizes:n,hasThumb:r,onThumbChange:a,onThumbPointerUp:s,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:d,onWheelScroll:f,onResize:p,...v}=e,m=N(L,o),[g,S]=i.useState(null),h=T(t,E=>S(E)),b=i.useRef(null),C=i.useRef(""),x=m.viewport,w=n.content-n.viewport,D=F(f),j=F(l),O=ie(p,10);function y(E){if(b.current){const _=E.clientX-b.current.left,R=E.clientY-b.current.top;d({x:_,y:R})}}return i.useEffect(()=>{const E=_=>{const R=_.target;g?.contains(R)&&D(_,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[x,g,w,D]),i.useEffect(j,[n,j]),W(g,O),W(m.content,O),u.jsx(cr,{scope:o,scrollbar:g,hasThumb:r,onThumbChange:F(a),onThumbPointerUp:F(s),onThumbPositionChange:j,onThumbPointerDown:F(c),children:u.jsx(A.div,{...v,ref:h,style:{position:"absolute",...v.style},onPointerDown:P(e.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),b.current=g.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),y(E))}),onPointerMove:P(e.onPointerMove,y),onPointerUp:P(e.onPointerUp,E=>{const _=E.target;_.hasPointerCapture(E.pointerId)&&_.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=C.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),ee="ScrollAreaThumb",lr=i.forwardRef((e,t)=>{const{forceMount:o,...n}=e,r=pt(ee,e.__scopeScrollArea);return u.jsx(V,{present:o||r.hasThumb,children:u.jsx(ur,{ref:t,...n})})}),ur=i.forwardRef((e,t)=>{const{__scopeScrollArea:o,style:n,...r}=e,a=N(ee,o),s=pt(ee,o),{onThumbPositionChange:c}=s,l=T(t,p=>s.onThumbChange(p)),d=i.useRef(void 0),f=ie(()=>{d.current&&(d.current(),d.current=void 0)},100);return i.useEffect(()=>{const p=a.viewport;if(p){const v=()=>{if(f(),!d.current){const m=pr(p,c);d.current=m,c()}};return c(),p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[a.viewport,f,c]),u.jsx(A.div,{"data-state":s.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:P(e.onPointerDownCapture,p=>{const m=p.target.getBoundingClientRect(),g=p.clientX-m.left,S=p.clientY-m.top;s.onThumbPointerDown({x:g,y:S})}),onPointerUp:P(e.onPointerUp,s.onThumbPointerUp)})});lr.displayName=ee;var Ce="ScrollAreaCorner",mt=i.forwardRef((e,t)=>{const o=N(Ce,e.__scopeScrollArea),n=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&n?u.jsx(dr,{...e,ref:t}):null});mt.displayName=Ce;var dr=i.forwardRef((e,t)=>{const{__scopeScrollArea:o,...n}=e,r=N(Ce,o),[a,s]=i.useState(0),[c,l]=i.useState(0),d=!!(a&&c);return W(r.scrollbarX,()=>{const f=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(f),l(f)}),W(r.scrollbarY,()=>{const f=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(f),s(f)}),d?u.jsx(A.div,{...n,ref:t,style:{width:a,height:c,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function te(e){return e?parseInt(e,10):0}function ht(e,t){const o=e/t;return isNaN(o)?0:o}function se(e){const t=ht(e.viewport,e.content),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-o)*t;return Math.max(n,18)}function fr(e,t,o,n="ltr"){const r=se(o),a=r/2,s=t||a,c=r-s,l=o.scrollbar.paddingStart+s,d=o.scrollbar.size-o.scrollbar.paddingEnd-c,f=o.content-o.viewport,p=n==="ltr"?[0,f]:[f*-1,0];return gt([l,d],p)(e)}function Oe(e,t,o="ltr"){const n=se(t),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-r,s=t.content-t.viewport,c=a-n,l=o==="ltr"?[0,s]:[s*-1,0],d=be(e,l);return gt([0,s],[0,c])(d)}function gt(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(o-e[0])}}function bt(e,t){return e>0&&e{})=>{let o={left:e.scrollLeft,top:e.scrollTop},n=0;return(function r(){const a={left:e.scrollLeft,top:e.scrollTop},s=o.left!==a.left,c=o.top!==a.top;(s||c)&&t(),o=a,n=window.requestAnimationFrame(r)})(),()=>window.cancelAnimationFrame(n)};function ie(e,t){const o=F(e),n=i.useRef(0);return i.useEffect(()=>()=>window.clearTimeout(n.current),[]),i.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(o,t)},[o,t])}function W(e,t){const o=F(t);Z(()=>{let n=0;if(e){const r=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(o)});return r.observe(e),()=>{window.cancelAnimationFrame(n),r.unobserve(e)}}},[e,o])}var Bn=lt,Hn=dt,zn=mt;function vr(e,t=[]){let o=[];function n(a,s){const c=i.createContext(s);c.displayName=a+"Context";const l=o.length;o=[...o,s];const d=p=>{const{scope:v,children:m,...g}=p,S=v?.[e]?.[l]||c,h=i.useMemo(()=>g,Object.values(g));return u.jsx(S.Provider,{value:h,children:m})};d.displayName=a+"Provider";function f(p,v){const m=v?.[e]?.[l]||c,g=i.useContext(m);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[d,f]}const r=()=>{const a=o.map(s=>i.createContext(s));return function(c){const l=c?.[e]||a;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return r.scopeName=e,[n,mr(r,...t)]}function mr(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const n=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(a){const s=n.reduce((c,{useScope:l,scopeName:d})=>{const p=l(a)[`__scope${d}`];return{...c,...p}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return o.scopeName=t.scopeName,o}var hr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],St=hr.reduce((e,t)=>{const o=Se(`Primitive.${t}`),n=i.forwardRef((r,a)=>{const{asChild:s,...c}=r,l=s?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(l,{...c,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Re="Progress",Ae=100,[gr]=vr(Re),[br,Sr]=gr(Re),xt=i.forwardRef((e,t)=>{const{__scopeProgress:o,value:n=null,max:r,getValueLabel:a=xr,...s}=e;(r||r===0)&&!Me(r)&&console.error(wr(`${r}`,"Progress"));const c=Me(r)?r:Ae;n!==null&&!Le(n,c)&&console.error(Pr(`${n}`,"Progress"));const l=Le(n,c)?n:null,d=oe(l)?a(l,c):void 0;return u.jsx(br,{scope:o,value:l,max:c,children:u.jsx(St.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":oe(l)?l:void 0,"aria-valuetext":d,role:"progressbar","data-state":Ct(l,c),"data-value":l??void 0,"data-max":c,...s,ref:t})})});xt.displayName=Re;var wt="ProgressIndicator",Pt=i.forwardRef((e,t)=>{const{__scopeProgress:o,...n}=e,r=Sr(wt,o);return u.jsx(St.div,{"data-state":Ct(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...n,ref:t})});Pt.displayName=wt;function xr(e,t){return`${Math.round(e/t*100)}%`}function Ct(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function oe(e){return typeof e=="number"}function Me(e){return oe(e)&&!isNaN(e)&&e>0}function Le(e,t){return oe(e)&&!isNaN(e)&&e<=t&&e>=0}function wr(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ae}\`.`}function Pr(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: +import{r as i,j as u,d as Po}from"./router-Bz250laD.js";import{c as k,a as ke,u as re,P as A,b as P,d as T,e as ne,f as G,g as F,h as V,i as Z,j as be,k as Se,l as Ve,m as Be,n as He,O as Co,o as Ro,W as Ao,C as Eo,T as yo,D as _o,p as ze,R as To,q as Do,r as Io,s as No,t as Ke,v as jo,w as Oo,x as Mo,F as Lo,y as Fo,z as $o,A as ko,B as We,E as Vo}from"./radix-core-9dEfQl-6.js";var pe="rovingFocusGroup.onEntryFocus",Bo={bubbles:!1,cancelable:!0},J="RovingFocusGroup",[ve,Ue,Ho]=ke(J),[zo,Ge]=k(J,[Ho]),[Ko,Wo]=zo(J),Ye=i.forwardRef((e,t)=>u.jsx(ve.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(ve.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Uo,{...e,ref:t})})}));Ye.displayName=J;var Uo=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,orientation:n,loop:r=!1,dir:a,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,v=i.useRef(null),m=T(t,v),g=ne(a),[S,h]=G({prop:s,defaultProp:c??null,onChange:l,caller:J}),[b,C]=i.useState(!1),x=F(d),w=Ue(o),D=i.useRef(!1),[j,O]=i.useState(0);return i.useEffect(()=>{const y=v.current;if(y)return y.addEventListener(pe,x),()=>y.removeEventListener(pe,x)},[x]),u.jsx(Ko,{scope:o,orientation:n,dir:g,loop:r,currentTabStopId:S,onItemFocus:i.useCallback(y=>h(y),[h]),onItemShiftTab:i.useCallback(()=>C(!0),[]),onFocusableItemAdd:i.useCallback(()=>O(y=>y+1),[]),onFocusableItemRemove:i.useCallback(()=>O(y=>y-1),[]),children:u.jsx(A.div,{tabIndex:b||j===0?-1:0,"data-orientation":n,...p,ref:m,style:{outline:"none",...e.style},onMouseDown:P(e.onMouseDown,()=>{D.current=!0}),onFocus:P(e.onFocus,y=>{const E=!D.current;if(y.target===y.currentTarget&&E&&!b){const _=new CustomEvent(pe,Bo);if(y.currentTarget.dispatchEvent(_),!_.defaultPrevented){const R=w().filter(I=>I.focusable),M=R.find(I=>I.active),X=R.find(I=>I.id===S),q=[M,X,...R].filter(Boolean).map(I=>I.ref.current);Ze(q,f)}}D.current=!1}),onBlur:P(e.onBlur,()=>C(!1))})})}),Xe="RovingFocusGroupItem",qe=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,focusable:n=!0,active:r=!1,tabStopId:a,children:s,...c}=e,l=re(),d=a||l,f=Wo(Xe,o),p=f.currentTabStopId===d,v=Ue(o),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:S}=f;return i.useEffect(()=>{if(n)return m(),()=>g()},[n,m,g]),u.jsx(ve.ItemSlot,{scope:o,id:d,focusable:n,active:r,children:u.jsx(A.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...c,ref:t,onMouseDown:P(e.onMouseDown,h=>{n?f.onItemFocus(d):h.preventDefault()}),onFocus:P(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:P(e.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){f.onItemShiftTab();return}if(h.target!==h.currentTarget)return;const b=Xo(h,f.orientation,f.dir);if(b!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let x=v().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const w=x.indexOf(h.currentTarget);x=f.loop?qo(x,w+1):x.slice(w+1)}setTimeout(()=>Ze(x))}}),children:typeof s=="function"?s({isCurrentTabStop:p,hasTabStop:S!=null}):s})})});qe.displayName=Xe;var Go={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Yo(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Xo(e,t,o){const n=Yo(e.key,o);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Go[n]}function Ze(e,t=!1){const o=document.activeElement;for(const n of e)if(n===o||(n.focus({preventScroll:t}),document.activeElement!==o))return}function qo(e,t){return e.map((o,n)=>e[(t+n)%e.length])}var Zo=Ye,Jo=qe,ae="Tabs",[Qo]=k(ae,[Ge]),Je=Ge(),[er,xe]=Qo(ae),Qe=i.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,onValueChange:r,defaultValue:a,orientation:s="horizontal",dir:c,activationMode:l="automatic",...d}=e,f=ne(c),[p,v]=G({prop:n,onChange:r,defaultProp:a??"",caller:ae});return u.jsx(er,{scope:o,baseId:re(),value:p,onValueChange:v,orientation:s,dir:f,activationMode:l,children:u.jsx(A.div,{dir:f,"data-orientation":s,...d,ref:t})})});Qe.displayName=ae;var et="TabsList",tt=i.forwardRef((e,t)=>{const{__scopeTabs:o,loop:n=!0,...r}=e,a=xe(et,o),s=Je(o);return u.jsx(Zo,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:n,children:u.jsx(A.div,{role:"tablist","aria-orientation":a.orientation,...r,ref:t})})});tt.displayName=et;var ot="TabsTrigger",rt=i.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,disabled:r=!1,...a}=e,s=xe(ot,o),c=Je(o),l=st(s.baseId,n),d=it(s.baseId,n),f=n===s.value;return u.jsx(Jo,{asChild:!0,...c,focusable:!r,active:f,children:u.jsx(A.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...a,ref:t,onMouseDown:P(e.onMouseDown,p=>{!r&&p.button===0&&p.ctrlKey===!1?s.onValueChange(n):p.preventDefault()}),onKeyDown:P(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&s.onValueChange(n)}),onFocus:P(e.onFocus,()=>{const p=s.activationMode!=="manual";!f&&!r&&p&&s.onValueChange(n)})})})});rt.displayName=ot;var nt="TabsContent",at=i.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,forceMount:r,children:a,...s}=e,c=xe(nt,o),l=st(c.baseId,n),d=it(c.baseId,n),f=n===c.value,p=i.useRef(f);return i.useEffect(()=>{const v=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(v)},[]),u.jsx(V,{present:r||f,children:({present:v})=>u.jsx(A.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!v,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:v&&a})})});at.displayName=nt;function st(e,t){return`${e}-trigger-${t}`}function it(e,t){return`${e}-content-${t}`}var Fn=Qe,$n=tt,kn=rt,Vn=at;function tr(e,t){return i.useReducer((o,n)=>t[o][n]??o,e)}var we="ScrollArea",[ct]=k(we),[or,N]=ct(we),lt=i.forwardRef((e,t)=>{const{__scopeScrollArea:o,type:n="hover",dir:r,scrollHideDelay:a=600,...s}=e,[c,l]=i.useState(null),[d,f]=i.useState(null),[p,v]=i.useState(null),[m,g]=i.useState(null),[S,h]=i.useState(null),[b,C]=i.useState(0),[x,w]=i.useState(0),[D,j]=i.useState(!1),[O,y]=i.useState(!1),E=T(t,R=>l(R)),_=ne(r);return u.jsx(or,{scope:o,type:n,dir:_,scrollHideDelay:a,scrollArea:c,viewport:d,onViewportChange:f,content:p,onContentChange:v,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:D,onScrollbarXEnabledChange:j,scrollbarY:S,onScrollbarYChange:h,scrollbarYEnabled:O,onScrollbarYEnabledChange:y,onCornerWidthChange:C,onCornerHeightChange:w,children:u.jsx(A.div,{dir:_,...s,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});lt.displayName=we;var ut="ScrollAreaViewport",dt=i.forwardRef((e,t)=>{const{__scopeScrollArea:o,children:n,nonce:r,...a}=e,s=N(ut,o),c=i.useRef(null),l=T(t,c,s.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),u.jsx(A.div,{"data-radix-scroll-area-viewport":"",...a,ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});dt.displayName=ut;var L="ScrollAreaScrollbar",rr=i.forwardRef((e,t)=>{const{forceMount:o,...n}=e,r=N(L,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:s}=r,c=e.orientation==="horizontal";return i.useEffect(()=>(c?a(!0):s(!0),()=>{c?a(!1):s(!1)}),[c,a,s]),r.type==="hover"?u.jsx(nr,{...n,ref:t,forceMount:o}):r.type==="scroll"?u.jsx(ar,{...n,ref:t,forceMount:o}):r.type==="auto"?u.jsx(ft,{...n,ref:t,forceMount:o}):r.type==="always"?u.jsx(Pe,{...n,ref:t}):null});rr.displayName=L;var nr=i.forwardRef((e,t)=>{const{forceMount:o,...n}=e,r=N(L,e.__scopeScrollArea),[a,s]=i.useState(!1);return i.useEffect(()=>{const c=r.scrollArea;let l=0;if(c){const d=()=>{window.clearTimeout(l),s(!0)},f=()=>{l=window.setTimeout(()=>s(!1),r.scrollHideDelay)};return c.addEventListener("pointerenter",d),c.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",d),c.removeEventListener("pointerleave",f)}}},[r.scrollArea,r.scrollHideDelay]),u.jsx(V,{present:o||a,children:u.jsx(ft,{"data-state":a?"visible":"hidden",...n,ref:t})})}),ar=i.forwardRef((e,t)=>{const{forceMount:o,...n}=e,r=N(L,e.__scopeScrollArea),a=e.orientation==="horizontal",s=ie(()=>l("SCROLL_END"),100),[c,l]=tr("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return i.useEffect(()=>{if(c==="idle"){const d=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(d)}},[c,r.scrollHideDelay,l]),i.useEffect(()=>{const d=r.viewport,f=a?"scrollLeft":"scrollTop";if(d){let p=d[f];const v=()=>{const m=d[f];p!==m&&(l("SCROLL"),s()),p=m};return d.addEventListener("scroll",v),()=>d.removeEventListener("scroll",v)}},[r.viewport,a,l,s]),u.jsx(V,{present:o||c!=="hidden",children:u.jsx(Pe,{"data-state":c==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:P(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:P(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),ft=i.forwardRef((e,t)=>{const o=N(L,e.__scopeScrollArea),{forceMount:n,...r}=e,[a,s]=i.useState(!1),c=e.orientation==="horizontal",l=ie(()=>{if(o.viewport){const d=o.viewport.offsetWidth{const{orientation:o="vertical",...n}=e,r=N(L,e.__scopeScrollArea),a=i.useRef(null),s=i.useRef(0),[c,l]=i.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=ht(c.viewport,c.content),f={...n,sizes:c,onSizesChange:l,hasThumb:d>0&&d<1,onThumbChange:v=>a.current=v,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:v=>s.current=v};function p(v,m){return fr(v,s.current,c,m)}return o==="horizontal"?u.jsx(sr,{...f,ref:t,onThumbPositionChange:()=>{if(r.viewport&&a.current){const v=r.viewport.scrollLeft,m=Oe(v,c,r.dir);a.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:v=>{r.viewport&&(r.viewport.scrollLeft=v)},onDragScroll:v=>{r.viewport&&(r.viewport.scrollLeft=p(v,r.dir))}}):o==="vertical"?u.jsx(ir,{...f,ref:t,onThumbPositionChange:()=>{if(r.viewport&&a.current){const v=r.viewport.scrollTop,m=Oe(v,c);a.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:v=>{r.viewport&&(r.viewport.scrollTop=v)},onDragScroll:v=>{r.viewport&&(r.viewport.scrollTop=p(v))}}):null}),sr=i.forwardRef((e,t)=>{const{sizes:o,onSizesChange:n,...r}=e,a=N(L,e.__scopeScrollArea),[s,c]=i.useState(),l=i.useRef(null),d=T(t,l,a.onScrollbarXChange);return i.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(vt,{"data-orientation":"horizontal",...r,ref:d,sizes:o,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":se(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,p)=>{if(a.viewport){const v=a.viewport.scrollLeft+f.deltaX;e.onWheelScroll(v),bt(v,p)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&s&&n({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:te(s.paddingLeft),paddingEnd:te(s.paddingRight)}})}})}),ir=i.forwardRef((e,t)=>{const{sizes:o,onSizesChange:n,...r}=e,a=N(L,e.__scopeScrollArea),[s,c]=i.useState(),l=i.useRef(null),d=T(t,l,a.onScrollbarYChange);return i.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(vt,{"data-orientation":"vertical",...r,ref:d,sizes:o,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":se(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,p)=>{if(a.viewport){const v=a.viewport.scrollTop+f.deltaY;e.onWheelScroll(v),bt(v,p)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&s&&n({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:te(s.paddingTop),paddingEnd:te(s.paddingBottom)}})}})}),[cr,pt]=ct(L),vt=i.forwardRef((e,t)=>{const{__scopeScrollArea:o,sizes:n,hasThumb:r,onThumbChange:a,onThumbPointerUp:s,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:d,onWheelScroll:f,onResize:p,...v}=e,m=N(L,o),[g,S]=i.useState(null),h=T(t,E=>S(E)),b=i.useRef(null),C=i.useRef(""),x=m.viewport,w=n.content-n.viewport,D=F(f),j=F(l),O=ie(p,10);function y(E){if(b.current){const _=E.clientX-b.current.left,R=E.clientY-b.current.top;d({x:_,y:R})}}return i.useEffect(()=>{const E=_=>{const R=_.target;g?.contains(R)&&D(_,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[x,g,w,D]),i.useEffect(j,[n,j]),W(g,O),W(m.content,O),u.jsx(cr,{scope:o,scrollbar:g,hasThumb:r,onThumbChange:F(a),onThumbPointerUp:F(s),onThumbPositionChange:j,onThumbPointerDown:F(c),children:u.jsx(A.div,{...v,ref:h,style:{position:"absolute",...v.style},onPointerDown:P(e.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),b.current=g.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),y(E))}),onPointerMove:P(e.onPointerMove,y),onPointerUp:P(e.onPointerUp,E=>{const _=E.target;_.hasPointerCapture(E.pointerId)&&_.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=C.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),ee="ScrollAreaThumb",lr=i.forwardRef((e,t)=>{const{forceMount:o,...n}=e,r=pt(ee,e.__scopeScrollArea);return u.jsx(V,{present:o||r.hasThumb,children:u.jsx(ur,{ref:t,...n})})}),ur=i.forwardRef((e,t)=>{const{__scopeScrollArea:o,style:n,...r}=e,a=N(ee,o),s=pt(ee,o),{onThumbPositionChange:c}=s,l=T(t,p=>s.onThumbChange(p)),d=i.useRef(void 0),f=ie(()=>{d.current&&(d.current(),d.current=void 0)},100);return i.useEffect(()=>{const p=a.viewport;if(p){const v=()=>{if(f(),!d.current){const m=pr(p,c);d.current=m,c()}};return c(),p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[a.viewport,f,c]),u.jsx(A.div,{"data-state":s.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:P(e.onPointerDownCapture,p=>{const m=p.target.getBoundingClientRect(),g=p.clientX-m.left,S=p.clientY-m.top;s.onThumbPointerDown({x:g,y:S})}),onPointerUp:P(e.onPointerUp,s.onThumbPointerUp)})});lr.displayName=ee;var Ce="ScrollAreaCorner",mt=i.forwardRef((e,t)=>{const o=N(Ce,e.__scopeScrollArea),n=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&n?u.jsx(dr,{...e,ref:t}):null});mt.displayName=Ce;var dr=i.forwardRef((e,t)=>{const{__scopeScrollArea:o,...n}=e,r=N(Ce,o),[a,s]=i.useState(0),[c,l]=i.useState(0),d=!!(a&&c);return W(r.scrollbarX,()=>{const f=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(f),l(f)}),W(r.scrollbarY,()=>{const f=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(f),s(f)}),d?u.jsx(A.div,{...n,ref:t,style:{width:a,height:c,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function te(e){return e?parseInt(e,10):0}function ht(e,t){const o=e/t;return isNaN(o)?0:o}function se(e){const t=ht(e.viewport,e.content),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-o)*t;return Math.max(n,18)}function fr(e,t,o,n="ltr"){const r=se(o),a=r/2,s=t||a,c=r-s,l=o.scrollbar.paddingStart+s,d=o.scrollbar.size-o.scrollbar.paddingEnd-c,f=o.content-o.viewport,p=n==="ltr"?[0,f]:[f*-1,0];return gt([l,d],p)(e)}function Oe(e,t,o="ltr"){const n=se(t),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-r,s=t.content-t.viewport,c=a-n,l=o==="ltr"?[0,s]:[s*-1,0],d=be(e,l);return gt([0,s],[0,c])(d)}function gt(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(o-e[0])}}function bt(e,t){return e>0&&e{})=>{let o={left:e.scrollLeft,top:e.scrollTop},n=0;return(function r(){const a={left:e.scrollLeft,top:e.scrollTop},s=o.left!==a.left,c=o.top!==a.top;(s||c)&&t(),o=a,n=window.requestAnimationFrame(r)})(),()=>window.cancelAnimationFrame(n)};function ie(e,t){const o=F(e),n=i.useRef(0);return i.useEffect(()=>()=>window.clearTimeout(n.current),[]),i.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(o,t)},[o,t])}function W(e,t){const o=F(t);Z(()=>{let n=0;if(e){const r=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(o)});return r.observe(e),()=>{window.cancelAnimationFrame(n),r.unobserve(e)}}},[e,o])}var Bn=lt,Hn=dt,zn=mt;function vr(e,t=[]){let o=[];function n(a,s){const c=i.createContext(s);c.displayName=a+"Context";const l=o.length;o=[...o,s];const d=p=>{const{scope:v,children:m,...g}=p,S=v?.[e]?.[l]||c,h=i.useMemo(()=>g,Object.values(g));return u.jsx(S.Provider,{value:h,children:m})};d.displayName=a+"Provider";function f(p,v){const m=v?.[e]?.[l]||c,g=i.useContext(m);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[d,f]}const r=()=>{const a=o.map(s=>i.createContext(s));return function(c){const l=c?.[e]||a;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return r.scopeName=e,[n,mr(r,...t)]}function mr(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const n=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(a){const s=n.reduce((c,{useScope:l,scopeName:d})=>{const p=l(a)[`__scope${d}`];return{...c,...p}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return o.scopeName=t.scopeName,o}var hr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],St=hr.reduce((e,t)=>{const o=Se(`Primitive.${t}`),n=i.forwardRef((r,a)=>{const{asChild:s,...c}=r,l=s?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(l,{...c,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Re="Progress",Ae=100,[gr]=vr(Re),[br,Sr]=gr(Re),xt=i.forwardRef((e,t)=>{const{__scopeProgress:o,value:n=null,max:r,getValueLabel:a=xr,...s}=e;(r||r===0)&&!Me(r)&&console.error(wr(`${r}`,"Progress"));const c=Me(r)?r:Ae;n!==null&&!Le(n,c)&&console.error(Pr(`${n}`,"Progress"));const l=Le(n,c)?n:null,d=oe(l)?a(l,c):void 0;return u.jsx(br,{scope:o,value:l,max:c,children:u.jsx(St.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":oe(l)?l:void 0,"aria-valuetext":d,role:"progressbar","data-state":Ct(l,c),"data-value":l??void 0,"data-max":c,...s,ref:t})})});xt.displayName=Re;var wt="ProgressIndicator",Pt=i.forwardRef((e,t)=>{const{__scopeProgress:o,...n}=e,r=Sr(wt,o);return u.jsx(St.div,{"data-state":Ct(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...n,ref:t})});Pt.displayName=wt;function xr(e,t){return`${Math.round(e/t*100)}%`}function Ct(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function oe(e){return typeof e=="number"}function Me(e){return oe(e)&&!isNaN(e)&&e>0}function Le(e,t){return oe(e)&&!isNaN(e)&&e<=t&&e>=0}function wr(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ae}\`.`}function Pr(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${Ae} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. diff --git a/webui/dist/assets/react-vendor-Dtc2IqVY.js b/webui/dist/assets/react-vendor-BmxF9s7Q.js similarity index 98% rename from webui/dist/assets/react-vendor-Dtc2IqVY.js rename to webui/dist/assets/react-vendor-BmxF9s7Q.js index 087b3f14..97721520 100644 --- a/webui/dist/assets/react-vendor-Dtc2IqVY.js +++ b/webui/dist/assets/react-vendor-BmxF9s7Q.js @@ -1 +1 @@ -var ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ae(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}var $={exports:{}},P={};var W;function oe(){if(W)return P;W=1;var _=Symbol.for("react.transitional.element"),O=Symbol.for("react.fragment");function v(y,E,g){var R=null;if(g!==void 0&&(R=""+g),E.key!==void 0&&(R=""+E.key),"key"in E){g={};for(var m in E)m!=="key"&&(g[m]=E[m])}else g=E;return E=g.ref,{$$typeof:_,type:y,key:R,ref:E!==void 0?E:null,props:g}}return P.Fragment=O,P.jsx=v,P.jsxs=v,P}var X;function le(){return X||(X=1,$.exports=oe()),$.exports}var k={exports:{}},n={};var F;function ie(){if(F)return n;F=1;var _=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),R=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),t=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),h=Symbol.iterator;function w(e){return e===null||typeof e!="object"?null:(e=h&&e[h]||e["@@iterator"],typeof e=="function"?e:null)}var Y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U=Object.assign,q={};function C(e,r,o){this.props=e,this.context=r,this.refs=q,this.updater=o||Y}C.prototype.isReactComponent={},C.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,r,"setState")},C.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function b(){}b.prototype=C.prototype;function N(e,r,o){this.props=e,this.context=r,this.refs=q,this.updater=o||Y}var j=N.prototype=new b;j.constructor=N,U(j,C.prototype),j.isPureReactComponent=!0;var G=Array.isArray;function D(){}var a={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function L(e,r,o){var u=o.ref;return{$$typeof:_,type:e,key:r,ref:u!==void 0?u:null,props:o}}function V(e,r){return L(e.type,r,e.props)}function x(e){return typeof e=="object"&&e!==null&&e.$$typeof===_}function ee(e){var r={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(o){return r[o]})}var B=/\/+/g;function M(e,r){return typeof e=="object"&&e!==null&&e.key!=null?ee(""+e.key):r.toString(36)}function te(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(D,D):(e.status="pending",e.then(function(r){e.status==="pending"&&(e.status="fulfilled",e.value=r)},function(r){e.status==="pending"&&(e.status="rejected",e.reason=r)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function A(e,r,o,u,s){var f=typeof e;(f==="undefined"||f==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(f){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case _:case O:l=!0;break;case c:return l=e._init,A(l(e._payload),r,o,u,s)}}if(l)return s=s(e),l=u===""?"."+M(e,0):u,G(s)?(o="",l!=null&&(o=l.replace(B,"$&/")+"/"),A(s,r,o,"",function(ue){return ue})):s!=null&&(x(s)&&(s=V(s,o+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(B,"$&/")+"/")+l)),r.push(s)),1;l=0;var T=u===""?".":u+":";if(G(e))for(var d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_)}catch(O){console.error(O)}}return _(),I.exports=fe(),I.exports}export{se as a,ye as b,ce as c,ae as g,le as r}; +var ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ae(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}var $={exports:{}},P={};var W;function oe(){if(W)return P;W=1;var _=Symbol.for("react.transitional.element"),O=Symbol.for("react.fragment");function v(y,E,g){var R=null;if(g!==void 0&&(R=""+g),E.key!==void 0&&(R=""+E.key),"key"in E){g={};for(var m in E)m!=="key"&&(g[m]=E[m])}else g=E;return E=g.ref,{$$typeof:_,type:y,key:R,ref:E!==void 0?E:null,props:g}}return P.Fragment=O,P.jsx=v,P.jsxs=v,P}var X;function le(){return X||(X=1,$.exports=oe()),$.exports}var k={exports:{}},n={};var F;function ie(){if(F)return n;F=1;var _=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),R=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),t=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),h=Symbol.iterator;function w(e){return e===null||typeof e!="object"?null:(e=h&&e[h]||e["@@iterator"],typeof e=="function"?e:null)}var Y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U=Object.assign,q={};function C(e,r,o){this.props=e,this.context=r,this.refs=q,this.updater=o||Y}C.prototype.isReactComponent={},C.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,r,"setState")},C.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function b(){}b.prototype=C.prototype;function N(e,r,o){this.props=e,this.context=r,this.refs=q,this.updater=o||Y}var j=N.prototype=new b;j.constructor=N,U(j,C.prototype),j.isPureReactComponent=!0;var G=Array.isArray;function D(){}var a={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function L(e,r,o){var u=o.ref;return{$$typeof:_,type:e,key:r,ref:u!==void 0?u:null,props:o}}function V(e,r){return L(e.type,r,e.props)}function x(e){return typeof e=="object"&&e!==null&&e.$$typeof===_}function ee(e){var r={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(o){return r[o]})}var B=/\/+/g;function M(e,r){return typeof e=="object"&&e!==null&&e.key!=null?ee(""+e.key):r.toString(36)}function te(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(D,D):(e.status="pending",e.then(function(r){e.status==="pending"&&(e.status="fulfilled",e.value=r)},function(r){e.status==="pending"&&(e.status="rejected",e.reason=r)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function A(e,r,o,u,s){var f=typeof e;(f==="undefined"||f==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(f){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case _:case O:l=!0;break;case c:return l=e._init,A(l(e._payload),r,o,u,s)}}if(l)return s=s(e),l=u===""?"."+M(e,0):u,G(s)?(o="",l!=null&&(o=l.replace(B,"$&/")+"/"),A(s,r,o,"",function(ue){return ue})):s!=null&&(x(s)&&(s=V(s,o+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(B,"$&/")+"/")+l)),r.push(s)),1;l=0;var T=u===""?".":u+":";if(G(e))for(var d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_)}catch(O){console.error(O)}}return _(),I.exports=fe(),I.exports}export{se as a,ye as b,ce as c,ae as g,le as r}; diff --git a/webui/dist/assets/reactflow-B3n3_Vkw.js b/webui/dist/assets/reactflow-B3n3_Vkw.js deleted file mode 100644 index d4b54604..00000000 --- a/webui/dist/assets/reactflow-B3n3_Vkw.js +++ /dev/null @@ -1,2 +0,0 @@ -import{u as Rc,R as P,r as T}from"./router-CWhjJi2n.js";import{i as Ac,b as Oo,c as Mc,d as Fo,e as Ic,f as qc,g as Tc,r as ea,h as Pc,j as co,k as ta,l as We,m as lo,n as Dc,o as zc,p as na,q as ra,s as oa,t as fo,u as ho,v as po,w as Lc,x as $c,y as Oc,z as Fc,A as Hc,B as Vc,C as Bc,D as go,E as Wt,F as Gc,G as Uc,H as mo,I as Yc,J as Wc,K as ia,L as sa,M as aa,N as ua,O as Zt,P as ca,Q as la,R as Zc,S as Xc,T as Kc,U as jc,V as Qc,W as Jc,X as el,Y as tl,Z as da,$ as fa,a0 as nl,a1 as rl,a2 as ol,a3 as il,a4 as sl,a5 as al,a6 as ul,a7 as cl,a8 as ll,a9 as dl,aa as fl,ab as hl,ac as pl,ad as gl,ae as ml,af as vl}from"./charts-Dhri-zxi.js";function ce(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(_=>_(t,h))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(yl?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(r,o,c);return c},wl=e=>e?Ho(e):Ho,{useDebugValue:_l}=P,{useSyncExternalStoreWithSelector:El}=Rc,bl=e=>e;function ha(e,t=bl,n){const r=El(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return _l(r),r}const Vo=(e,t)=>{const n=wl(e),r=(o,i=t)=>ha(n,o,i);return Object.assign(r,n),r},xl=(e,t)=>e?Vo(e,t):Vo;function ue(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Sl={value:()=>{}};function Xt(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Pt.prototype=Xt.prototype={constructor:Pt,on:function(e,t){var n=this._,r=Nl(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(o),r=0,o,i;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Go.hasOwnProperty(t)?{space:Go[t],local:e}:e}function kl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Kr&&t.documentElement.namespaceURI===Kr?t.createElement(e):t.createElementNS(n,e)}}function Rl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pa(e){var t=Kt(e);return(t.local?Rl:kl)(t)}function Al(){}function vo(e){return e==null?Al:function(){return this.querySelector(e)}}function Ml(e){typeof e!="function"&&(e=vo(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o=E&&(E=y+1);!(b=g[E])&&++E<_;);v._next=b||null}}return s=new pe(s,r),s._enter=a,s._exit=c,s}function Kl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function jl(){return new pe(this._exit||this._groups.map(ya),this._parents)}function Ql(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Jl(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function td(e){e||(e=nd);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;it?1:e>=t?0:NaN}function rd(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function od(){return Array.from(this)}function id(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?md:typeof t=="function"?yd:vd)(e,t,n??"")):at(this.node(),e)}function at(e,t){return e.style.getPropertyValue(t)||wa(e).getComputedStyle(e,null).getPropertyValue(t)}function _d(e){return function(){delete this[e]}}function Ed(e,t){return function(){this[e]=t}}function bd(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function xd(e,t){return arguments.length>1?this.each((t==null?_d:typeof t=="function"?bd:Ed)(e,t)):this.node()[e]}function _a(e){return e.trim().split(/^|\s+/)}function yo(e){return e.classList||new Ea(e)}function Ea(e){this._node=e,this._names=_a(e.getAttribute("class")||"")}Ea.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ba(e,t){for(var n=yo(e),r=-1,o=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function jd(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n()=>e;function jr(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}jr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function uf(e){return!e.ctrlKey&&!e.button}function cf(){return this.parentNode}function lf(e,t){return t??{x:e.x,y:e.y}}function df(){return navigator.maxTouchPoints||"ontouchstart"in this}function ff(){var e=uf,t=cf,n=lf,r=df,o={},i=Xt("start","drag","end"),s=0,a,c,l,u,d=0;function f(v){v.on("mousedown.drag",h).filter(r).on("touchstart.drag",g).on("touchmove.drag",p,af).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(v,b){if(!(u||!e.call(this,v,b))){var x=E(this,t.call(this,v,b),v,b,"mouse");x&&(ge(v.view).on("mousemove.drag",_,Et).on("mouseup.drag",m,Et),Ca(v.view),an(v),l=!1,a=v.clientX,c=v.clientY,x("start",v))}}function _(v){if(it(v),!l){var b=v.clientX-a,x=v.clientY-c;l=b*b+x*x>d}o.mouse("drag",v)}function m(v){ge(v.view).on("mousemove.drag mouseup.drag",null),ka(v.view,l),it(v),o.mouse("end",v)}function g(v,b){if(e.call(this,v,b)){var x=v.changedTouches,C=t.call(this,v,b),q=x.length,k,A;for(k=0;k=0&&e._call.call(void 0,t),e=e._next;--ut}function Uo(){Ue=(Ft=bt.now())+jt,ut=yt=0;try{pf()}finally{ut=0,mf(),Ue=0}}function gf(){var e=bt.now(),t=e-Ft;t>Ra&&(jt-=t,Ft=e)}function mf(){for(var e,t=Ot,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ot=n);wt=e,Qr(r)}function Qr(e){if(!ut){yt&&(yt=clearTimeout(yt));var t=e-Ue;t>24?(e<1/0&&(yt=setTimeout(Uo,e-bt.now()-jt)),ht&&(ht=clearInterval(ht))):(ht||(Ft=bt.now(),ht=setInterval(gf,Ra)),ut=1,Aa(Uo))}}function Yo(e,t,n){var r=new Ht;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var vf=Xt("start","end","cancel","interrupt"),yf=[],Ia=0,Wo=1,Jr=2,Dt=3,Zo=4,eo=5,zt=6;function Qt(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;wf(e,n,{name:t,index:r,group:o,on:vf,tween:yf,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Ia})}function _o(e,t){var n=Ee(e,t);if(n.state>Ia)throw new Error("too late; already scheduled");return n}function Se(e,t){var n=Ee(e,t);if(n.state>Dt)throw new Error("too late; already running");return n}function Ee(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function wf(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=Ma(i,0,n.time);function i(l){n.state=Wo,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Wo)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Dt)return Yo(s);h.state===Zo?(h.state=zt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+uJr&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Xf(e,t,n){var r,o,i=Zf(t)?_o:Se;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function Kf(e,t){var n=this._id;return arguments.length<2?Ee(this.node(),n).on.on(e):this.each(Xf(n,e,t))}function jf(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Qf(){return this.on("end.remove",jf(this._id))}function Jf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=vo(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s()=>e;function Sh(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Re(e,t,n){this.k=e,this.x=t,this.y=n}Re.prototype={constructor:Re,scale:function(e){return e===1?this:new Re(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Re(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ae=new Re(1,0,0);Re.prototype;function un(e){e.stopImmediatePropagation()}function pt(e){e.preventDefault(),e.stopImmediatePropagation()}function Nh(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ch(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Xo(){return this.__zoom||Ae}function kh(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Rh(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ah(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Da(){var e=Nh,t=Ch,n=Ah,r=kh,o=Rh,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Tc,l=Xt("start","zoom","end"),u,d,f,h=500,_=150,m=0,g=10;function p(w){w.property("__zoom",Xo).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",A).filter(o).on("touchstart.zoom",D).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(w,R,N,O){var H=w.selection?w.selection():w;H.property("__zoom",Xo),w!==H?b(w,R,N,O):H.interrupt().each(function(){x(this,arguments).event(O).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},p.scaleBy=function(w,R,N,O){p.scaleTo(w,function(){var H=this.__zoom.k,M=typeof R=="function"?R.apply(this,arguments):R;return H*M},N,O)},p.scaleTo=function(w,R,N,O){p.transform(w,function(){var H=t.apply(this,arguments),M=this.__zoom,F=N==null?v(H):typeof N=="function"?N.apply(this,arguments):N,B=M.invert(F),G=typeof R=="function"?R.apply(this,arguments):R;return n(E(y(M,G),F,B),H,s)},N,O)},p.translateBy=function(w,R,N,O){p.transform(w,function(){return n(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,O)},p.translateTo=function(w,R,N,O,H){p.transform(w,function(){var M=t.apply(this,arguments),F=this.__zoom,B=O==null?v(M):typeof O=="function"?O.apply(this,arguments):O;return n(Ae.translate(B[0],B[1]).scale(F.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof N=="function"?-N.apply(this,arguments):-N),M,s)},O,H)};function y(w,R){return R=Math.max(i[0],Math.min(i[1],R)),R===w.k?w:new Re(R,w.x,w.y)}function E(w,R,N){var O=R[0]-N[0]*w.k,H=R[1]-N[1]*w.k;return O===w.x&&H===w.y?w:new Re(w.k,O,H)}function v(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function b(w,R,N,O){w.on("start.zoom",function(){x(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(O).end()}).tween("zoom",function(){var H=this,M=arguments,F=x(H,M).event(O),B=t.apply(H,M),G=N==null?v(B):typeof N=="function"?N.apply(H,M):N,U=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),S=H.__zoom,I=typeof R=="function"?R.apply(H,M):R,z=c(S.invert(G).concat(U/S.k),I.invert(G).concat(U/I.k));return function(V){if(V===1)V=I;else{var Y=z(V),W=U/Y[2];V=new Re(W,G[0]-Y[0]*W,G[1]-Y[1]*W)}F.zoom(null,V)}})}function x(w,R,N){return!N&&w.__zooming||new C(w,R)}function C(w,R){this.that=w,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,R),this.taps=0}C.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,R){return this.mouse&&w!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var R=ge(this.that).datum();l.call(w,this.that,new Sh(w,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:l}),R)}};function q(w,...R){if(!e.apply(this,arguments))return;var N=x(this,R).event(w),O=this.__zoom,H=Math.max(i[0],Math.min(i[1],O.k*Math.pow(2,r.apply(this,arguments)))),M=ye(w);if(N.wheel)(N.mouse[0][0]!==M[0]||N.mouse[0][1]!==M[1])&&(N.mouse[1]=O.invert(N.mouse[0]=M)),clearTimeout(N.wheel);else{if(O.k===H)return;N.mouse=[M,O.invert(M)],Lt(this),N.start()}pt(w),N.wheel=setTimeout(F,_),N.zoom("mouse",n(E(y(O,H),N.mouse[0],N.mouse[1]),N.extent,s));function F(){N.wheel=null,N.end()}}function k(w,...R){if(f||!e.apply(this,arguments))return;var N=w.currentTarget,O=x(this,R,!0).event(w),H=ge(w.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",U,!0),M=ye(w,N),F=w.clientX,B=w.clientY;Ca(w.view),un(w),O.mouse=[M,this.__zoom.invert(M)],Lt(this),O.start();function G(S){if(pt(S),!O.moved){var I=S.clientX-F,z=S.clientY-B;O.moved=I*I+z*z>m}O.event(S).zoom("mouse",n(E(O.that.__zoom,O.mouse[0]=ye(S,N),O.mouse[1]),O.extent,s))}function U(S){H.on("mousemove.zoom mouseup.zoom",null),ka(S.view,O.moved),pt(S),O.event(S).end()}}function A(w,...R){if(e.apply(this,arguments)){var N=this.__zoom,O=ye(w.changedTouches?w.changedTouches[0]:w,this),H=N.invert(O),M=N.k*(w.shiftKey?.5:2),F=n(E(y(N,M),O,H),t.apply(this,R),s);pt(w),a>0?ge(this).transition().duration(a).call(b,F,O,w):ge(this).call(p.transform,F,O,w)}}function D(w,...R){if(e.apply(this,arguments)){var N=w.touches,O=N.length,H=x(this,R,w.changedTouches.length===O).event(w),M,F,B,G;for(un(w),F=0;F"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},za=Ie.error001();function re(e,t){const n=T.useContext(Jt);if(n===null)throw new Error(za);return ha(n,e,t)}const ae=()=>{const e=T.useContext(Jt);if(e===null)throw new Error(za);return T.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},Ih=e=>e.userSelectionActive?"none":"all";function bo({position:e,children:t,className:n,style:r,...o}){const i=re(Ih),s=`${e}`.split("-");return P.createElement("div",{className:ce(["react-flow__panel",n,...s]),style:{...r,pointerEvents:i},...o},t)}function qh({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:P.createElement(bo,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},P.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const Th=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:o=!0,labelBgStyle:i={},labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:c,className:l,...u})=>{const d=T.useRef(null),[f,h]=T.useState({x:0,y:0,width:0,height:0}),_=ce(["react-flow__edge-textwrapper",l]);return T.useEffect(()=>{if(d.current){const m=d.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:P.createElement("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...u},o&&P.createElement("rect",{width:f.width+2*s[0],x:-s[0],y:-s[1],height:f.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),P.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r},n),c)};var Ph=T.memo(Th);const xo=e=>({width:e.offsetWidth,height:e.offsetHeight}),ct=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),So=(e={x:0,y:0},t)=>({x:ct(e.x,t[0][0],t[1][0]),y:ct(e.y,t[0][1],t[1][1])}),Ko=(e,t,n)=>en?-ct(Math.abs(e-n),1,50)/50:0,La=(e,t)=>{const n=Ko(e.x,35,t.width-35)*20,r=Ko(e.y,35,t.height-35)*20;return[n,r]},$a=e=>e.getRootNode?.()||window?.document,Oa=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),xt=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Fa=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),jo=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Dh=(e,t)=>Fa(Oa(xt(e),xt(t))),to=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},zh=e=>me(e.width)&&me(e.height)&&me(e.x)&&me(e.y),me=e=>!isNaN(e)&&isFinite(e),se=Symbol.for("internals"),Ha=["Enter"," ","Escape"],Lh=(e,t)=>{},$h=e=>"nativeEvent"in e;function no(e){const n=($h(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const Va=e=>"clientX"in e,De=(e,t)=>{const n=Va(e),r=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:o-(t?.top??0)}},Vt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,kt=({id:e,path:t,labelX:n,labelY:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:h=20})=>P.createElement(P.Fragment,null,P.createElement("path",{id:e,style:u,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&P.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),o&&me(n)&&me(r)?P.createElement(Ph,{x:n,y:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:l}):null);kt.displayName="BaseEdge";function gt(e,t,n){return n===void 0?n:r=>{const o=t().edges.find(i=>i.id===e);o&&n(r,{...o})}}function Ba({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n{const[g,p,y]=Ua({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:i});return P.createElement(kt,{path:g,labelX:p,labelY:y,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:_,interactionWidth:m})});No.displayName="SimpleBezierEdge";const Jo={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Oh=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Fh({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:r=X.Top,center:o,offset:i}){const s=Jo[t],a=Jo[r],c={x:e.x+s.x*i,y:e.y+s.y*i},l={x:n.x+a.x*i,y:n.y+a.y*i},u=Oh({source:c,sourcePosition:t,target:l}),d=u.x!==0?"x":"y",f=u[d];let h=[],_,m;const g={x:0,y:0},p={x:0,y:0},[y,E,v,b]=Ba({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*a[d]===-1){_=o.x??y,m=o.y??E;const C=[{x:_,y:c.y},{x:_,y:l.y}],q=[{x:c.x,y:m},{x:l.x,y:m}];s[d]===f?h=d==="x"?C:q:h=d==="x"?q:C}else{const C=[{x:c.x,y:l.y}],q=[{x:l.x,y:c.y}];if(d==="x"?h=s.x===f?q:C:h=s.y===f?C:q,t===r){const L=Math.abs(e[d]-n[d]);if(L<=i){const w=Math.min(i-1,i-L);s[d]===f?g[d]=(c[d]>e[d]?-1:1)*w:p[d]=(l[d]>n[d]?-1:1)*w}}if(t!==r){const L=d==="x"?"y":"x",w=s[d]===a[L],R=c[L]>l[L],N=c[L]=$?(_=(k.x+A.x)/2,m=h[0].y):(_=h[0].x,m=(k.y+A.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...h,{x:l.x+p.x,y:l.y+p.y},n],_,m,v,b]}function Hh(e,t,n,r){const o=Math.min(ei(e,t)/2,ei(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x{let E="";return y>0&&y{const[p,y,E]=ro({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:m?.borderRadius,offset:m?.offset});return P.createElement(kt,{path:p,labelX:y,labelY:E,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:h,markerStart:_,interactionWidth:g})});en.displayName="SmoothStepEdge";const Co=T.memo(e=>P.createElement(en,{...e,pathOptions:T.useMemo(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));Co.displayName="StepEdge";function Vh({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=Ba({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const ko=T.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[_,m,g]=Vh({sourceX:e,sourceY:t,targetX:n,targetY:r});return P.createElement(kt,{path:_,labelX:m,labelY:g,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:h})});ko.displayName="StraightEdge";function Mt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ti({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case X.Left:return[t-Mt(t-r,i),n];case X.Right:return[t+Mt(r-t,i),n];case X.Top:return[t,n-Mt(n-o,i)];case X.Bottom:return[t,n+Mt(o-n,i)]}}function Ya({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:i=X.Top,curvature:s=.25}){const[a,c]=ti({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[l,u]=ti({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[d,f,h,_]=Ga({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${r},${o}`,d,f,h,_]}const Gt=T.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o=X.Bottom,targetPosition:i=X.Top,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:_,pathOptions:m,interactionWidth:g})=>{const[p,y,E]=Ya({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:i,curvature:m?.curvature});return P.createElement(kt,{path:p,labelX:y,labelY:E,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:_,interactionWidth:g})});Gt.displayName="BezierEdge";const Ro=T.createContext(null),Bh=Ro.Provider;Ro.Consumer;const Gh=()=>T.useContext(Ro),Uh=e=>"id"in e&&"source"in e&&"target"in e,Yh=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,oo=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,Wh=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Zh=(e,t)=>{if(!e.source||!e.target)return t;let n;return Uh(e)?n={...e}:n={...e,id:Yh(e)},Wh(n,t)?t:t.concat(n)},io=({x:e,y:t},[n,r,o],i,[s,a])=>{const c={x:(e-n)/o,y:(t-r)/o};return i?{x:s*Math.round(c.x/s),y:a*Math.round(c.y/a)}:c},Wa=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r}),Ge=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],o={x:e.position.x-n,y:e.position.y-r};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:o}},tn=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const{x:i,y:s}=Ge(o,t).positionAbsolute;return Oa(r,xt({x:i,y:s,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Fa(n)},Za=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1,a=[0,0])=>{const c={x:(t.x-n)/o,y:(t.y-r)/o,width:t.width/o,height:t.height/o},l=[];return e.forEach(u=>{const{width:d,height:f,selectable:h=!0,hidden:_=!1}=u;if(s&&!h||_)return!1;const{positionAbsolute:m}=Ge(u,a),g={x:m.x,y:m.y,width:d||0,height:f||0},p=to(c,g),y=typeof d>"u"||typeof f>"u"||d===null||f===null,E=i&&p>0,v=(d||0)*(f||0);(y||E||p>=v||u.dragging)&&l.push(u)}),l},Xa=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},Ka=(e,t,n,r,o,i=.1)=>{const s=t/(e.width*(1+i)),a=n/(e.height*(1+i)),c=Math.min(s,a),l=ct(c,r,o),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,h=n/2-d*l;return{x:f,y:h,zoom:l}},Ve=(e,t=0)=>e.transition().duration(t);function ni(e,t,n,r){return(t[n]||[]).reduce((o,i)=>(`${e.id}-${i.id}-${n}`!==r&&o.push({id:i.id||null,type:n,nodeId:e.id,x:(e.positionAbsolute?.x??0)+i.x+i.width/2,y:(e.positionAbsolute?.y??0)+i.y+i.height/2}),o),[])}function Xh(e,t,n,r,o,i){const{x:s,y:a}=De(e),l=t.elementsFromPoint(s,a).find(_=>_.classList.contains("react-flow__handle"));if(l){const _=l.getAttribute("data-nodeid");if(_){const m=Ao(void 0,l),g=l.getAttribute("data-handleid"),p=i({nodeId:_,id:g,type:m});if(p){const y=o.find(E=>E.nodeId===_&&E.type===m&&E.id===g);return{handle:{id:g,type:m,nodeId:_,x:y?.x||n.x,y:y?.y||n.y},validHandleResult:p}}}}let u=[],d=1/0;if(o.forEach(_=>{const m=Math.sqrt((_.x-n.x)**2+(_.y-n.y)**2);if(m<=r){const g=i(_);m<=d&&(m_.isValid),h=u.some(({handle:_})=>_.type==="target");return u.find(({handle:_,validHandleResult:m})=>h?_.type==="target":f?m.isValid:!0)||u[0]}const Kh={source:null,target:null,sourceHandle:null,targetHandle:null},ja=()=>({handleDomNode:null,isValid:!1,connection:Kh,endHandle:null});function Qa(e,t,n,r,o,i,s){const a=o==="target",c=s.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),l={...ja(),handleDomNode:c};if(c){const u=Ao(void 0,c),d=c.getAttribute("data-nodeid"),f=c.getAttribute("data-handleid"),h=c.classList.contains("connectable"),_=c.classList.contains("connectableend"),m={source:a?d:n,sourceHandle:a?f:r,target:a?n:d,targetHandle:a?r:f};l.connection=m,h&&_&&(t===Ye.Strict?a&&u==="source"||!a&&u==="target":d!==n||f!==r)&&(l.endHandle={nodeId:d,handleId:f,type:u},l.isValid=i(m))}return l}function jh({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((o,i)=>{if(i[se]){const{handleBounds:s}=i[se];let a=[],c=[];s&&(a=ni(i,s,"source",`${t}-${n}-${r}`),c=ni(i,s,"target",`${t}-${n}-${r}`)),o.push(...a,...c)}return o},[])}function Ao(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function cn(e){e?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Qh(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Ja({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:o,getState:i,setState:s,isValidConnection:a,edgeUpdaterType:c,onReconnectEnd:l}){const u=$a(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:_,onConnectStart:m,panBy:g,getNodes:p,cancelConnection:y}=i();let E=0,v;const{x:b,y:x}=De(e),C=u?.elementFromPoint(b,x),q=Ao(c,C),k=f?.getBoundingClientRect();if(!k||!q)return;let A,D=De(e,k),$=!1,L=null,w=!1,R=null;const N=jh({nodes:p(),nodeId:n,handleId:t,handleType:q}),O=()=>{if(!h)return;const[F,B]=La(D,k);g({x:F,y:B}),E=requestAnimationFrame(O)};s({connectionPosition:D,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:q,connectionStartHandle:{nodeId:n,handleId:t,type:q},connectionEndHandle:null}),m?.(e,{nodeId:n,handleId:t,handleType:q});function H(F){const{transform:B}=i();D=De(F,k);const{handle:G,validHandleResult:U}=Xh(F,u,io(D,B,!1,[1,1]),_,N,S=>Qa(S,d,n,t,o?"target":"source",a,u));if(v=G,$||(O(),$=!0),R=U.handleDomNode,L=U.connection,w=U.isValid,s({connectionPosition:v&&w?Wa({x:v.x,y:v.y},B):D,connectionStatus:Qh(!!v,w),connectionEndHandle:U.endHandle}),!v&&!w&&!R)return cn(A);L.source!==L.target&&R&&(cn(A),A=R,R.classList.add("connecting","react-flow__handle-connecting"),R.classList.toggle("valid",w),R.classList.toggle("react-flow__handle-valid",w))}function M(F){(v||R)&&L&&w&&r?.(L),i().onConnectEnd?.(F),c&&l?.(F),cn(A),y(),cancelAnimationFrame(E),$=!1,w=!1,L=null,R=null,u.removeEventListener("mousemove",H),u.removeEventListener("mouseup",M),u.removeEventListener("touchmove",H),u.removeEventListener("touchend",M)}u.addEventListener("mousemove",H),u.addEventListener("mouseup",M),u.addEventListener("touchmove",H),u.addEventListener("touchend",M)}const ri=()=>!0,Jh=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),ep=(e,t,n)=>r=>{const{connectionStartHandle:o,connectionEndHandle:i,connectionClickStartHandle:s}=r;return{connecting:o?.nodeId===e&&o?.handleId===t&&o?.type===n||i?.nodeId===e&&i?.handleId===t&&i?.type===n,clickConnecting:s?.nodeId===e&&s?.handleId===t&&s?.type===n}},eu=T.forwardRef(({type:e="source",position:t=X.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},h)=>{const _=s||null,m=e==="target",g=ae(),p=Gh(),{connectOnClick:y,noPanClassName:E}=re(Jh,ue),{connecting:v,clickConnecting:b}=re(ep(p,_,e),ue);p||g.getState().onError?.("010",Ie.error010());const x=k=>{const{defaultEdgeOptions:A,onConnect:D,hasDefaultEdges:$}=g.getState(),L={...A,...k};if($){const{edges:w,setEdges:R}=g.getState();R(Zh(L,w))}D?.(L),a?.(L)},C=k=>{if(!p)return;const A=Va(k);o&&(A&&k.button===0||!A)&&Ja({event:k,handleId:_,nodeId:p,onConnect:x,isTarget:m,getState:g.getState,setState:g.setState,isValidConnection:n||g.getState().isValidConnection||ri}),A?u?.(k):d?.(k)},q=k=>{const{onClickConnectStart:A,onClickConnectEnd:D,connectionClickStartHandle:$,connectionMode:L,isValidConnection:w}=g.getState();if(!p||!$&&!o)return;if(!$){A?.(k,{nodeId:p,handleId:_,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:p,type:e,handleId:_}});return}const R=$a(k.target),N=n||w||ri,{connection:O,isValid:H}=Qa({nodeId:p,id:_,type:e},L,$.nodeId,$.handleId||null,$.type,N,R);H&&x(O),D?.(k),g.setState({connectionClickStartHandle:null})};return P.createElement("div",{"data-handleid":_,"data-nodeid":p,"data-handlepos":t,"data-id":`${p}-${_}-${e}`,className:ce(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,l,{source:!m,target:m,connectable:r,connectablestart:o,connectableend:i,connecting:b,connectionindicator:r&&(o&&!v||i&&v)}]),onMouseDown:C,onTouchStart:C,onClick:y?q:void 0,ref:h,...f},c)});eu.displayName="Handle";var Ut=T.memo(eu);const tu=({data:e,isConnectable:t,targetPosition:n=X.Top,sourcePosition:r=X.Bottom})=>P.createElement(P.Fragment,null,P.createElement(Ut,{type:"target",position:n,isConnectable:t}),e?.label,P.createElement(Ut,{type:"source",position:r,isConnectable:t}));tu.displayName="DefaultNode";var so=T.memo(tu);const nu=({data:e,isConnectable:t,sourcePosition:n=X.Bottom})=>P.createElement(P.Fragment,null,e?.label,P.createElement(Ut,{type:"source",position:n,isConnectable:t}));nu.displayName="InputNode";var ru=T.memo(nu);const ou=({data:e,isConnectable:t,targetPosition:n=X.Top})=>P.createElement(P.Fragment,null,P.createElement(Ut,{type:"target",position:n,isConnectable:t}),e?.label);ou.displayName="OutputNode";var iu=T.memo(ou);const Mo=()=>null;Mo.displayName="GroupNode";const tp=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),It=e=>e.id;function np(e,t){return ue(e.selectedNodes.map(It),t.selectedNodes.map(It))&&ue(e.selectedEdges.map(It),t.selectedEdges.map(It))}const su=T.memo(({onSelectionChange:e})=>{const t=ae(),{selectedNodes:n,selectedEdges:r}=re(tp,np);return T.useEffect(()=>{const o={nodes:n,edges:r};e?.(o),t.getState().onSelectionChange.forEach(i=>i(o))},[n,r,e]),null});su.displayName="SelectionListener";const rp=e=>!!e.onSelectionChange;function op({onSelectionChange:e}){const t=re(rp);return e||t?P.createElement(su,{onSelectionChange:e}):null}const ip=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function et(e,t){T.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function j(e,t,n){T.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const sp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:o,onConnectStart:i,onConnectEnd:s,onClickConnectStart:a,onClickConnectEnd:c,nodesDraggable:l,nodesConnectable:u,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:_,minZoom:m,maxZoom:g,nodeExtent:p,onNodesChange:y,onEdgesChange:E,elementsSelectable:v,connectionMode:b,snapGrid:x,snapToGrid:C,translateExtent:q,connectOnClick:k,defaultEdgeOptions:A,fitView:D,fitViewOptions:$,onNodesDelete:L,onEdgesDelete:w,onNodeDrag:R,onNodeDragStart:N,onNodeDragStop:O,onSelectionDrag:H,onSelectionDragStart:M,onSelectionDragStop:F,noPanClassName:B,nodeOrigin:G,rfId:U,autoPanOnConnect:S,autoPanOnNodeDrag:I,onError:z,connectionRadius:V,isValidConnection:Y,nodeDragThreshold:W})=>{const{setNodes:K,setEdges:ee,setDefaultNodesAndEdges:ie,setMinZoom:te,setMaxZoom:Q,setTranslateExtent:ne,setNodeExtent:le,reset:J}=re(ip,ue),Z=ae();return T.useEffect(()=>{const fe=r?.map(Ne=>({...Ne,...A}));return ie(n,fe),()=>{J()}},[]),j("defaultEdgeOptions",A,Z.setState),j("connectionMode",b,Z.setState),j("onConnect",o,Z.setState),j("onConnectStart",i,Z.setState),j("onConnectEnd",s,Z.setState),j("onClickConnectStart",a,Z.setState),j("onClickConnectEnd",c,Z.setState),j("nodesDraggable",l,Z.setState),j("nodesConnectable",u,Z.setState),j("nodesFocusable",d,Z.setState),j("edgesFocusable",f,Z.setState),j("edgesUpdatable",h,Z.setState),j("elementsSelectable",v,Z.setState),j("elevateNodesOnSelect",_,Z.setState),j("snapToGrid",C,Z.setState),j("snapGrid",x,Z.setState),j("onNodesChange",y,Z.setState),j("onEdgesChange",E,Z.setState),j("connectOnClick",k,Z.setState),j("fitViewOnInit",D,Z.setState),j("fitViewOnInitOptions",$,Z.setState),j("onNodesDelete",L,Z.setState),j("onEdgesDelete",w,Z.setState),j("onNodeDrag",R,Z.setState),j("onNodeDragStart",N,Z.setState),j("onNodeDragStop",O,Z.setState),j("onSelectionDrag",H,Z.setState),j("onSelectionDragStart",M,Z.setState),j("onSelectionDragStop",F,Z.setState),j("noPanClassName",B,Z.setState),j("nodeOrigin",G,Z.setState),j("rfId",U,Z.setState),j("autoPanOnConnect",S,Z.setState),j("autoPanOnNodeDrag",I,Z.setState),j("onError",z,Z.setState),j("connectionRadius",V,Z.setState),j("isValidConnection",Y,Z.setState),j("nodeDragThreshold",W,Z.setState),et(e,K),et(t,ee),et(m,te),et(g,Q),et(q,ne),et(p,le),null},oi={display:"none"},ap={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},au="react-flow__node-desc",uu="react-flow__edge-desc",up="react-flow__aria-live",cp=e=>e.ariaLiveMessage;function lp({rfId:e}){const t=re(cp);return P.createElement("div",{id:`${up}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ap},t)}function dp({rfId:e,disableKeyboardA11y:t}){return P.createElement(P.Fragment,null,P.createElement("div",{id:`${au}-${e}`,style:oi},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),P.createElement("div",{id:`${uu}-${e}`,style:oi},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&P.createElement(lp,{rfId:e}))}var Nt=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=T.useState(!1),o=T.useRef(!1),i=T.useRef(new Set([])),[s,a]=T.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),u=l.reduce((d,f)=>d.concat(...f),[]);return[l,u]}return[[],[]]},[e]);return T.useEffect(()=>{const c=typeof document<"u"?document:null,l=t?.target||c;if(e!==null){const u=h=>{if(o.current=h.ctrlKey||h.metaKey||h.shiftKey,(!o.current||o.current&&!t.actInsideInputWithModifier)&&no(h))return!1;const m=si(h.code,a);i.current.add(h[m]),ii(s,i.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if((!o.current||o.current&&!t.actInsideInputWithModifier)&&no(h))return!1;const m=si(h.code,a);ii(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[m]),h.key==="Meta"&&i.current.clear(),o.current=!1},f=()=>{i.current.clear(),r(!1)};return l?.addEventListener("keydown",u),l?.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{l?.removeEventListener("keydown",u),l?.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function ii(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function si(e,t){return t.includes(e)?"code":"key"}function cu(e,t,n,r){const o=e.parentNode||e.parentId;if(!o)return n;const i=t.get(o),s=Ge(i,r);return cu(i,t,{x:(n.x??0)+s.x,y:(n.y??0)+s.y,z:(i[se]?.z??0)>(n.z??0)?i[se]?.z??0:n.z??0},r)}function lu(e,t,n){e.forEach(r=>{const o=r.parentNode||r.parentId;if(o&&!e.has(o))throw new Error(`Parent node ${o} not found`);if(o||n?.[r.id]){const{x:i,y:s,z:a}=cu(r,e,{...r.position,z:r[se]?.z??0},t);r.positionAbsolute={x:i,y:s},r[se].z=a,n?.[r.id]&&(r[se].isParent=!0)}})}function ln(e,t,n,r){const o=new Map,i={},s=r?1e3:0;return e.forEach(a=>{const c=(me(a.zIndex)?a.zIndex:0)+(a.selected?s:0),l=t.get(a.id),u={...a,positionAbsolute:{x:a.position.x,y:a.position.y}},d=a.parentNode||a.parentId;d&&(i[d]=!0);const f=l?.type&&l?.type!==a.type;Object.defineProperty(u,se,{enumerable:!1,value:{handleBounds:f?void 0:l?.[se]?.handleBounds,z:c}}),o.set(a.id,u)}),lu(o,n,i),o}function du(e,t={}){const{getNodes:n,width:r,height:o,minZoom:i,maxZoom:s,d3Zoom:a,d3Selection:c,fitViewOnInitDone:l,fitViewOnInit:u,nodeOrigin:d}=e(),f=t.initial&&!l&&u;if(a&&c&&(f||!t.initial)){const _=n().filter(g=>{const p=t.includeHiddenNodes?g.width&&g.height:!g.hidden;return t.nodes?.length?p&&t.nodes.some(y=>y.id===g.id):p}),m=_.every(g=>g.width&&g.height);if(_.length>0&&m){const g=tn(_,d),{x:p,y,zoom:E}=Ka(g,r,o,t.minZoom??i,t.maxZoom??s,t.padding??.1),v=Ae.translate(p,y).scale(E);return typeof t.duration=="number"&&t.duration>0?a.transform(Ve(c,t.duration),v):a.transform(c,v),!0}}return!1}function fp(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[se]:r[se],selected:n.selected})}),new Map(t)}function hp(e,t){return t.map(n=>{const r=e.find(o=>o.id===n.id);return r&&(n.selected=r.selected),n})}function qt({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:o,edges:i,onNodesChange:s,onEdgesChange:a,hasDefaultNodes:c,hasDefaultEdges:l}=n();e?.length&&(c&&r({nodeInternals:fp(e,o)}),s?.(e)),t?.length&&(l&&r({edges:hp(t,i)}),a?.(t))}const tt=()=>{},pp={zoomIn:tt,zoomOut:tt,zoomTo:tt,getZoom:()=>1,setViewport:tt,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:tt,fitBounds:tt,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},gp=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),mp=()=>{const e=ae(),{d3Zoom:t,d3Selection:n}=re(gp,ue);return T.useMemo(()=>n&&t?{zoomIn:o=>t.scaleBy(Ve(n,o?.duration),1.2),zoomOut:o=>t.scaleBy(Ve(n,o?.duration),1/1.2),zoomTo:(o,i)=>t.scaleTo(Ve(n,i?.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,i)=>{const[s,a,c]=e.getState().transform,l=Ae.translate(o.x??s,o.y??a).scale(o.zoom??c);t.transform(Ve(n,i?.duration),l)},getViewport:()=>{const[o,i,s]=e.getState().transform;return{x:o,y:i,zoom:s}},fitView:o=>du(e.getState,o),setCenter:(o,i,s)=>{const{width:a,height:c,maxZoom:l}=e.getState(),u=typeof s?.zoom<"u"?s.zoom:l,d=a/2-o*u,f=c/2-i*u,h=Ae.translate(d,f).scale(u);t.transform(Ve(n,s?.duration),h)},fitBounds:(o,i)=>{const{width:s,height:a,minZoom:c,maxZoom:l}=e.getState(),{x:u,y:d,zoom:f}=Ka(o,s,a,c,l,i?.padding??.1),h=Ae.translate(u,d).scale(f);t.transform(Ve(n,i?.duration),h)},project:o=>{const{transform:i,snapToGrid:s,snapGrid:a}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),io(o,i,s,a)},screenToFlowPosition:o=>{const{transform:i,snapToGrid:s,snapGrid:a,domNode:c}=e.getState();if(!c)return o;const{x:l,y:u}=c.getBoundingClientRect(),d={x:o.x-l,y:o.y-u};return io(d,i,s,a)},flowToScreenPosition:o=>{const{transform:i,domNode:s}=e.getState();if(!s)return o;const{x:a,y:c}=s.getBoundingClientRect(),l=Wa(o,i);return{x:l.x+a,y:l.y+c}},viewportInitialized:!0}:pp,[t,n])};function Io(){const e=mp(),t=ae(),n=T.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=T.useCallback(m=>t.getState().nodeInternals.get(m),[]),o=T.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(g=>({...g}))},[]),i=T.useCallback(m=>{const{edges:g=[]}=t.getState();return g.find(p=>p.id===m)},[]),s=T.useCallback(m=>{const{getNodes:g,setNodes:p,hasDefaultNodes:y,onNodesChange:E}=t.getState(),v=g(),b=typeof m=="function"?m(v):m;if(y)p(b);else if(E){const x=b.length===0?v.map(C=>({type:"remove",id:C.id})):b.map(C=>({item:C,type:"reset"}));E(x)}},[]),a=T.useCallback(m=>{const{edges:g=[],setEdges:p,hasDefaultEdges:y,onEdgesChange:E}=t.getState(),v=typeof m=="function"?m(g):m;if(y)p(v);else if(E){const b=v.length===0?g.map(x=>({type:"remove",id:x.id})):v.map(x=>({item:x,type:"reset"}));E(b)}},[]),c=T.useCallback(m=>{const g=Array.isArray(m)?m:[m],{getNodes:p,setNodes:y,hasDefaultNodes:E,onNodesChange:v}=t.getState();if(E){const x=[...p(),...g];y(x)}else if(v){const b=g.map(x=>({item:x,type:"add"}));v(b)}},[]),l=T.useCallback(m=>{const g=Array.isArray(m)?m:[m],{edges:p=[],setEdges:y,hasDefaultEdges:E,onEdgesChange:v}=t.getState();if(E)y([...p,...g]);else if(v){const b=g.map(x=>({item:x,type:"add"}));v(b)}},[]),u=T.useCallback(()=>{const{getNodes:m,edges:g=[],transform:p}=t.getState(),[y,E,v]=p;return{nodes:m().map(b=>({...b})),edges:g.map(b=>({...b})),viewport:{x:y,y:E,zoom:v}}},[]),d=T.useCallback(({nodes:m,edges:g})=>{const{nodeInternals:p,getNodes:y,edges:E,hasDefaultNodes:v,hasDefaultEdges:b,onNodesDelete:x,onEdgesDelete:C,onNodesChange:q,onEdgesChange:k}=t.getState(),A=(m||[]).map(R=>R.id),D=(g||[]).map(R=>R.id),$=y().reduce((R,N)=>{const O=N.parentNode||N.parentId,H=!A.includes(N.id)&&O&&R.find(F=>F.id===O);return(typeof N.deletable=="boolean"?N.deletable:!0)&&(A.includes(N.id)||H)&&R.push(N),R},[]),L=E.filter(R=>typeof R.deletable=="boolean"?R.deletable:!0),w=L.filter(R=>D.includes(R.id));if($||w){const R=Xa($,L),N=[...w,...R],O=N.reduce((H,M)=>(H.includes(M.id)||H.push(M.id),H),[]);if((b||v)&&(b&&t.setState({edges:E.filter(H=>!O.includes(H.id))}),v&&($.forEach(H=>{p.delete(H.id)}),t.setState({nodeInternals:new Map(p)}))),O.length>0&&(C?.(N),k&&k(O.map(H=>({id:H,type:"remove"})))),$.length>0&&(x?.($),q)){const H=$.map(M=>({id:M.id,type:"remove"}));q(H)}}},[]),f=T.useCallback(m=>{const g=zh(m),p=g?null:t.getState().nodeInternals.get(m.id);return!g&&!p?[null,null,g]:[g?m:jo(p),p,g]},[]),h=T.useCallback((m,g=!0,p)=>{const[y,E,v]=f(m);return y?(p||t.getState().getNodes()).filter(b=>{if(!v&&(b.id===E.id||!b.positionAbsolute))return!1;const x=jo(b),C=to(x,y);return g&&C>0||C>=y.width*y.height}):[]},[]),_=T.useCallback((m,g,p=!0)=>{const[y]=f(m);if(!y)return!1;const E=to(y,g);return p&&E>0||E>=y.width*y.height},[]);return T.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:o,getEdge:i,setNodes:s,setEdges:a,addNodes:c,addEdges:l,toObject:u,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:_}),[e,n,r,o,i,s,a,c,l,u,d,h,_])}const vp={actInsideInputWithModifier:!1};var yp=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=ae(),{deleteElements:r}=Io(),o=Nt(e,vp),i=Nt(t);T.useEffect(()=>{if(o){const{edges:s,getNodes:a}=n.getState(),c=a().filter(u=>u.selected),l=s.filter(u=>u.selected);r({nodes:c,edges:l}),n.setState({nodesSelectionActive:!1})}},[o]),T.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function wp(e){const t=ae();T.useEffect(()=>{let n;const r=()=>{if(!e.current)return;const o=xo(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",Ie.error004()),t.setState({width:o.width||500,height:o.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const qo={position:"absolute",width:"100%",height:"100%",top:0,left:0},_p=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Tt=e=>({x:e.x,y:e.y,zoom:e.k}),nt=(e,t)=>e.target.closest(`.${t}`),ai=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ui=e=>{const t=e.ctrlKey&&Vt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Ep=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),bp=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:o=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:a=.5,panOnScrollMode:c=Be.Free,zoomOnDoubleClick:l=!0,elementsSelectable:u,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:_,maxZoom:m,zoomActivationKeyCode:g,preventScrolling:p=!0,children:y,noWheelClassName:E,noPanClassName:v})=>{const b=T.useRef(),x=ae(),C=T.useRef(!1),q=T.useRef(!1),k=T.useRef(null),A=T.useRef({x:0,y:0,zoom:0}),{d3Zoom:D,d3Selection:$,d3ZoomHandler:L,userSelectionActive:w}=re(Ep,ue),R=Nt(g),N=T.useRef(0),O=T.useRef(!1),H=T.useRef();return wp(k),T.useEffect(()=>{if(k.current){const M=k.current.getBoundingClientRect(),F=Da().scaleExtent([_,m]).translateExtent(h),B=ge(k.current).call(F),G=Ae.translate(f.x,f.y).scale(ct(f.zoom,_,m)),U=[[0,0],[M.width,M.height]],S=F.constrain()(G,U,h);F.transform(B,S),F.wheelDelta(ui),x.setState({d3Zoom:F,d3Selection:B,d3ZoomHandler:B.on("wheel.zoom"),transform:[S.x,S.y,S.k],domNode:k.current.closest(".react-flow")})}},[]),T.useEffect(()=>{$&&D&&(s&&!R&&!w?$.on("wheel.zoom",M=>{if(nt(M,E))return!1;M.preventDefault(),M.stopImmediatePropagation();const F=$.property("__zoom").k||1;if(M.ctrlKey&&i){const Y=ye(M),W=ui(M),K=F*Math.pow(2,W);D.scaleTo($,K,Y,M);return}const B=M.deltaMode===1?20:1;let G=c===Be.Vertical?0:M.deltaX*B,U=c===Be.Horizontal?0:M.deltaY*B;!Vt()&&M.shiftKey&&c!==Be.Vertical&&(G=M.deltaY*B,U=0),D.translateBy($,-(G/F)*a,-(U/F)*a,{internal:!0});const S=Tt($.property("__zoom")),{onViewportChangeStart:I,onViewportChange:z,onViewportChangeEnd:V}=x.getState();clearTimeout(H.current),O.current||(O.current=!0,t?.(M,S),I?.(S)),O.current&&(e?.(M,S),z?.(S),H.current=setTimeout(()=>{n?.(M,S),V?.(S),O.current=!1},150))},{passive:!1}):typeof L<"u"&&$.on("wheel.zoom",function(M,F){if(!p&&M.type==="wheel"&&!M.ctrlKey||nt(M,E))return null;M.preventDefault(),L.call(this,M,F)},{passive:!1}))},[w,s,c,$,D,L,R,i,p,E,t,e,n]),T.useEffect(()=>{D&&D.on("start",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;N.current=M.sourceEvent?.button;const{onViewportChangeStart:F}=x.getState(),B=Tt(M.transform);C.current=!0,A.current=B,M.sourceEvent?.type==="mousedown"&&x.setState({paneDragging:!0}),F?.(B),t?.(M.sourceEvent,B)})},[D,t]),T.useEffect(()=>{D&&(w&&!C.current?D.on("zoom",null):w||D.on("zoom",M=>{const{onViewportChange:F}=x.getState();if(x.setState({transform:[M.transform.x,M.transform.y,M.transform.k]}),q.current=!!(r&&ai(d,N.current??0)),(e||F)&&!M.sourceEvent?.internal){const B=Tt(M.transform);F?.(B),e?.(M.sourceEvent,B)}}))},[w,D,e,d,r]),T.useEffect(()=>{D&&D.on("end",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;const{onViewportChangeEnd:F}=x.getState();if(C.current=!1,x.setState({paneDragging:!1}),r&&ai(d,N.current??0)&&!q.current&&r(M.sourceEvent),q.current=!1,(n||F)&&_p(A.current,M.transform)){const B=Tt(M.transform);A.current=B,clearTimeout(b.current),b.current=setTimeout(()=>{F?.(B),n?.(M.sourceEvent,B)},s?150:0)}})},[D,s,d,n,r]),T.useEffect(()=>{D&&D.filter(M=>{const F=R||o,B=i&&M.ctrlKey;if((d===!0||Array.isArray(d)&&d.includes(1))&&M.button===1&&M.type==="mousedown"&&(nt(M,"react-flow__node")||nt(M,"react-flow__edge")))return!0;if(!d&&!F&&!s&&!l&&!i||w||!l&&M.type==="dblclick"||nt(M,E)&&M.type==="wheel"||nt(M,v)&&(M.type!=="wheel"||s&&M.type==="wheel"&&!R)||!i&&M.ctrlKey&&M.type==="wheel"||!F&&!s&&!B&&M.type==="wheel"||!d&&(M.type==="mousedown"||M.type==="touchstart")||Array.isArray(d)&&!d.includes(M.button)&&M.type==="mousedown")return!1;const G=Array.isArray(d)&&d.includes(M.button)||!M.button||M.button<=1;return(!M.ctrlKey||M.type==="wheel")&&G})},[w,D,o,i,s,l,d,u,R]),P.createElement("div",{className:"react-flow__renderer",ref:k,style:qo},y)},xp=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Sp(){const{userSelectionActive:e,userSelectionRect:t}=re(xp,ue);return e&&t?P.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function ci(e,t){const n=t.parentNode||t.parentId,r=e.find(o=>o.id===n);if(r){const o=t.position.x+t.width-r.width,i=t.position.y+t.height-r.height;if(o>0||i>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,o>0&&(r.style.width+=o),i>0&&(r.style.height+=i),t.position.x<0){const s=Math.abs(t.position.x);r.position.x=r.position.x-s,r.style.width+=s,t.position.x=0}if(t.position.y<0){const s=Math.abs(t.position.y);r.position.y=r.position.y-s,r.style.height+=s,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function fu(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,o)=>{const i=e.filter(a=>a.id===o.id);if(i.length===0)return r.push(o),r;const s={...o};for(const a of i)if(a)switch(a.type){case"select":{s.selected=a.selected;break}case"position":{typeof a.position<"u"&&(s.position=a.position),typeof a.positionAbsolute<"u"&&(s.positionAbsolute=a.positionAbsolute),typeof a.dragging<"u"&&(s.dragging=a.dragging),s.expandParent&&ci(r,s);break}case"dimensions":{typeof a.dimensions<"u"&&(s.width=a.dimensions.width,s.height=a.dimensions.height),typeof a.updateStyle<"u"&&(s.style={...s.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(s.resizing=a.resizing),s.expandParent&&ci(r,s);break}case"remove":return r}return r.push(s),r},n)}function hu(e,t){return fu(e,t)}function Np(e,t){return fu(e,t)}const Te=(e,t)=>({id:e,type:"select",selected:t});function ot(e,t){return e.reduce((n,r)=>{const o=t.includes(r.id);return!r.selected&&o?(r.selected=!0,n.push(Te(r.id,!0))):r.selected&&!o&&(r.selected=!1,n.push(Te(r.id,!1))),n},[])}const dn=(e,t)=>n=>{n.target===t.current&&e?.(n)},Cp=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),pu=T.memo(({isSelecting:e,selectionMode:t=St.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:o,onPaneClick:i,onPaneContextMenu:s,onPaneScroll:a,onPaneMouseEnter:c,onPaneMouseMove:l,onPaneMouseLeave:u,children:d})=>{const f=T.useRef(null),h=ae(),_=T.useRef(0),m=T.useRef(0),g=T.useRef(),{userSelectionActive:p,elementsSelectable:y,dragging:E}=re(Cp,ue),v=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,m.current=0},b=L=>{i?.(L),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},x=L=>{if(Array.isArray(n)&&n?.includes(2)){L.preventDefault();return}s?.(L)},C=a?L=>a(L):void 0,q=L=>{const{resetSelectedElements:w,domNode:R}=h.getState();if(g.current=R?.getBoundingClientRect(),!y||!e||L.button!==0||L.target!==f.current||!g.current)return;const{x:N,y:O}=De(L,g.current);w(),h.setState({userSelectionRect:{width:0,height:0,startX:N,startY:O,x:N,y:O}}),r?.(L)},k=L=>{const{userSelectionRect:w,nodeInternals:R,edges:N,transform:O,onNodesChange:H,onEdgesChange:M,nodeOrigin:F,getNodes:B}=h.getState();if(!e||!g.current||!w)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=De(L,g.current),U=w.startX??0,S=w.startY??0,I={...w,x:G.xK.id),W=V.map(K=>K.id);if(_.current!==W.length){_.current=W.length;const K=ot(z,W);K.length&&H?.(K)}if(m.current!==Y.length){m.current=Y.length;const K=ot(N,Y);K.length&&M?.(K)}h.setState({userSelectionRect:I})},A=L=>{if(L.button!==0)return;const{userSelectionRect:w}=h.getState();!p&&w&&L.target===f.current&&b?.(L),h.setState({nodesSelectionActive:_.current>0}),v(),o?.(L)},D=L=>{p&&(h.setState({nodesSelectionActive:_.current>0}),o?.(L)),v()},$=y&&(e||p);return P.createElement("div",{className:ce(["react-flow__pane",{dragging:E,selection:e}]),onClick:$?void 0:dn(b,f),onContextMenu:dn(x,f),onWheel:dn(C,f),onMouseEnter:$?void 0:c,onMouseDown:$?q:void 0,onMouseMove:$?k:l,onMouseUp:$?A:void 0,onMouseLeave:$?D:u,ref:f,style:qo},d,P.createElement(Sp,null))});pu.displayName="Pane";function gu(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:gu(r,t):!1}function li(e,t,n){let r=e;do{if(r?.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function kp(e,t,n,r){return Array.from(e.values()).filter(o=>(o.selected||o.id===r)&&(!o.parentNode||o.parentId||!gu(o,e))&&(o.draggable||t&&typeof o.draggable>"u")).map(o=>({id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:n.x-(o.positionAbsolute?.x??0),y:n.y-(o.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode||o.parentId,parentId:o.parentNode||o.parentId,width:o.width,height:o.height,expandParent:o.expandParent}))}function Rp(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function mu(e,t,n,r,o=[0,0],i){const s=Rp(e,e.extent||r);let a=s;const c=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(c&&e.width&&e.height){const d=n.get(c),{x:f,y:h}=Ge(d,o).positionAbsolute;a=d&&me(f)&&me(h)&&me(d.width)&&me(d.height)?[[f+e.width*o[0],h+e.height*o[1]],[f+d.width-e.width+e.width*o[0],h+d.height-e.height+e.height*o[1]]]:a}else i?.("005",Ie.error005()),a=s;else if(e.extent&&c&&e.extent!=="parent"){const d=n.get(c),{x:f,y:h}=Ge(d,o).positionAbsolute;a=[[e.extent[0][0]+f,e.extent[0][1]+h],[e.extent[1][0]+f,e.extent[1][1]+h]]}let l={x:0,y:0};if(c){const d=n.get(c);l=Ge(d,o).positionAbsolute}const u=a&&a!=="parent"?So(t,a):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function fn({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(o=>({...n.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?r.find(o=>o.id===e):r[0],r]}const di=(e,t,n,r)=>{const o=t.querySelectorAll(e);if(!o||!o.length)return null;const i=Array.from(o),s=t.getBoundingClientRect(),a={x:s.width*r[0],y:s.height*r[1]};return i.map(c=>{const l=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(l.left-s.left-a.x)/n,y:(l.top-s.top-a.y)/n,...xo(c)}})};function mt(e,t,n){return n===void 0?n:r=>{const o=t().nodeInternals.get(e);o&&n(r,{...o})}}function ao({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeInternals:a,onError:c}=t.getState(),l=a.get(e);if(!l){c?.("012",Ie.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(i({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):o([e])}function Ap(){const e=ae();return T.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:o,snapToGrid:i}=e.getState(),s=n.touches?n.touches[0].clientX:n.clientX,a=n.touches?n.touches[0].clientY:n.clientY,c={x:(s-r[0])/r[2],y:(a-r[1])/r[2]};return{xSnapped:i?o[0]*Math.round(c.x/o[0]):c.x,ySnapped:i?o[1]*Math.round(c.y/o[1]):c.y,...c}},[])}function hn(e){return(t,n,r)=>e?.(t,r)}function vu({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,selectNodesOnDrag:s}){const a=ae(),[c,l]=T.useState(!1),u=T.useRef([]),d=T.useRef({x:null,y:null}),f=T.useRef(0),h=T.useRef(null),_=T.useRef({x:0,y:0}),m=T.useRef(null),g=T.useRef(!1),p=T.useRef(!1),y=T.useRef(!1),E=Ap();return T.useEffect(()=>{if(e?.current){const v=ge(e.current),b=({x:q,y:k})=>{const{nodeInternals:A,onNodeDrag:D,onSelectionDrag:$,updateNodePositions:L,nodeExtent:w,snapGrid:R,snapToGrid:N,nodeOrigin:O,onError:H}=a.getState();d.current={x:q,y:k};let M=!1,F={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&w){const G=tn(u.current,O);F=xt(G)}if(u.current=u.current.map(G=>{const U={x:q-G.distance.x,y:k-G.distance.y};N&&(U.x=R[0]*Math.round(U.x/R[0]),U.y=R[1]*Math.round(U.y/R[1]));const S=[[w[0][0],w[0][1]],[w[1][0],w[1][1]]];u.current.length>1&&w&&!G.extent&&(S[0][0]=G.positionAbsolute.x-F.x+w[0][0],S[1][0]=G.positionAbsolute.x+(G.width??0)-F.x2+w[1][0],S[0][1]=G.positionAbsolute.y-F.y+w[0][1],S[1][1]=G.positionAbsolute.y+(G.height??0)-F.y2+w[1][1]);const I=mu(G,U,A,S,O,H);return M=M||G.position.x!==I.position.x||G.position.y!==I.position.y,G.position=I.position,G.positionAbsolute=I.positionAbsolute,G}),!M)return;L(u.current,!0,!0),l(!0);const B=o?D:hn($);if(B&&m.current){const[G,U]=fn({nodeId:o,dragItems:u.current,nodeInternals:A});B(m.current,G,U)}},x=()=>{if(!h.current)return;const[q,k]=La(_.current,h.current);if(q!==0||k!==0){const{transform:A,panBy:D}=a.getState();d.current.x=(d.current.x??0)-q/A[2],d.current.y=(d.current.y??0)-k/A[2],D({x:q,y:k})&&b(d.current)}f.current=requestAnimationFrame(x)},C=q=>{const{nodeInternals:k,multiSelectionActive:A,nodesDraggable:D,unselectNodesAndEdges:$,onNodeDragStart:L,onSelectionDragStart:w}=a.getState();p.current=!0;const R=o?L:hn(w);(!s||!i)&&!A&&o&&(k.get(o)?.selected||$()),o&&i&&s&&ao({id:o,store:a,nodeRef:e});const N=E(q);if(d.current=N,u.current=kp(k,D,N,o),R&&u.current){const[O,H]=fn({nodeId:o,dragItems:u.current,nodeInternals:k});R(q.sourceEvent,O,H)}};if(t)v.on(".drag",null);else{const q=ff().on("start",k=>{const{domNode:A,nodeDragThreshold:D}=a.getState();D===0&&C(k),y.current=!1;const $=E(k);d.current=$,h.current=A?.getBoundingClientRect()||null,_.current=De(k.sourceEvent,h.current)}).on("drag",k=>{const A=E(k),{autoPanOnNodeDrag:D,nodeDragThreshold:$}=a.getState();if(k.sourceEvent.type==="touchmove"&&k.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!g.current&&p.current&&D&&(g.current=!0,x()),!p.current){const L=A.xSnapped-(d?.current?.x??0),w=A.ySnapped-(d?.current?.y??0);Math.sqrt(L*L+w*w)>$&&C(k)}(d.current.x!==A.xSnapped||d.current.y!==A.ySnapped)&&u.current&&p.current&&(m.current=k.sourceEvent,_.current=De(k.sourceEvent,h.current),b(A))}}).on("end",k=>{if(!(!p.current||y.current)&&(l(!1),g.current=!1,p.current=!1,cancelAnimationFrame(f.current),u.current)){const{updateNodePositions:A,nodeInternals:D,onNodeDragStop:$,onSelectionDragStop:L}=a.getState(),w=o?$:hn(L);if(A(u.current,!1,!1),w){const[R,N]=fn({nodeId:o,dragItems:u.current,nodeInternals:D});w(k.sourceEvent,R,N)}}}).filter(k=>{const A=k.target;return!k.button&&(!n||!li(A,`.${n}`,e))&&(!r||li(A,r,e))});return v.call(q),()=>{v.on(".drag",null)}}}},[e,t,n,r,i,a,o,s,E]),c}function yu(){const e=ae();return T.useCallback(n=>{const{nodeInternals:r,nodeExtent:o,updateNodePositions:i,getNodes:s,snapToGrid:a,snapGrid:c,onError:l,nodesDraggable:u}=e.getState(),d=s().filter(y=>y.selected&&(y.draggable||u&&typeof y.draggable>"u")),f=a?c[0]:5,h=a?c[1]:5,_=n.isShiftPressed?4:1,m=n.x*f*_,g=n.y*h*_,p=d.map(y=>{if(y.positionAbsolute){const E={x:y.positionAbsolute.x+m,y:y.positionAbsolute.y+g};a&&(E.x=c[0]*Math.round(E.x/c[0]),E.y=c[1]*Math.round(E.y/c[1]));const{positionAbsolute:v,position:b}=mu(y,E,r,o,void 0,l);y.position=b,y.positionAbsolute=v}return y});i(p,!0,!1)},[])}const st={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var vt=e=>{const t=({id:n,type:r,data:o,xPos:i,yPos:s,xPosOrigin:a,yPosOrigin:c,selected:l,onClick:u,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:_,onDoubleClick:m,style:g,className:p,isDraggable:y,isSelectable:E,isConnectable:v,isFocusable:b,selectNodesOnDrag:x,sourcePosition:C,targetPosition:q,hidden:k,resizeObserver:A,dragHandle:D,zIndex:$,isParent:L,noDragClassName:w,noPanClassName:R,initialized:N,disableKeyboardA11y:O,ariaLabel:H,rfId:M,hasHandleBounds:F})=>{const B=ae(),G=T.useRef(null),U=T.useRef(null),S=T.useRef(C),I=T.useRef(q),z=T.useRef(r),V=E||y||u||d||f||h,Y=yu(),W=mt(n,B.getState,d),K=mt(n,B.getState,f),ee=mt(n,B.getState,h),ie=mt(n,B.getState,_),te=mt(n,B.getState,m),Q=J=>{const{nodeDragThreshold:Z}=B.getState();if(E&&(!x||!y||Z>0)&&ao({id:n,store:B,nodeRef:G}),u){const fe=B.getState().nodeInternals.get(n);fe&&u(J,{...fe})}},ne=J=>{if(!no(J)&&!O)if(Ha.includes(J.key)&&E){const Z=J.key==="Escape";ao({id:n,store:B,unselect:Z,nodeRef:G})}else y&&l&&Object.prototype.hasOwnProperty.call(st,J.key)&&(B.setState({ariaLiveMessage:`Moved selected node ${J.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~s}`}),Y({x:st[J.key].x,y:st[J.key].y,isShiftPressed:J.shiftKey}))};T.useEffect(()=>()=>{U.current&&(A?.unobserve(U.current),U.current=null)},[]),T.useEffect(()=>{if(G.current&&!k){const J=G.current;(!N||!F||U.current!==J)&&(U.current&&A?.unobserve(U.current),A?.observe(J),U.current=J)}},[k,N,F]),T.useEffect(()=>{const J=z.current!==r,Z=S.current!==C,fe=I.current!==q;G.current&&(J||Z||fe)&&(J&&(z.current=r),Z&&(S.current=C),fe&&(I.current=q),B.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,r,C,q]);const le=vu({nodeRef:G,disabled:k||!y,noDragClassName:w,handleSelector:D,nodeId:n,isSelectable:E,selectNodesOnDrag:x});return k?null:P.createElement("div",{className:ce(["react-flow__node",`react-flow__node-${r}`,{[R]:y},p,{selected:l,selectable:E,parent:L,dragging:le}]),ref:G,style:{zIndex:$,transform:`translate(${a}px,${c}px)`,pointerEvents:V?"all":"none",visibility:N?"visible":"hidden",...g},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:W,onMouseMove:K,onMouseLeave:ee,onContextMenu:ie,onClick:Q,onDoubleClick:te,onKeyDown:b?ne:void 0,tabIndex:b?0:void 0,role:b?"button":void 0,"aria-describedby":O?void 0:`${au}-${M}`,"aria-label":H},P.createElement(Bh,{value:n},P.createElement(e,{id:n,data:o,type:r,xPos:i,yPos:s,selected:l,isConnectable:v,sourcePosition:C,targetPosition:q,dragging:le,dragHandle:D,zIndex:$})))};return t.displayName="NodeWrapper",T.memo(t)};const Mp=e=>{const t=e.getNodes().filter(n=>n.selected);return{...tn(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function Ip({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=ae(),{width:o,height:i,x:s,y:a,transformString:c,userSelectionActive:l}=re(Mp,ue),u=yu(),d=T.useRef(null);if(T.useEffect(()=>{n||d.current?.focus({preventScroll:!0})},[n]),vu({nodeRef:d}),l||!o||!i)return null;const f=e?_=>{const m=r.getState().getNodes().filter(g=>g.selected);e(_,m)}:void 0,h=_=>{Object.prototype.hasOwnProperty.call(st,_.key)&&u({x:st[_.key].x,y:st[_.key].y,isShiftPressed:_.shiftKey})};return P.createElement("div",{className:ce(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c}},P.createElement("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:o,height:i,top:a,left:s}}))}var qp=T.memo(Ip);const Tp=e=>e.nodesSelectionActive,wu=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,deleteKeyCode:a,onMove:c,onMoveStart:l,onMoveEnd:u,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:_,onSelectionEnd:m,multiSelectionKeyCode:g,panActivationKeyCode:p,zoomActivationKeyCode:y,elementsSelectable:E,zoomOnScroll:v,zoomOnPinch:b,panOnScroll:x,panOnScrollSpeed:C,panOnScrollMode:q,zoomOnDoubleClick:k,panOnDrag:A,defaultViewport:D,translateExtent:$,minZoom:L,maxZoom:w,preventScrolling:R,onSelectionContextMenu:N,noWheelClassName:O,noPanClassName:H,disableKeyboardA11y:M})=>{const F=re(Tp),B=Nt(d),G=Nt(p),U=G||A,S=G||x,I=B||f&&U!==!0;return yp({deleteKeyCode:a,multiSelectionKeyCode:g}),P.createElement(bp,{onMove:c,onMoveStart:l,onMoveEnd:u,onPaneContextMenu:i,elementsSelectable:E,zoomOnScroll:v,zoomOnPinch:b,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:q,zoomOnDoubleClick:k,panOnDrag:!B&&U,defaultViewport:D,translateExtent:$,minZoom:L,maxZoom:w,zoomActivationKeyCode:y,preventScrolling:R,noWheelClassName:O,noPanClassName:H},P.createElement(pu,{onSelectionStart:_,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:U,isSelecting:!!I,selectionMode:h},e,F&&P.createElement(qp,{onSelectionContextMenu:N,noPanClassName:H,disableKeyboardA11y:M})))};wu.displayName="FlowRenderer";var Pp=T.memo(wu);function Dp(e){return re(T.useCallback(n=>e?Za(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function zp(e){const t={input:vt(e.input||ru),default:vt(e.default||so),output:vt(e.output||iu),group:vt(e.group||Mo)},n={},r=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,i)=>(o[i]=vt(e[i]||so),o),n);return{...t,...r}}const Lp=({x:e,y:t,width:n,height:r,origin:o})=>!n||!r?{x:e,y:t}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:t}:{x:e-n*o[0],y:t-r*o[1]},$p=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),_u=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,updateNodeDimensions:i,onError:s}=re($p,ue),a=Dp(e.onlyRenderVisibleElements),c=T.useRef(),l=T.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const u=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));i(f)});return c.current=u,u},[]);return T.useEffect(()=>()=>{c?.current?.disconnect()},[]),P.createElement("div",{className:"react-flow__nodes",style:qo},a.map(u=>{let d=u.type||"default";e.nodeTypes[d]||(s?.("003",Ie.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(u.draggable||t&&typeof u.draggable>"u"),_=!!(u.selectable||o&&typeof u.selectable>"u"),m=!!(u.connectable||n&&typeof u.connectable>"u"),g=!!(u.focusable||r&&typeof u.focusable>"u"),p=e.nodeExtent?So(u.positionAbsolute,e.nodeExtent):u.positionAbsolute,y=p?.x??0,E=p?.y??0,v=Lp({x:y,y:E,width:u.width??0,height:u.height??0,origin:e.nodeOrigin});return P.createElement(f,{key:u.id,id:u.id,className:u.className,style:u.style,type:d,data:u.data,sourcePosition:u.sourcePosition||X.Bottom,targetPosition:u.targetPosition||X.Top,hidden:u.hidden,xPos:y,yPos:E,xPosOrigin:v.x,yPosOrigin:v.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!u.selected,isDraggable:h,isSelectable:_,isConnectable:m,isFocusable:g,resizeObserver:l,dragHandle:u.dragHandle,zIndex:u[se]?.z??0,isParent:!!u[se]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!u.width&&!!u.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:u.ariaLabel,hasHandleBounds:!!u[se]?.handleBounds})}))};_u.displayName="NodeRenderer";var Op=T.memo(_u);const Fp=(e,t,n)=>n===X.Left?e-t:n===X.Right?e+t:e,Hp=(e,t,n)=>n===X.Top?e-t:n===X.Bottom?e+t:e,fi="react-flow__edgeupdater",hi=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:a})=>P.createElement("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:ce([fi,`${fi}-${a}`]),cx:Fp(t,r,e),cy:Hp(n,r,e),r,stroke:"transparent",fill:"transparent"}),Vp=()=>!0;var rt=e=>{const t=({id:n,className:r,type:o,data:i,onClick:s,onEdgeDoubleClick:a,selected:c,animated:l,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:m,style:g,source:p,target:y,sourceX:E,sourceY:v,targetX:b,targetY:x,sourcePosition:C,targetPosition:q,elementsSelectable:k,hidden:A,sourceHandleId:D,targetHandleId:$,onContextMenu:L,onMouseEnter:w,onMouseMove:R,onMouseLeave:N,reconnectRadius:O,onReconnect:H,onReconnectStart:M,onReconnectEnd:F,markerEnd:B,markerStart:G,rfId:U,ariaLabel:S,isFocusable:I,isReconnectable:z,pathOptions:V,interactionWidth:Y,disableKeyboardA11y:W})=>{const K=T.useRef(null),[ee,ie]=T.useState(!1),[te,Q]=T.useState(!1),ne=ae(),le=T.useMemo(()=>`url('#${oo(G,U)}')`,[G,U]),J=T.useMemo(()=>`url('#${oo(B,U)}')`,[B,U]);if(A)return null;const Z=de=>{const{edges:be,addSelectedEdges:$e,unselectNodesAndEdges:Oe,multiSelectionActive:Je}=ne.getState(),xe=be.find(Fe=>Fe.id===n);xe&&(k&&(ne.setState({nodesSelectionActive:!1}),xe.selected&&Je?(Oe({nodes:[],edges:[xe]}),K.current?.blur()):$e([n])),s&&s(de,xe))},fe=gt(n,ne.getState,a),Ne=gt(n,ne.getState,L),lt=gt(n,ne.getState,w),Ze=gt(n,ne.getState,R),Xe=gt(n,ne.getState,N),Ce=(de,be)=>{if(de.button!==0)return;const{edges:$e,isValidConnection:Oe}=ne.getState(),Je=be?y:p,xe=(be?$:D)||null,Fe=be?"target":"source",nn=Oe||Vp,rn=be,ft=$e.find(He=>He.id===n);Q(!0),M?.(de,ft,Fe);const on=He=>{Q(!1),F?.(He,ft,Fe)};Ja({event:de,handleId:xe,nodeId:Je,onConnect:He=>H?.(ft,He),isTarget:rn,getState:ne.getState,setState:ne.setState,isValidConnection:nn,edgeUpdaterType:Fe,onReconnectEnd:on})},Ke=de=>Ce(de,!0),ze=de=>Ce(de,!1),Le=()=>ie(!0),je=()=>ie(!1),Qe=!k&&!s,dt=de=>{if(!W&&Ha.includes(de.key)&&k){const{unselectNodesAndEdges:be,addSelectedEdges:$e,edges:Oe}=ne.getState();de.key==="Escape"?(K.current?.blur(),be({edges:[Oe.find(xe=>xe.id===n)]})):$e([n])}};return P.createElement("g",{className:ce(["react-flow__edge",`react-flow__edge-${o}`,r,{selected:c,animated:l,inactive:Qe,updating:ee}]),onClick:Z,onDoubleClick:fe,onContextMenu:Ne,onMouseEnter:lt,onMouseMove:Ze,onMouseLeave:Xe,onKeyDown:I?dt:void 0,tabIndex:I?0:void 0,role:I?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":S===null?void 0:S||`Edge from ${p} to ${y}`,"aria-describedby":I?`${uu}-${U}`:void 0,ref:K},!te&&P.createElement(e,{id:n,source:p,target:y,selected:c,animated:l,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:m,data:i,style:g,sourceX:E,sourceY:v,targetX:b,targetY:x,sourcePosition:C,targetPosition:q,sourceHandleId:D,targetHandleId:$,markerStart:le,markerEnd:J,pathOptions:V,interactionWidth:Y}),z&&P.createElement(P.Fragment,null,(z==="source"||z===!0)&&P.createElement(hi,{position:C,centerX:E,centerY:v,radius:O,onMouseDown:Ke,onMouseEnter:Le,onMouseOut:je,type:"source"}),(z==="target"||z===!0)&&P.createElement(hi,{position:q,centerX:b,centerY:x,radius:O,onMouseDown:ze,onMouseEnter:Le,onMouseOut:je,type:"target"})))};return t.displayName="EdgeWrapper",T.memo(t)};function Bp(e){const t={default:rt(e.default||Gt),straight:rt(e.bezier||ko),step:rt(e.step||Co),smoothstep:rt(e.step||en),simplebezier:rt(e.simplebezier||No)},n={},r=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,i)=>(o[i]=rt(e[i]||Gt),o),n);return{...t,...r}}function pi(e,t,n=null){const r=(n?.x||0)+t.x,o=(n?.y||0)+t.y,i=n?.width||t.width,s=n?.height||t.height;switch(e){case X.Top:return{x:r+i/2,y:o};case X.Right:return{x:r+i,y:o+s/2};case X.Bottom:return{x:r+i/2,y:o+s};case X.Left:return{x:r,y:o+s/2}}}function gi(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const Gp=(e,t,n,r,o,i)=>{const s=pi(n,e,t),a=pi(i,r,o);return{sourceX:s.x,sourceY:s.y,targetX:a.x,targetY:a.y}};function Up({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:o,targetHeight:i,width:s,height:a,transform:c}){const l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+o),y2:Math.max(e.y+r,t.y+i)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const u=xt({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:s/c[2],height:a/c[2]}),d=Math.max(0,Math.min(u.x2,l.x2)-Math.max(u.x,l.x)),f=Math.max(0,Math.min(u.y2,l.y2)-Math.max(u.y,l.y));return Math.ceil(d*f)>0}function mi(e){const t=e?.[se]?.handleBounds||null,n=t&&e?.width&&e?.height&&typeof e?.positionAbsolute?.x<"u"&&typeof e?.positionAbsolute?.y<"u";return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!n]}const Yp=[{level:0,isMaxLevel:!0,edges:[]}];function Wp(e,t,n=!1){let r=-1;const o=e.reduce((s,a)=>{const c=me(a.zIndex);let l=c?a.zIndex:0;if(n){const u=t.get(a.target),d=t.get(a.source),f=a.selected||u?.selected||d?.selected,h=Math.max(d?.[se]?.z||0,u?.[se]?.z||0,1e3);l=(c?a.zIndex:0)+(f?h:0)}return s[l]?s[l].push(a):s[l]=[a],r=l>r?l:r,s},{}),i=Object.entries(o).map(([s,a])=>{const c=+s;return{edges:a,level:c,isMaxLevel:c===r}});return i.length===0?Yp:i}function Zp(e,t,n){const r=re(T.useCallback(o=>e?o.edges.filter(i=>{const s=t.get(i.source),a=t.get(i.target);return s?.width&&s?.height&&a?.width&&a?.height&&Up({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,t]));return Wp(r,t,n)}const Xp=({color:e="none",strokeWidth:t=1})=>P.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),Kp=({color:e="none",strokeWidth:t=1})=>P.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),vi={[Bt.Arrow]:Xp,[Bt.ArrowClosed]:Kp};function jp(e){const t=ae();return T.useMemo(()=>Object.prototype.hasOwnProperty.call(vi,e)?vi[e]:(t.getState().onError?.("009",Ie.error009(e)),null),[e])}const Qp=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const c=jp(t);return c?P.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0"},P.createElement(c,{color:n,strokeWidth:s})):null},Jp=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((o,i)=>([i.markerStart,i.markerEnd].forEach(s=>{if(s&&typeof s=="object"){const a=oo(s,t);r.includes(a)||(o.push({id:a,color:s.color||e,...s}),r.push(a))}}),o),[]).sort((o,i)=>o.id.localeCompare(i.id))},Eu=({defaultColor:e,rfId:t})=>{const n=re(T.useCallback(Jp({defaultColor:e,rfId:t}),[e,t]),(r,o)=>!(r.length!==o.length||r.some((i,s)=>i.id!==o[s].id)));return P.createElement("defs",null,n.map(r=>P.createElement(Qp,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};Eu.displayName="MarkerDefinitions";var eg=T.memo(Eu);const tg=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),bu=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:o,noPanClassName:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:m,children:g,disableKeyboardA11y:p})=>{const{edgesFocusable:y,edgesUpdatable:E,elementsSelectable:v,width:b,height:x,connectionMode:C,nodeInternals:q,onError:k}=re(tg,ue),A=Zp(t,q,n);return b?P.createElement(P.Fragment,null,A.map(({level:D,edges:$,isMaxLevel:L})=>P.createElement("svg",{key:D,style:{zIndex:D},width:b,height:x,className:"react-flow__edges react-flow__container"},L&&P.createElement(eg,{defaultColor:e,rfId:r}),P.createElement("g",null,$.map(w=>{const[R,N,O]=mi(q.get(w.source)),[H,M,F]=mi(q.get(w.target));if(!O||!F)return null;let B=w.type||"default";o[B]||(k?.("011",Ie.error011(B)),B="default");const G=o[B]||o.default,U=C===Ye.Strict?M.target:(M.target??[]).concat(M.source??[]),S=gi(N.source,w.sourceHandle),I=gi(U,w.targetHandle),z=S?.position||X.Bottom,V=I?.position||X.Top,Y=!!(w.focusable||y&&typeof w.focusable>"u"),W=w.reconnectable||w.updatable,K=typeof f<"u"&&(W||E&&typeof W>"u");if(!S||!I)return k?.("008",Ie.error008(S,w)),null;const{sourceX:ee,sourceY:ie,targetX:te,targetY:Q}=Gp(R,S,z,H,I,V);return P.createElement(G,{key:w.id,id:w.id,className:ce([w.className,i]),type:B,data:w.data,selected:!!w.selected,animated:!!w.animated,hidden:!!w.hidden,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,style:w.style,source:w.source,target:w.target,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerEnd:w.markerEnd,markerStart:w.markerStart,sourceX:ee,sourceY:ie,targetX:te,targetY:Q,sourcePosition:z,targetPosition:V,elementsSelectable:v,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,onClick:u,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:m,rfId:r,ariaLabel:w.ariaLabel,isFocusable:Y,isReconnectable:K,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth,disableKeyboardA11y:p})})))),g):null};bu.displayName="EdgeRenderer";var ng=T.memo(bu);const rg=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function og({children:e}){const t=re(rg);return P.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function ig(e){const t=Io(),n=T.useRef(!1);T.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const sg={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},xu=({nodeId:e,handleType:t,style:n,type:r=Pe.Bezier,CustomComponent:o,connectionStatus:i})=>{const{fromNode:s,handleId:a,toX:c,toY:l,connectionMode:u}=re(T.useCallback(x=>({fromNode:x.nodeInternals.get(e),handleId:x.connectionHandleId,toX:(x.connectionPosition.x-x.transform[0])/x.transform[2],toY:(x.connectionPosition.y-x.transform[1])/x.transform[2],connectionMode:x.connectionMode}),[e]),ue),d=s?.[se]?.handleBounds;let f=d?.[t];if(u===Ye.Loose&&(f=f||d?.[t==="source"?"target":"source"]),!s||!f)return null;const h=a?f.find(x=>x.id===a):f[0],_=h?h.x+h.width/2:(s.width??0)/2,m=h?h.y+h.height/2:s.height??0,g=(s.positionAbsolute?.x??0)+_,p=(s.positionAbsolute?.y??0)+m,y=h?.position,E=y?sg[y]:null;if(!y||!E)return null;if(o)return P.createElement(o,{connectionLineType:r,connectionLineStyle:n,fromNode:s,fromHandle:h,fromX:g,fromY:p,toX:c,toY:l,fromPosition:y,toPosition:E,connectionStatus:i});let v="";const b={sourceX:g,sourceY:p,sourcePosition:y,targetX:c,targetY:l,targetPosition:E};return r===Pe.Bezier?[v]=Ya(b):r===Pe.Step?[v]=ro({...b,borderRadius:0}):r===Pe.SmoothStep?[v]=ro(b):r===Pe.SimpleBezier?[v]=Ua(b):v=`M${g},${p} ${c},${l}`,P.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};xu.displayName="ConnectionLine";const ag=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function ug({containerStyle:e,style:t,type:n,component:r}){const{nodeId:o,handleType:i,nodesConnectable:s,width:a,height:c,connectionStatus:l}=re(ag,ue);return!(o&&i&&a&&s)?null:P.createElement("svg",{style:e,width:a,height:c,className:"react-flow__edges react-flow__connectionline react-flow__container"},P.createElement("g",{className:ce(["react-flow__connection",l])},P.createElement(xu,{nodeId:o,handleType:i,style:t,type:n,CustomComponent:r,connectionStatus:l})))}function yi(e,t){return T.useRef(null),ae(),T.useMemo(()=>t(e),[e])}const Su=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:o,onInit:i,onNodeClick:s,onEdgeClick:a,onNodeDoubleClick:c,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:_,onSelectionStart:m,onSelectionEnd:g,connectionLineType:p,connectionLineStyle:y,connectionLineComponent:E,connectionLineContainerStyle:v,selectionKeyCode:b,selectionOnDrag:x,selectionMode:C,multiSelectionKeyCode:q,panActivationKeyCode:k,zoomActivationKeyCode:A,deleteKeyCode:D,onlyRenderVisibleElements:$,elementsSelectable:L,selectNodesOnDrag:w,defaultViewport:R,translateExtent:N,minZoom:O,maxZoom:H,preventScrolling:M,defaultMarkerColor:F,zoomOnScroll:B,zoomOnPinch:G,panOnScroll:U,panOnScrollSpeed:S,panOnScrollMode:I,zoomOnDoubleClick:z,panOnDrag:V,onPaneClick:Y,onPaneMouseEnter:W,onPaneMouseMove:K,onPaneMouseLeave:ee,onPaneScroll:ie,onPaneContextMenu:te,onEdgeContextMenu:Q,onEdgeMouseEnter:ne,onEdgeMouseMove:le,onEdgeMouseLeave:J,onReconnect:Z,onReconnectStart:fe,onReconnectEnd:Ne,reconnectRadius:lt,noDragClassName:Ze,noWheelClassName:Xe,noPanClassName:Ce,elevateEdgesOnSelect:Ke,disableKeyboardA11y:ze,nodeOrigin:Le,nodeExtent:je,rfId:Qe})=>{const dt=yi(e,zp),de=yi(t,Bp);return ig(i),P.createElement(Pp,{onPaneClick:Y,onPaneMouseEnter:W,onPaneMouseMove:K,onPaneMouseLeave:ee,onPaneContextMenu:te,onPaneScroll:ie,deleteKeyCode:D,selectionKeyCode:b,selectionOnDrag:x,selectionMode:C,onSelectionStart:m,onSelectionEnd:g,multiSelectionKeyCode:q,panActivationKeyCode:k,zoomActivationKeyCode:A,elementsSelectable:L,onMove:n,onMoveStart:r,onMoveEnd:o,zoomOnScroll:B,zoomOnPinch:G,zoomOnDoubleClick:z,panOnScroll:U,panOnScrollSpeed:S,panOnScrollMode:I,panOnDrag:V,defaultViewport:R,translateExtent:N,minZoom:O,maxZoom:H,onSelectionContextMenu:_,preventScrolling:M,noDragClassName:Ze,noWheelClassName:Xe,noPanClassName:Ce,disableKeyboardA11y:ze},P.createElement(og,null,P.createElement(ng,{edgeTypes:de,onEdgeClick:a,onEdgeDoubleClick:l,onlyRenderVisibleElements:$,onEdgeContextMenu:Q,onEdgeMouseEnter:ne,onEdgeMouseMove:le,onEdgeMouseLeave:J,onReconnect:Z,onReconnectStart:fe,onReconnectEnd:Ne,reconnectRadius:lt,defaultMarkerColor:F,noPanClassName:Ce,elevateEdgesOnSelect:!!Ke,disableKeyboardA11y:ze,rfId:Qe},P.createElement(ug,{style:y,type:p,component:E,containerStyle:v})),P.createElement("div",{className:"react-flow__edgelabel-renderer"}),P.createElement(Op,{nodeTypes:dt,onNodeClick:s,onNodeDoubleClick:c,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:w,onlyRenderVisibleElements:$,noPanClassName:Ce,noDragClassName:Ze,disableKeyboardA11y:ze,nodeOrigin:Le,nodeExtent:je,rfId:Qe})))};Su.displayName="GraphView";var cg=T.memo(Su);const uo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],qe={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:uo,nodeExtent:uo,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ye.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Lh,isValidConnection:void 0},lg=()=>xl((e,t)=>({...qe,setNodes:n=>{const{nodeInternals:r,nodeOrigin:o,elevateNodesOnSelect:i}=t();e({nodeInternals:ln(n,r,o,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(o=>({...r,...o}))})},setDefaultNodesAndEdges:(n,r)=>{const o=typeof n<"u",i=typeof r<"u",s=o?ln(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:i?r:[],hasDefaultNodes:o,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:o,fitViewOnInit:i,fitViewOnInitDone:s,fitViewOnInitOptions:a,domNode:c,nodeOrigin:l}=t(),u=c?.querySelector(".react-flow__viewport");if(!u)return;const d=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((m,g)=>{const p=o.get(g.id);if(p?.hidden)o.set(p.id,{...p,[se]:{...p[se],handleBounds:void 0}});else if(p){const y=xo(g.nodeElement);!!(y.width&&y.height&&(p.width!==y.width||p.height!==y.height||g.forceUpdate))&&(o.set(p.id,{...p,[se]:{...p[se],handleBounds:{source:di(".source",g.nodeElement,f,l),target:di(".target",g.nodeElement,f,l)}},...y}),m.push({id:p.id,type:"dimensions",dimensions:y}))}return m},[]);lu(o,l);const _=s||i&&!s&&du(t,{initial:!0,...a});e({nodeInternals:new Map(o),fitViewOnInitDone:_}),h?.length>0&&r?.(h)},updateNodePositions:(n,r=!0,o=!1)=>{const{triggerNodeChanges:i}=t(),s=n.map(a=>{const c={id:a.id,type:"position",dragging:o};return r&&(c.positionAbsolute=a.positionAbsolute,c.position=a.position),c});i(s)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:o,hasDefaultNodes:i,nodeOrigin:s,getNodes:a,elevateNodesOnSelect:c}=t();if(n?.length){if(i){const l=hu(n,a()),u=ln(l,o,s,c);e({nodeInternals:u})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:o,getNodes:i}=t();let s,a=null;r?s=n.map(c=>Te(c,!0)):(s=ot(i(),n),a=ot(o,[])),qt({changedNodes:s,changedEdges:a,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:o,getNodes:i}=t();let s,a=null;r?s=n.map(c=>Te(c,!0)):(s=ot(o,n),a=ot(i(),[])),qt({changedNodes:a,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:o,getNodes:i}=t(),s=n||i(),a=r||o,c=s.map(u=>(u.selected=!1,Te(u.id,!1))),l=a.map(u=>Te(u.id,!1));qt({changedNodes:c,changedEdges:l,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:o}=t();r?.scaleExtent([n,o]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:o}=t();r?.scaleExtent([o,n]),e({maxZoom:n})},setTranslateExtent:n=>{t().d3Zoom?.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),i=r().filter(a=>a.selected).map(a=>Te(a.id,!1)),s=n.filter(a=>a.selected).map(a=>Te(a.id,!1));qt({changedNodes:i,changedEdges:s,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(o=>{o.positionAbsolute=So(o.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:o,height:i,d3Zoom:s,d3Selection:a,translateExtent:c}=t();if(!s||!a||!n.x&&!n.y)return!1;const l=Ae.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),u=[[0,0],[o,i]],d=s?.constrain()(l,u,c);return s.transform(a,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:qe.connectionNodeId,connectionHandleId:qe.connectionHandleId,connectionHandleType:qe.connectionHandleType,connectionStatus:qe.connectionStatus,connectionStartHandle:qe.connectionStartHandle,connectionEndHandle:qe.connectionEndHandle}),reset:()=>e({...qe})}),Object.is),Nu=({children:e})=>{const t=T.useRef(null);return t.current||(t.current=lg()),P.createElement(Mh,{value:t.current},e)};Nu.displayName="ReactFlowProvider";const Cu=({children:e})=>T.useContext(Jt)?P.createElement(P.Fragment,null,e):P.createElement(Nu,null,e);Cu.displayName="ReactFlowWrapper";const dg={input:ru,default:so,output:iu,group:Mo},fg={default:Gt,straight:ko,step:Co,smoothstep:en,simplebezier:No},hg=[0,0],pg=[15,15],gg={x:0,y:0,zoom:1},mg={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},vg=T.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i=dg,edgeTypes:s=fg,onNodeClick:a,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:_,onConnectEnd:m,onClickConnectStart:g,onClickConnectEnd:p,onNodeMouseEnter:y,onNodeMouseMove:E,onNodeMouseLeave:v,onNodeContextMenu:b,onNodeDoubleClick:x,onNodeDragStart:C,onNodeDrag:q,onNodeDragStop:k,onNodesDelete:A,onEdgesDelete:D,onSelectionChange:$,onSelectionDragStart:L,onSelectionDrag:w,onSelectionDragStop:R,onSelectionContextMenu:N,onSelectionStart:O,onSelectionEnd:H,connectionMode:M=Ye.Strict,connectionLineType:F=Pe.Bezier,connectionLineStyle:B,connectionLineComponent:G,connectionLineContainerStyle:U,deleteKeyCode:S="Backspace",selectionKeyCode:I="Shift",selectionOnDrag:z=!1,selectionMode:V=St.Full,panActivationKeyCode:Y="Space",multiSelectionKeyCode:W=Vt()?"Meta":"Control",zoomActivationKeyCode:K=Vt()?"Meta":"Control",snapToGrid:ee=!1,snapGrid:ie=pg,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:Q=!0,nodesDraggable:ne,nodesConnectable:le,nodesFocusable:J,nodeOrigin:Z=hg,edgesFocusable:fe,edgesUpdatable:Ne,elementsSelectable:lt,defaultViewport:Ze=gg,minZoom:Xe=.5,maxZoom:Ce=2,translateExtent:Ke=uo,preventScrolling:ze=!0,nodeExtent:Le,defaultMarkerColor:je="#b1b1b7",zoomOnScroll:Qe=!0,zoomOnPinch:dt=!0,panOnScroll:de=!1,panOnScrollSpeed:be=.5,panOnScrollMode:$e=Be.Free,zoomOnDoubleClick:Oe=!0,panOnDrag:Je=!0,onPaneClick:xe,onPaneMouseEnter:Fe,onPaneMouseMove:nn,onPaneMouseLeave:rn,onPaneScroll:ft,onPaneContextMenu:on,children:Do,onEdgeContextMenu:He,onEdgeDoubleClick:Xu,onEdgeMouseEnter:Ku,onEdgeMouseMove:ju,onEdgeMouseLeave:Qu,onEdgeUpdate:Ju,onEdgeUpdateStart:ec,onEdgeUpdateEnd:tc,onReconnect:nc,onReconnectStart:rc,onReconnectEnd:oc,reconnectRadius:ic=10,edgeUpdaterRadius:sc=10,onNodesChange:ac,onEdgesChange:uc,noDragClassName:cc="nodrag",noWheelClassName:lc="nowheel",noPanClassName:zo="nopan",fitView:dc=!1,fitViewOptions:fc,connectOnClick:hc=!0,attributionPosition:pc,proOptions:gc,defaultEdgeOptions:mc,elevateNodesOnSelect:vc=!0,elevateEdgesOnSelect:yc=!1,disableKeyboardA11y:Lo=!1,autoPanOnConnect:wc=!0,autoPanOnNodeDrag:_c=!0,connectionRadius:Ec=20,isValidConnection:bc,onError:xc,style:Sc,id:$o,nodeDragThreshold:Nc,...Cc},kc)=>{const sn=$o||"1";return P.createElement("div",{...Cc,style:{...Sc,...mg},ref:kc,className:ce(["react-flow",o]),"data-testid":"rf__wrapper",id:$o},P.createElement(Cu,null,P.createElement(cg,{onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:E,onNodeMouseLeave:v,onNodeContextMenu:b,onNodeDoubleClick:x,nodeTypes:i,edgeTypes:s,connectionLineType:F,connectionLineStyle:B,connectionLineComponent:G,connectionLineContainerStyle:U,selectionKeyCode:I,selectionOnDrag:z,selectionMode:V,deleteKeyCode:S,multiSelectionKeyCode:W,panActivationKeyCode:Y,zoomActivationKeyCode:K,onlyRenderVisibleElements:te,selectNodesOnDrag:Q,defaultViewport:Ze,translateExtent:Ke,minZoom:Xe,maxZoom:Ce,preventScrolling:ze,zoomOnScroll:Qe,zoomOnPinch:dt,zoomOnDoubleClick:Oe,panOnScroll:de,panOnScrollSpeed:be,panOnScrollMode:$e,panOnDrag:Je,onPaneClick:xe,onPaneMouseEnter:Fe,onPaneMouseMove:nn,onPaneMouseLeave:rn,onPaneScroll:ft,onPaneContextMenu:on,onSelectionContextMenu:N,onSelectionStart:O,onSelectionEnd:H,onEdgeContextMenu:He,onEdgeDoubleClick:Xu,onEdgeMouseEnter:Ku,onEdgeMouseMove:ju,onEdgeMouseLeave:Qu,onReconnect:nc??Ju,onReconnectStart:rc??ec,onReconnectEnd:oc??tc,reconnectRadius:ic??sc,defaultMarkerColor:je,noDragClassName:cc,noWheelClassName:lc,noPanClassName:zo,elevateEdgesOnSelect:yc,rfId:sn,disableKeyboardA11y:Lo,nodeOrigin:Z,nodeExtent:Le}),P.createElement(sp,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:_,onConnectEnd:m,onClickConnectStart:g,onClickConnectEnd:p,nodesDraggable:ne,nodesConnectable:le,nodesFocusable:J,edgesFocusable:fe,edgesUpdatable:Ne,elementsSelectable:lt,elevateNodesOnSelect:vc,minZoom:Xe,maxZoom:Ce,nodeExtent:Le,onNodesChange:ac,onEdgesChange:uc,snapToGrid:ee,snapGrid:ie,connectionMode:M,translateExtent:Ke,connectOnClick:hc,defaultEdgeOptions:mc,fitView:dc,fitViewOptions:fc,onNodesDelete:A,onEdgesDelete:D,onNodeDragStart:C,onNodeDrag:q,onNodeDragStop:k,onSelectionDrag:w,onSelectionDragStart:L,onSelectionDragStop:R,noPanClassName:zo,nodeOrigin:Z,rfId:sn,autoPanOnConnect:wc,autoPanOnNodeDrag:_c,onError:xc,connectionRadius:Ec,isValidConnection:bc,nodeDragThreshold:Nc}),P.createElement(op,{onSelectionChange:$}),Do,P.createElement(qh,{proOptions:gc,position:pc}),P.createElement(dp,{rfId:sn,disableKeyboardA11y:Lo})))});vg.displayName="ReactFlow";function ku(e){return t=>{const[n,r]=T.useState(t),o=T.useCallback(i=>r(s=>e(i,s)),[]);return[n,r,o]}}const jm=ku(hu),Qm=ku(Np),Ru=({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:a,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,onClick:f,selected:h})=>{const{background:_,backgroundColor:m}=i||{},g=s||_||m;return P.createElement("rect",{className:ce(["react-flow__minimap-node",{selected:h},l]),x:t,y:n,rx:u,ry:u,width:r,height:o,fill:g,stroke:a,strokeWidth:c,shapeRendering:d,onClick:f?p=>f(p,e):void 0})};Ru.displayName="MiniMapNode";var yg=T.memo(Ru);const wg=e=>e.nodeOrigin,_g=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),pn=e=>e instanceof Function?e:()=>e;function Eg({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:i=yg,onClick:s}){const a=re(_g,ue),c=re(wg),l=pn(t),u=pn(e),d=pn(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return P.createElement(P.Fragment,null,a.map(h=>{const{x:_,y:m}=Ge(h,c).positionAbsolute;return P.createElement(i,{key:h.id,x:_,y:m,width:h.width,height:h.height,style:h.style,selected:h.selected,className:d(h),color:l(h),borderRadius:r,strokeColor:u(h),strokeWidth:o,shapeRendering:f,onClick:s,id:h.id})}))}var bg=T.memo(Eg);const xg=200,Sg=150,Ng=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?Dh(tn(t,e.nodeOrigin),n):n,rfId:e.rfId}},Cg="react-flow__minimap-desc";function Au({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s=2,nodeComponent:a,maskColor:c="rgb(240, 240, 240, 0.6)",maskStrokeColor:l="none",maskStrokeWidth:u=1,position:d="bottom-right",onClick:f,onNodeClick:h,pannable:_=!1,zoomable:m=!1,ariaLabel:g="React Flow mini map",inversePan:p=!1,zoomStep:y=10,offsetScale:E=5}){const v=ae(),b=T.useRef(null),{boundingRect:x,viewBB:C,rfId:q}=re(Ng,ue),k=e?.width??xg,A=e?.height??Sg,D=x.width/k,$=x.height/A,L=Math.max(D,$),w=L*k,R=L*A,N=E*L,O=x.x-(w-x.width)/2-N,H=x.y-(R-x.height)/2-N,M=w+N*2,F=R+N*2,B=`${Cg}-${q}`,G=T.useRef(0);G.current=L,T.useEffect(()=>{if(b.current){const I=ge(b.current),z=W=>{const{transform:K,d3Selection:ee,d3Zoom:ie}=v.getState();if(W.sourceEvent.type!=="wheel"||!ee||!ie)return;const te=-W.sourceEvent.deltaY*(W.sourceEvent.deltaMode===1?.05:W.sourceEvent.deltaMode?1:.002)*y,Q=K[2]*Math.pow(2,te);ie.scaleTo(ee,Q)},V=W=>{const{transform:K,d3Selection:ee,d3Zoom:ie,translateExtent:te,width:Q,height:ne}=v.getState();if(W.sourceEvent.type!=="mousemove"||!ee||!ie)return;const le=G.current*Math.max(1,K[2])*(p?-1:1),J={x:K[0]-W.sourceEvent.movementX*le,y:K[1]-W.sourceEvent.movementY*le},Z=[[0,0],[Q,ne]],fe=Ae.translate(J.x,J.y).scale(K[2]),Ne=ie.constrain()(fe,Z,te);ie.transform(ee,Ne)},Y=Da().on("zoom",_?V:null).on("zoom.wheel",m?z:null);return I.call(Y),()=>{I.on("zoom",null)}}},[_,m,p,y]);const U=f?I=>{const z=ye(I);f(I,{x:z[0],y:z[1]})}:void 0,S=h?(I,z)=>{const V=v.getState().nodeInternals.get(z);h(I,V)}:void 0;return P.createElement(bo,{position:d,style:e,className:ce(["react-flow__minimap",t]),"data-testid":"rf__minimap"},P.createElement("svg",{width:k,height:A,viewBox:`${O} ${H} ${M} ${F}`,role:"img","aria-labelledby":B,ref:b,onClick:U},g&&P.createElement("title",{id:B},g),P.createElement(bg,{onClick:S,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:a}),P.createElement("path",{className:"react-flow__minimap-mask",d:`M${O-N},${H-N}h${M+N*2}v${F+N*2}h${-M-N*2}z - M${C.x},${C.y}h${C.width}v${C.height}h${-C.width}z`,fill:c,fillRule:"evenodd",stroke:l,strokeWidth:u,pointerEvents:"none"})))}Au.displayName="MiniMap";var Jm=T.memo(Au);function kg(){return P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},P.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function Rg(){return P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},P.createElement("path",{d:"M0 0h32v4.2H0z"}))}function Ag(){return P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},P.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function Mg(){return P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},P.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function Ig(){return P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},P.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const _t=({children:e,className:t,...n})=>P.createElement("button",{type:"button",className:ce(["react-flow__controls-button",t]),...n},e);_t.displayName="ControlButton";const qg=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),Mu=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:c,className:l,children:u,position:d="bottom-left"})=>{const f=ae(),[h,_]=T.useState(!1),{isInteractive:m,minZoomReached:g,maxZoomReached:p}=re(qg,ue),{zoomIn:y,zoomOut:E,fitView:v}=Io();if(T.useEffect(()=>{_(!0)},[]),!h)return null;const b=()=>{y(),i?.()},x=()=>{E(),s?.()},C=()=>{v(o),a?.()},q=()=>{f.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),c?.(!m)};return P.createElement(bo,{className:ce(["react-flow__controls",l]),position:d,style:e,"data-testid":"rf__controls"},t&&P.createElement(P.Fragment,null,P.createElement(_t,{onClick:b,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:p},P.createElement(kg,null)),P.createElement(_t,{onClick:x,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:g},P.createElement(Rg,null))),n&&P.createElement(_t,{className:"react-flow__controls-fitview",onClick:C,title:"fit view","aria-label":"fit view"},P.createElement(Ag,null)),r&&P.createElement(_t,{className:"react-flow__controls-interactive",onClick:q,title:"toggle interactivity","aria-label":"toggle interactivity"},m?P.createElement(Ig,null):P.createElement(Mg,null)),u)};Mu.displayName="Controls";var ev=T.memo(Mu),we;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(we||(we={}));function Tg({color:e,dimensions:t,lineWidth:n}){return P.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function Pg({color:e,radius:t}){return P.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const Dg={[we.Dots]:"#91919a",[we.Lines]:"#eee",[we.Cross]:"#e2e2e2"},zg={[we.Dots]:1,[we.Lines]:1,[we.Cross]:6},Lg=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Iu({id:e,variant:t=we.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=2,color:s,style:a,className:c}){const l=T.useRef(null),{transform:u,patternId:d}=re(Lg,ue),f=s||Dg[t],h=r||zg[t],_=t===we.Dots,m=t===we.Cross,g=Array.isArray(n)?n:[n,n],p=[g[0]*u[2]||1,g[1]*u[2]||1],y=h*u[2],E=m?[y,y]:p,v=_?[y/i,y/i]:[E[0]/i,E[1]/i];return P.createElement("svg",{className:ce(["react-flow__background",c]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:l,"data-testid":"rf__background"},P.createElement("pattern",{id:d+e,x:u[0]%p[0],y:u[1]%p[1],width:p[0],height:p[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${v[0]},-${v[1]})`},_?P.createElement(Pg,{color:f,radius:y/i}):P.createElement(Tg,{dimensions:E,color:f,lineWidth:o})),P.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${d+e})`}))}Iu.displayName="Background";var tv=T.memo(Iu);function To(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var gn,wi;function $g(){if(wi)return gn;wi=1;var e=ea(),t=4;function n(r){return e(r,t)}return gn=n,gn}var mn,_i;function qu(){if(_i)return mn;_i=1;var e=Pc();function t(n){return typeof n=="function"?n:e}return mn=t,mn}var vn,Ei;function Tu(){if(Ei)return vn;Ei=1;var e=ta(),t=co(),n=qu(),r=We();function o(i,s){var a=r(i)?e:t;return a(i,n(s))}return vn=o,vn}var yn,bi;function Pu(){return bi||(bi=1,yn=Tu()),yn}var wn,xi;function Og(){if(xi)return wn;xi=1;var e=co();function t(n,r){var o=[];return e(n,function(i,s,a){r(i,s,a)&&o.push(i)}),o}return wn=t,wn}var _n,Si;function Du(){if(Si)return _n;Si=1;var e=Dc(),t=Og(),n=lo(),r=We();function o(i,s){var a=r(i)?e:t;return a(i,n(s,3))}return _n=o,_n}var En,Ni;function Fg(){if(Ni)return En;Ni=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,o){return r!=null&&t.call(r,o)}return En=n,En}var bn,Ci;function zu(){if(Ci)return bn;Ci=1;var e=Fg(),t=zc();function n(r,o){return r!=null&&t(r,o,e)}return bn=n,bn}var xn,ki;function Hg(){if(ki)return xn;ki=1;var e=na(),t=ra(),n=oa(),r=We(),o=fo(),i=ho(),s=Lc(),a=po(),c="[object Map]",l="[object Set]",u=Object.prototype,d=u.hasOwnProperty;function f(h){if(h==null)return!0;if(o(h)&&(r(h)||typeof h=="string"||typeof h.splice=="function"||i(h)||a(h)||n(h)))return!h.length;var _=t(h);if(_==c||_==l)return!h.size;if(s(h))return!e(h).length;for(var m in h)if(d.call(h,m))return!1;return!0}return xn=f,xn}var Sn,Ri;function Lu(){if(Ri)return Sn;Ri=1;function e(t){return t===void 0}return Sn=e,Sn}var Nn,Ai;function Vg(){if(Ai)return Nn;Ai=1;function e(t,n,r,o){var i=-1,s=t==null?0:t.length;for(o&&s&&(r=t[++i]);++i1?h.setNode(_,d):h.setNode(_)}),this},o.prototype.setNode=function(u,d){return e.has(this._nodes,u)?(arguments.length>1&&(this._nodes[u]=d),this):(this._nodes[u]=arguments.length>1?d:this._defaultNodeLabelFn(u),this._isCompound&&(this._parent[u]=n,this._children[u]={},this._children[n][u]=!0),this._in[u]={},this._preds[u]={},this._out[u]={},this._sucs[u]={},++this._nodeCount,this)},o.prototype.node=function(u){return this._nodes[u]},o.prototype.hasNode=function(u){return e.has(this._nodes,u)},o.prototype.removeNode=function(u){var d=this;if(e.has(this._nodes,u)){var f=function(h){d.removeEdge(d._edgeObjs[h])};delete this._nodes[u],this._isCompound&&(this._removeFromParentsChildList(u),delete this._parent[u],e.each(this.children(u),function(h){d.setParent(h)}),delete this._children[u]),e.each(e.keys(this._in[u]),f),delete this._in[u],delete this._preds[u],e.each(e.keys(this._out[u]),f),delete this._out[u],delete this._sucs[u],--this._nodeCount}return this},o.prototype.setParent=function(u,d){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(d))d=n;else{d+="";for(var f=d;!e.isUndefined(f);f=this.parent(f))if(f===u)throw new Error("Setting "+d+" as parent of "+u+" would create a cycle");this.setNode(d)}return this.setNode(u),this._removeFromParentsChildList(u),this._parent[u]=d,this._children[d][u]=!0,this},o.prototype._removeFromParentsChildList=function(u){delete this._children[this._parent[u]][u]},o.prototype.parent=function(u){if(this._isCompound){var d=this._parent[u];if(d!==n)return d}},o.prototype.children=function(u){if(e.isUndefined(u)&&(u=n),this._isCompound){var d=this._children[u];if(d)return e.keys(d)}else{if(u===n)return this.nodes();if(this.hasNode(u))return[]}},o.prototype.predecessors=function(u){var d=this._preds[u];if(d)return e.keys(d)},o.prototype.successors=function(u){var d=this._sucs[u];if(d)return e.keys(d)},o.prototype.neighbors=function(u){var d=this.predecessors(u);if(d)return e.union(d,this.successors(u))},o.prototype.isLeaf=function(u){var d;return this.isDirected()?d=this.successors(u):d=this.neighbors(u),d.length===0},o.prototype.filterNodes=function(u){var d=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});d.setGraph(this.graph());var f=this;e.each(this._nodes,function(m,g){u(g)&&d.setNode(g,m)}),e.each(this._edgeObjs,function(m){d.hasNode(m.v)&&d.hasNode(m.w)&&d.setEdge(m,f.edge(m))});var h={};function _(m){var g=f.parent(m);return g===void 0||d.hasNode(g)?(h[m]=g,g):g in h?h[g]:_(g)}return this._isCompound&&e.each(d.nodes(),function(m){d.setParent(m,_(m))}),d},o.prototype.setDefaultEdgeLabel=function(u){return e.isFunction(u)||(u=e.constant(u)),this._defaultEdgeLabelFn=u,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(u,d){var f=this,h=arguments;return e.reduce(u,function(_,m){return h.length>1?f.setEdge(_,m,d):f.setEdge(_,m),m}),this},o.prototype.setEdge=function(){var u,d,f,h,_=!1,m=arguments[0];typeof m=="object"&&m!==null&&"v"in m?(u=m.v,d=m.w,f=m.name,arguments.length===2&&(h=arguments[1],_=!0)):(u=m,d=arguments[1],f=arguments[3],arguments.length>2&&(h=arguments[2],_=!0)),u=""+u,d=""+d,e.isUndefined(f)||(f=""+f);var g=a(this._isDirected,u,d,f);if(e.has(this._edgeLabels,g))return _&&(this._edgeLabels[g]=h),this;if(!e.isUndefined(f)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(u),this.setNode(d),this._edgeLabels[g]=_?h:this._defaultEdgeLabelFn(u,d,f);var p=c(this._isDirected,u,d,f);return u=p.v,d=p.w,Object.freeze(p),this._edgeObjs[g]=p,i(this._preds[d],u),i(this._sucs[u],d),this._in[d][g]=p,this._out[u][g]=p,this._edgeCount++,this},o.prototype.edge=function(u,d,f){var h=arguments.length===1?l(this._isDirected,arguments[0]):a(this._isDirected,u,d,f);return this._edgeLabels[h]},o.prototype.hasEdge=function(u,d,f){var h=arguments.length===1?l(this._isDirected,arguments[0]):a(this._isDirected,u,d,f);return e.has(this._edgeLabels,h)},o.prototype.removeEdge=function(u,d,f){var h=arguments.length===1?l(this._isDirected,arguments[0]):a(this._isDirected,u,d,f),_=this._edgeObjs[h];return _&&(u=_.v,d=_.w,delete this._edgeLabels[h],delete this._edgeObjs[h],s(this._preds[d],u),s(this._sucs[u],d),delete this._in[d][h],delete this._out[u][h],this._edgeCount--),this},o.prototype.inEdges=function(u,d){var f=this._in[u];if(f){var h=e.values(f);return d?e.filter(h,function(_){return _.v===d}):h}},o.prototype.outEdges=function(u,d){var f=this._out[u];if(f){var h=e.values(f);return d?e.filter(h,function(_){return _.w===d}):h}},o.prototype.nodeEdges=function(u,d){var f=this.inEdges(u,d);if(f)return f.concat(this.outEdges(u,d))};function i(u,d){u[d]?u[d]++:u[d]=1}function s(u,d){--u[d]||delete u[d]}function a(u,d,f,h){var _=""+d,m=""+f;if(!u&&_>m){var g=_;_=m,m=g}return _+r+m+r+(e.isUndefined(h)?t:h)}function c(u,d,f,h){var _=""+d,m=""+f;if(!u&&_>m){var g=_;_=m,m=g}var p={v:_,w:m};return h&&(p.name=h),p}function l(u,d){return a(u,d.v,d.w,d.name)}return $n}var On,Bi;function jg(){return Bi||(Bi=1,On="2.1.8"),On}var Fn,Gi;function Qg(){return Gi||(Gi=1,Fn={Graph:Po(),version:jg()}),Fn}var Hn,Ui;function Jg(){if(Ui)return Hn;Ui=1;var e=ve(),t=Po();Hn={write:n,read:i};function n(s){var a={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:r(s),edges:o(s)};return e.isUndefined(s.graph())||(a.value=e.clone(s.graph())),a}function r(s){return e.map(s.nodes(),function(a){var c=s.node(a),l=s.parent(a),u={v:a};return e.isUndefined(c)||(u.value=c),e.isUndefined(l)||(u.parent=l),u})}function o(s){return e.map(s.edges(),function(a){var c=s.edge(a),l={v:a.v,w:a.w};return e.isUndefined(a.name)||(l.name=a.name),e.isUndefined(c)||(l.value=c),l})}function i(s){var a=new t(s.options).setGraph(s.value);return e.each(s.nodes,function(c){a.setNode(c.v,c.value),c.parent&&a.setParent(c.v,c.parent)}),e.each(s.edges,function(c){a.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),a}return Hn}var Vn,Yi;function em(){if(Yi)return Vn;Yi=1;var e=ve();Vn=t;function t(n){var r={},o=[],i;function s(a){e.has(r,a)||(r[a]=!0,i.push(a),e.each(n.successors(a),s),e.each(n.predecessors(a),s))}return e.each(n.nodes(),function(a){i=[],s(a),i.length&&o.push(i)}),o}return Vn}var Bn,Wi;function Hu(){if(Wi)return Bn;Wi=1;var e=ve();Bn=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,r){var o=this._keyIndices;if(n=String(n),!e.has(o,n)){var i=this._arr,s=i.length;return o[n]=s,i.push({key:n,priority:r}),this._decrease(s),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,r){var o=this._keyIndices[n];if(r>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[o].priority+" New: "+r);this._arr[o].priority=r,this._decrease(o)},t.prototype._heapify=function(n){var r=this._arr,o=2*n,i=o+1,s=n;o>1,!(r[i].priority0&&(d=u.removeMin(),f=l[d],f.distance!==Number.POSITIVE_INFINITY);)c(d).forEach(h);return l}return Gn}var Un,Xi;function tm(){if(Xi)return Un;Xi=1;var e=Vu(),t=ve();Un=n;function n(r,o,i){return t.transform(r.nodes(),function(s,a){s[a]=e(r,a,o,i)},{})}return Un}var Yn,Ki;function Bu(){if(Ki)return Yn;Ki=1;var e=ve();Yn=t;function t(n){var r=0,o=[],i={},s=[];function a(c){var l=i[c]={onStack:!0,lowlink:r,index:r++};if(o.push(c),n.successors(c).forEach(function(f){e.has(i,f)?i[f].onStack&&(l.lowlink=Math.min(l.lowlink,i[f].index)):(a(f),l.lowlink=Math.min(l.lowlink,i[f].lowlink))}),l.lowlink===l.index){var u=[],d;do d=o.pop(),i[d].onStack=!1,u.push(d);while(c!==d);s.push(u)}}return n.nodes().forEach(function(c){e.has(i,c)||a(c)}),s}return Yn}var Wn,ji;function nm(){if(ji)return Wn;ji=1;var e=ve(),t=Bu();Wn=n;function n(r){return e.filter(t(r),function(o){return o.length>1||o.length===1&&r.hasEdge(o[0],o[0])})}return Wn}var Zn,Qi;function rm(){if(Qi)return Zn;Qi=1;var e=ve();Zn=n;var t=e.constant(1);function n(o,i,s){return r(o,i||t,s||function(a){return o.outEdges(a)})}function r(o,i,s){var a={},c=o.nodes();return c.forEach(function(l){a[l]={},a[l][l]={distance:0},c.forEach(function(u){l!==u&&(a[l][u]={distance:Number.POSITIVE_INFINITY})}),s(l).forEach(function(u){var d=u.v===l?u.w:u.v,f=i(u);a[l][d]={distance:f,predecessor:l}})}),c.forEach(function(l){var u=a[l];c.forEach(function(d){var f=a[d];c.forEach(function(h){var _=f[l],m=u[h],g=f[h],p=_.distance+m.distance;p0;){if(l=c.removeMin(),e.has(a,l))s.setEdge(l,a[l]);else{if(d)throw new Error("Input graph is not connected: "+o);d=!0}o.nodeEdges(l).forEach(u)}return s}return er}var tr,is;function um(){return is||(is=1,tr={components:em(),dijkstra:Vu(),dijkstraAll:tm(),findCycles:nm(),floydWarshall:rm(),isAcyclic:om(),postorder:im(),preorder:sm(),prim:am(),tarjan:Bu(),topsort:Gu()}),tr}var nr,ss;function cm(){if(ss)return nr;ss=1;var e=Qg();return nr={Graph:e.Graph,json:Jg(),alg:um(),version:e.version},nr}var rr,as;function _e(){if(as)return rr;as=1;var e;if(typeof To=="function")try{e=cm()}catch{}return e||(e=window.graphlib),rr=e,rr}var or,us;function lm(){if(us)return or;us=1;var e=ea(),t=1,n=4;function r(o){return e(o,t|n)}return or=r,or}var ir,cs;function dm(){if(cs)return ir;cs=1;var e=mo(),t=ca(),n=ua(),r=Zt(),o=Object.prototype,i=o.hasOwnProperty,s=e(function(a,c){a=Object(a);var l=-1,u=c.length,d=u>2?c[2]:void 0;for(d&&n(c[0],c[1],d)&&(u=1);++l1?i[a-1]:void 0,l=a>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(a--,c):void 0,l&&t(i[0],i[1],l)&&(c=a<3?void 0:c,a=1),o=Object(o);++s0;--g)if(m=u[g].dequeue(),m){f=f.concat(s(l,u,d,m,!0));break}}}return f}function s(l,u,d,f,h){var _=h?[]:void 0;return e.forEach(l.inEdges(f.v),function(m){var g=l.edge(m),p=l.node(m.v);h&&_.push({v:m.v,w:m.w}),p.out-=g,c(u,d,p)}),e.forEach(l.outEdges(f.v),function(m){var g=l.edge(m),p=m.w,y=l.node(p);y.in-=g,c(u,d,y)}),l.removeNode(f.v),_}function a(l,u){var d=new t,f=0,h=0;e.forEach(l.nodes(),function(g){d.setNode(g,{v:g,in:0,out:0})}),e.forEach(l.edges(),function(g){var p=d.edge(g.v,g.w)||0,y=u(g),E=p+y;d.setEdge(g.v,g.w,E),h=Math.max(h,d.node(g.v).out+=y),f=Math.max(f,d.node(g.w).in+=y)});var _=e.range(h+f+3).map(function(){return new n}),m=f+1;return e.forEach(d.nodes(),function(g){c(_,m,d.node(g))}),{graph:d,buckets:_,zeroIdx:m}}function c(l,u,d){d.out?d.in?l[d.out-d.in+u].enqueue(d):l[l.length-1].enqueue(d):l[0].enqueue(d)}return xr}var Sr,Rs;function km(){if(Rs)return Sr;Rs=1;var e=oe(),t=Cm();Sr={run:n,undo:o};function n(i){var s=i.graph().acyclicer==="greedy"?t(i,a(i)):r(i);e.forEach(s,function(c){var l=i.edge(c);i.removeEdge(c),l.forwardName=c.name,l.reversed=!0,i.setEdge(c.w,c.v,l,e.uniqueId("rev"))});function a(c){return function(l){return c.edge(l).weight}}}function r(i){var s=[],a={},c={};function l(u){e.has(c,u)||(c[u]=!0,a[u]=!0,e.forEach(i.outEdges(u),function(d){e.has(a,d.w)?s.push(d):l(d.w)}),delete a[u])}return e.forEach(i.nodes(),l),s}function o(i){e.forEach(i.edges(),function(s){var a=i.edge(s);if(a.reversed){i.removeEdge(s);var c=a.forwardName;delete a.reversed,delete a.forwardName,i.setEdge(s.w,s.v,a,c)}})}return Sr}var Nr,As;function he(){if(As)return Nr;As=1;var e=oe(),t=_e().Graph;Nr={addDummyNode:n,simplify:r,asNonCompoundGraph:o,successorWeights:i,predecessorWeights:s,intersectRect:a,buildLayerMatrix:c,normalizeRanks:l,removeEmptyRanks:u,addBorderNode:d,maxRank:f,partition:h,time:_,notime:m};function n(g,p,y,E){var v;do v=e.uniqueId(E);while(g.hasNode(v));return y.dummy=p,g.setNode(v,y),v}function r(g){var p=new t().setGraph(g.graph());return e.forEach(g.nodes(),function(y){p.setNode(y,g.node(y))}),e.forEach(g.edges(),function(y){var E=p.edge(y.v,y.w)||{weight:0,minlen:1},v=g.edge(y);p.setEdge(y.v,y.w,{weight:E.weight+v.weight,minlen:Math.max(E.minlen,v.minlen)})}),p}function o(g){var p=new t({multigraph:g.isMultigraph()}).setGraph(g.graph());return e.forEach(g.nodes(),function(y){g.children(y).length||p.setNode(y,g.node(y))}),e.forEach(g.edges(),function(y){p.setEdge(y,g.edge(y))}),p}function i(g){var p=e.map(g.nodes(),function(y){var E={};return e.forEach(g.outEdges(y),function(v){E[v.w]=(E[v.w]||0)+g.edge(v).weight}),E});return e.zipObject(g.nodes(),p)}function s(g){var p=e.map(g.nodes(),function(y){var E={};return e.forEach(g.inEdges(y),function(v){E[v.v]=(E[v.v]||0)+g.edge(v).weight}),E});return e.zipObject(g.nodes(),p)}function a(g,p){var y=g.x,E=g.y,v=p.x-y,b=p.y-E,x=g.width/2,C=g.height/2;if(!v&&!b)throw new Error("Not possible to find intersection inside of the rectangle");var q,k;return Math.abs(b)*x>Math.abs(v)*C?(b<0&&(C=-C),q=C*v/b,k=C):(v<0&&(x=-x),q=x,k=x*b/v),{x:y+q,y:E+k}}function c(g){var p=e.map(e.range(f(g)+1),function(){return[]});return e.forEach(g.nodes(),function(y){var E=g.node(y),v=E.rank;e.isUndefined(v)||(p[v][E.order]=y)}),p}function l(g){var p=e.min(e.map(g.nodes(),function(y){return g.node(y).rank}));e.forEach(g.nodes(),function(y){var E=g.node(y);e.has(E,"rank")&&(E.rank-=p)})}function u(g){var p=e.min(e.map(g.nodes(),function(b){return g.node(b).rank})),y=[];e.forEach(g.nodes(),function(b){var x=g.node(b).rank-p;y[x]||(y[x]=[]),y[x].push(b)});var E=0,v=g.graph().nodeRankFactor;e.forEach(y,function(b,x){e.isUndefined(b)&&x%v!==0?--E:E&&e.forEach(b,function(C){g.node(C).rank+=E})})}function d(g,p,y,E){var v={width:0,height:0};return arguments.length>=4&&(v.rank=y,v.order=E),n(g,"border",v,p)}function f(g){return e.max(e.map(g.nodes(),function(p){var y=g.node(p).rank;if(!e.isUndefined(y))return y}))}function h(g,p){var y={lhs:[],rhs:[]};return e.forEach(g,function(E){p(E)?y.lhs.push(E):y.rhs.push(E)}),y}function _(g,p){var y=e.now();try{return p()}finally{console.log(g+" time: "+(e.now()-y)+"ms")}}function m(g,p){return p()}return Nr}var Cr,Ms;function Rm(){if(Ms)return Cr;Ms=1;var e=oe(),t=he();Cr={run:n,undo:o};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(s){r(i,s)})}function r(i,s){var a=s.v,c=i.node(a).rank,l=s.w,u=i.node(l).rank,d=s.name,f=i.edge(s),h=f.labelRank;if(u!==c+1){i.removeEdge(s);var _,m,g;for(g=0,++c;ck.lim&&(A=k,D=!0);var $=e.filter(v.edges(),function(L){return D===y(E,E.node(L.v),A)&&D!==y(E,E.node(L.w),A)});return e.minBy($,function(L){return n(v,L)})}function m(E,v,b,x){var C=b.v,q=b.w;E.removeEdge(C,q),E.setEdge(x.v,x.w,{}),d(E),c(E,v),g(E,v)}function g(E,v){var b=e.find(E.nodes(),function(C){return!v.node(C).parent}),x=o(E,b);x=x.slice(1),e.forEach(x,function(C){var q=E.node(C).parent,k=v.edge(C,q),A=!1;k||(k=v.edge(q,C),A=!0),v.node(C).rank=v.node(q).rank+(A?k.minlen:-k.minlen)})}function p(E,v,b){return E.hasEdge(v,b)}function y(E,v,b){return b.low<=v.lim&&v.lim<=b.lim}return Ar}var Mr,Ps;function Mm(){if(Ps)return Mr;Ps=1;var e=Yt(),t=e.longestPath,n=Zu(),r=Am();Mr=o;function o(c){switch(c.graph().ranker){case"network-simplex":a(c);break;case"tight-tree":s(c);break;case"longest-path":i(c);break;default:a(c)}}var i=t;function s(c){t(c),n(c)}function a(c){r(c)}return Mr}var Ir,Ds;function Im(){if(Ds)return Ir;Ds=1;var e=oe();Ir=t;function t(o){var i=r(o);e.forEach(o.graph().dummyChains,function(s){for(var a=o.node(s),c=a.edgeObj,l=n(o,i,c.v,c.w),u=l.path,d=l.lca,f=0,h=u[f],_=!0;s!==c.w;){if(a=o.node(s),_){for(;(h=u[f])!==d&&o.node(h).maxRanku||d>i[f].lim));for(h=f,f=a;(f=o.parent(f))!==h;)l.push(f);return{path:c.concat(l.reverse()),lca:h}}function r(o){var i={},s=0;function a(c){var l=s;e.forEach(o.children(c),a),i[c]={low:l,lim:s++}}return e.forEach(o.children(),a),i}return Ir}var qr,zs;function qm(){if(zs)return qr;zs=1;var e=oe(),t=he();qr={run:n,cleanup:s};function n(a){var c=t.addDummyNode(a,"root",{},"_root"),l=o(a),u=e.max(e.values(l))-1,d=2*u+1;a.graph().nestingRoot=c,e.forEach(a.edges(),function(h){a.edge(h).minlen*=d});var f=i(a)+1;e.forEach(a.children(),function(h){r(a,c,d,f,u,l,h)}),a.graph().nodeRankFactor=d}function r(a,c,l,u,d,f,h){var _=a.children(h);if(!_.length){h!==c&&a.setEdge(c,h,{weight:0,minlen:l});return}var m=t.addBorderNode(a,"_bt"),g=t.addBorderNode(a,"_bb"),p=a.node(h);a.setParent(m,h),p.borderTop=m,a.setParent(g,h),p.borderBottom=g,e.forEach(_,function(y){r(a,c,l,u,d,f,y);var E=a.node(y),v=E.borderTop?E.borderTop:y,b=E.borderBottom?E.borderBottom:y,x=E.borderTop?u:2*u,C=v!==b?1:d-f[h]+1;a.setEdge(m,v,{weight:x,minlen:C,nestingEdge:!0}),a.setEdge(b,g,{weight:x,minlen:C,nestingEdge:!0})}),a.parent(h)||a.setEdge(c,m,{weight:0,minlen:d+f[h]})}function o(a){var c={};function l(u,d){var f=a.children(u);f&&f.length&&e.forEach(f,function(h){l(h,d+1)}),c[u]=d}return e.forEach(a.children(),function(u){l(u,1)}),c}function i(a){return e.reduce(a.edges(),function(c,l){return c+a.edge(l).weight},0)}function s(a){var c=a.graph();a.removeNode(c.nestingRoot),delete c.nestingRoot,e.forEach(a.edges(),function(l){var u=a.edge(l);u.nestingEdge&&a.removeEdge(l)})}return qr}var Tr,Ls;function Tm(){if(Ls)return Tr;Ls=1;var e=oe(),t=he();Tr=n;function n(o){function i(s){var a=o.children(s),c=o.node(s);if(a.length&&e.forEach(a,i),e.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var l=c.minRank,u=c.maxRank+1;l0;)h%2&&(_+=u[h+1]),h=h-1>>1,u[h]+=f.weight;d+=f.weight*_})),d}return zr}var Lr,Hs;function Lm(){if(Hs)return Lr;Hs=1;var e=oe();Lr=t;function t(n,r){return e.map(r,function(o){var i=n.inEdges(o);if(i.length){var s=e.reduce(i,function(a,c){var l=n.edge(c),u=n.node(c.v);return{sum:a.sum+l.weight*u.order,weight:a.weight+l.weight}},{sum:0,weight:0});return{v:o,barycenter:s.sum/s.weight,weight:s.weight}}else return{v:o}})}return Lr}var $r,Vs;function $m(){if(Vs)return $r;Vs=1;var e=oe();$r=t;function t(o,i){var s={};e.forEach(o,function(c,l){var u=s[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:l};e.isUndefined(c.barycenter)||(u.barycenter=c.barycenter,u.weight=c.weight)}),e.forEach(i.edges(),function(c){var l=s[c.v],u=s[c.w];!e.isUndefined(l)&&!e.isUndefined(u)&&(u.indegree++,l.out.push(s[c.w]))});var a=e.filter(s,function(c){return!c.indegree});return n(a)}function n(o){var i=[];function s(l){return function(u){u.merged||(e.isUndefined(u.barycenter)||e.isUndefined(l.barycenter)||u.barycenter>=l.barycenter)&&r(l,u)}}function a(l){return function(u){u.in.push(l),--u.indegree===0&&o.push(u)}}for(;o.length;){var c=o.pop();i.push(c),e.forEach(c.in.reverse(),s(c)),e.forEach(c.out,a(c))}return e.map(e.filter(i,function(l){return!l.merged}),function(l){return e.pick(l,["vs","i","barycenter","weight"])})}function r(o,i){var s=0,a=0;o.weight&&(s+=o.barycenter*o.weight,a+=o.weight),i.weight&&(s+=i.barycenter*i.weight,a+=i.weight),o.vs=i.vs.concat(o.vs),o.barycenter=s/a,o.weight=a,o.i=Math.min(i.i,o.i),i.merged=!0}return $r}var Or,Bs;function Om(){if(Bs)return Or;Bs=1;var e=oe(),t=he();Or=n;function n(i,s){var a=t.partition(i,function(m){return e.has(m,"barycenter")}),c=a.lhs,l=e.sortBy(a.rhs,function(m){return-m.i}),u=[],d=0,f=0,h=0;c.sort(o(!!s)),h=r(u,l,h),e.forEach(c,function(m){h+=m.vs.length,u.push(m.vs),d+=m.barycenter*m.weight,f+=m.weight,h=r(u,l,h)});var _={vs:e.flatten(u,!0)};return f&&(_.barycenter=d/f,_.weight=f),_}function r(i,s,a){for(var c;s.length&&(c=e.last(s)).i<=a;)s.pop(),i.push(c.vs),a++;return a}function o(i){return function(s,a){return s.barycentera.barycenter?1:i?a.i-s.i:s.i-a.i}}return Or}var Fr,Gs;function Fm(){if(Gs)return Fr;Gs=1;var e=oe(),t=Lm(),n=$m(),r=Om();Fr=o;function o(a,c,l,u){var d=a.children(c),f=a.node(c),h=f?f.borderLeft:void 0,_=f?f.borderRight:void 0,m={};h&&(d=e.filter(d,function(b){return b!==h&&b!==_}));var g=t(a,d);e.forEach(g,function(b){if(a.children(b.v).length){var x=o(a,b.v,l,u);m[b.v]=x,e.has(x,"barycenter")&&s(b,x)}});var p=n(g,l);i(p,m);var y=r(p,u);if(h&&(y.vs=e.flatten([h,y.vs,_],!0),a.predecessors(h).length)){var E=a.node(a.predecessors(h)[0]),v=a.node(a.predecessors(_)[0]);e.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+E.order+v.order)/(y.weight+2),y.weight+=2}return y}function i(a,c){e.forEach(a,function(l){l.vs=e.flatten(l.vs.map(function(u){return c[u]?c[u].vs:u}),!0)})}function s(a,c){e.isUndefined(a.barycenter)?(a.barycenter=c.barycenter,a.weight=c.weight):(a.barycenter=(a.barycenter*a.weight+c.barycenter*c.weight)/(a.weight+c.weight),a.weight+=c.weight)}return Fr}var Hr,Us;function Hm(){if(Us)return Hr;Us=1;var e=oe(),t=_e().Graph;Hr=n;function n(o,i,s){var a=r(o),c=new t({compound:!0}).setGraph({root:a}).setDefaultNodeLabel(function(l){return o.node(l)});return e.forEach(o.nodes(),function(l){var u=o.node(l),d=o.parent(l);(u.rank===i||u.minRank<=i&&i<=u.maxRank)&&(c.setNode(l),c.setParent(l,d||a),e.forEach(o[s](l),function(f){var h=f.v===l?f.w:f.v,_=c.edge(h,l),m=e.isUndefined(_)?0:_.weight;c.setEdge(h,l,{weight:o.edge(f).weight+m})}),e.has(u,"minRank")&&c.setNode(l,{borderLeft:u.borderLeft[i],borderRight:u.borderRight[i]}))}),c}function r(o){for(var i;o.hasNode(i=e.uniqueId("_root")););return i}return Hr}var Vr,Ys;function Vm(){if(Ys)return Vr;Ys=1;var e=oe();Vr=t;function t(n,r,o){var i={},s;e.forEach(o,function(a){for(var c=n.parent(a),l,u;c;){if(l=n.parent(c),l?(u=i[l],i[l]=c):(u=s,s=c),u&&u!==c){r.setEdge(u,c);return}c=l}})}return Vr}var Br,Ws;function Bm(){if(Ws)return Br;Ws=1;var e=oe(),t=Dm(),n=zm(),r=Fm(),o=Hm(),i=Vm(),s=_e().Graph,a=he();Br=c;function c(f){var h=a.maxRank(f),_=l(f,e.range(1,h+1),"inEdges"),m=l(f,e.range(h-1,-1,-1),"outEdges"),g=t(f);d(f,g);for(var p=Number.POSITIVE_INFINITY,y,E=0,v=0;v<4;++E,++v){u(E%2?_:m,E%4>=2),g=a.buildLayerMatrix(f);var b=n(f,g);bA)&&s(E,L,D)})})}function b(x,C){var q=-1,k,A=0;return e.forEach(C,function(D,$){if(p.node(D).dummy==="border"){var L=p.predecessors(D);L.length&&(k=p.node(L[0]).order,v(C,A,$,q,k),A=$,q=k)}v(C,A,C.length,k,x.length)}),C}return e.reduce(y,b),E}function i(p,y){if(p.node(y).dummy)return e.find(p.predecessors(y),function(E){return p.node(E).dummy})}function s(p,y,E){if(y>E){var v=y;y=E,E=v}var b=p[y];b||(p[y]=b={}),b[E]=!0}function a(p,y,E){if(y>E){var v=y;y=E,E=v}return e.has(p[y],E)}function c(p,y,E,v){var b={},x={},C={};return e.forEach(y,function(q){e.forEach(q,function(k,A){b[k]=k,x[k]=k,C[k]=A})}),e.forEach(y,function(q){var k=-1;e.forEach(q,function(A){var D=v(A);if(D.length){D=e.sortBy(D,function(N){return C[N]});for(var $=(D.length-1)/2,L=Math.floor($),w=Math.ceil($);L<=w;++L){var R=D[L];x[A]===A&&k{let t;const r=new Set,n=(c,f)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(_=>_(t,h))}},i=()=>t,u={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(r.add(c),()=>r.delete(c)),destroy:()=>{(qm?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},l=t=e(n,i,u);return u},Rm=e=>e?Ic(e):Ic,{useDebugValue:Cm}=L,{useSyncExternalStoreWithSelector:Am}=hm,Nm=e=>e;function yv(e,t=Nm,r){const n=Am(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Cm(n),n}const Tc=(e,t)=>{const r=Rm(e),n=(i,a=t)=>yv(r,i,a);return Object.assign(n,r),n},Im=(e,t)=>e?Tc(e,t):Tc;function he(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,i]of e)if(!Object.is(i,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||!Object.is(e[n],t[n]))return!1;return!0}var Tm={value:()=>{}};function yr(){for(var e=0,t=arguments.length,r={},n;e=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}ir.prototype=yr.prototype={constructor:ir,on:function(e,t){var r=this._,n=Mm(e+"",r),i,a=-1,o=n.length;if(arguments.length<2){for(;++a0)for(var r=new Array(i),n=0,i,a;n=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Pc.hasOwnProperty(t)?{space:Pc[t],local:e}:e}function Om(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===mu&&t.documentElement.namespaceURI===mu?t.createElement(e):t.createElementNS(r,e)}}function km(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mv(e){var t=mr(e);return(t.local?km:Om)(t)}function Dm(){}function Tu(e){return e==null?Dm:function(){return this.querySelector(e)}}function Lm(e){typeof e!="function"&&(e=Tu(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i=b&&(b=y+1);!(E=v[b])&&++b<_;);m._next=E||null}}return o=new Ee(o,n),o._enter=s,o._exit=u,o}function n_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function i_(){return new Ee(this._exit||this._groups.map(Ev),this._parents)}function a_(e,t,r){var n=this.enter(),i=this,a=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?a.remove():r(a),n&&i?n.merge(i).order():i}function o_(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=new Array(i),u=0;u=0;)(o=n[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function u_(e){e||(e=c_);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),a=0;at?1:e>=t?0:NaN}function l_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function f_(){return Array.from(this)}function d_(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?x_:typeof t=="function"?q_:S_)(e,t,r??"")):_t(this.node(),e)}function _t(e,t){return e.style.getPropertyValue(t)||xv(e).getComputedStyle(e,null).getPropertyValue(t)}function C_(e){return function(){delete this[e]}}function A_(e,t){return function(){this[e]=t}}function N_(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function I_(e,t){return arguments.length>1?this.each((t==null?C_:typeof t=="function"?N_:A_)(e,t)):this.node()[e]}function Sv(e){return e.trim().split(/^|\s+/)}function Mu(e){return e.classList||new qv(e)}function qv(e){this._node=e,this._names=Sv(e.getAttribute("class")||"")}qv.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Rv(e,t){for(var r=Mu(e),n=-1,i=t.length;++n=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function ib(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,a;r()=>e;function _u(e,{sourceEvent:t,subject:r,target:n,identifier:i,active:a,x:o,y:s,dx:u,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}_u.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function pb(e){return!e.ctrlKey&&!e.button}function vb(){return this.parentNode}function gb(e,t){return t??{x:e.x,y:e.y}}function yb(){return navigator.maxTouchPoints||"ontouchstart"in this}function mb(){var e=pb,t=vb,r=gb,n=yb,i={},a=yr("start","drag","end"),o=0,s,u,l,c,f=0;function d(m){m.on("mousedown.drag",h).filter(n).on("touchstart.drag",v).on("touchmove.drag",p,hb).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(m,E){if(!(c||!e.call(this,m,E))){var x=b(this,t.call(this,m,E),m,E,"mouse");x&&(xe(m.view).on("mousemove.drag",_,zt).on("mouseup.drag",g,zt),Iv(m.view),an(m),l=!1,s=m.clientX,u=m.clientY,x("start",m))}}function _(m){if(yt(m),!l){var E=m.clientX-s,x=m.clientY-u;l=E*E+x*x>f}i.mouse("drag",m)}function g(m){xe(m.view).on("mousemove.drag mouseup.drag",null),Tv(m.view,l),yt(m),i.mouse("end",m)}function v(m,E){if(e.call(this,m,E)){var x=m.changedTouches,S=t.call(this,m,E),N=x.length,q,A;for(q=0;q=0&&e._call.call(void 0,t),e=e._next;--bt}function Oc(){at=(lr=Bt.now())+_r,bt=Pt=0;try{bb()}finally{bt=0,Eb(),at=0}}function wb(){var e=Bt.now(),t=e-lr;t>Mv&&(_r-=t,lr=e)}function Eb(){for(var e,t=cr,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:cr=r);Ot=e,bu(n)}function bu(e){if(!bt){Pt&&(Pt=clearTimeout(Pt));var t=e-at;t>24?(e<1/0&&(Pt=setTimeout(Oc,e-Bt.now()-_r)),At&&(At=clearInterval(At))):(At||(lr=Bt.now(),At=setInterval(wb,Mv)),bt=1,Pv(Oc))}}function kc(e,t,r){var n=new fr;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var xb=yr("start","end","cancel","interrupt"),Sb=[],kv=0,Dc=1,wu=2,ar=3,Lc=4,Eu=5,or=6;function br(e,t,r,n,i,a){var o=e.__transition;if(!o)e.__transition={};else if(r in o)return;qb(e,r,{name:t,index:n,group:i,on:xb,tween:Sb,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:kv})}function Ou(e,t){var r=Pe(e,t);if(r.state>kv)throw new Error("too late; already scheduled");return r}function Fe(e,t){var r=Pe(e,t);if(r.state>ar)throw new Error("too late; already running");return r}function Pe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function qb(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=Ov(a,0,r.time);function a(l){r.state=Dc,r.timer.restart(o,r.delay,r.time),r.delay<=l&&o(l-r.delay)}function o(l){var c,f,d,h;if(r.state!==Dc)return u();for(c in n)if(h=n[c],h.name===r.name){if(h.state===ar)return kc(o);h.state===Lc?(h.state=or,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[c]):+cwu&&n.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function t0(e,t,r){var n,i,a=e0(t)?Ou:Fe;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}function r0(e,t){var r=this._id;return arguments.length<2?Pe(this.node(),r).on.on(e):this.each(t0(r,e,t))}function n0(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function i0(){return this.on("end.remove",n0(this._id))}function a0(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Tu(e));for(var n=this._groups,i=n.length,a=new Array(i),o=0;o()=>e;function I0(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function $e(e,t,r){this.k=e,this.x=t,this.y=r}$e.prototype={constructor:$e,scale:function(e){return e===1?this:new $e(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $e(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ge=new $e(1,0,0);$e.prototype;function on(e){e.stopImmediatePropagation()}function Nt(e){e.preventDefault(),e.stopImmediatePropagation()}function T0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function M0(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fc(){return this.__zoom||Ge}function P0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function O0(){return navigator.maxTouchPoints||"ontouchstart"in this}function k0(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],o=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function zv(){var e=T0,t=M0,r=k0,n=P0,i=O0,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,u=mm,l=yr("start","zoom","end"),c,f,d,h=500,_=150,g=0,v=10;function p(w){w.property("__zoom",Fc).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(w,T,C,z){var H=w.selection?w.selection():w;H.property("__zoom",Fc),w!==H?E(w,T,C,z):H.interrupt().each(function(){x(this,arguments).event(z).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},p.scaleBy=function(w,T,C,z){p.scaleTo(w,function(){var H=this.__zoom.k,M=typeof T=="function"?T.apply(this,arguments):T;return H*M},C,z)},p.scaleTo=function(w,T,C,z){p.transform(w,function(){var H=t.apply(this,arguments),M=this.__zoom,B=C==null?m(H):typeof C=="function"?C.apply(this,arguments):C,G=M.invert(B),V=typeof T=="function"?T.apply(this,arguments):T;return r(b(y(M,V),B,G),H,o)},C,z)},p.translateBy=function(w,T,C,z){p.transform(w,function(){return r(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),o)},null,z)},p.translateTo=function(w,T,C,z,H){p.transform(w,function(){var M=t.apply(this,arguments),B=this.__zoom,G=z==null?m(M):typeof z=="function"?z.apply(this,arguments):z;return r(Ge.translate(G[0],G[1]).scale(B.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof C=="function"?-C.apply(this,arguments):-C),M,o)},z,H)};function y(w,T){return T=Math.max(a[0],Math.min(a[1],T)),T===w.k?w:new $e(T,w.x,w.y)}function b(w,T,C){var z=T[0]-C[0]*w.k,H=T[1]-C[1]*w.k;return z===w.x&&H===w.y?w:new $e(w.k,z,H)}function m(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function E(w,T,C,z){w.on("start.zoom",function(){x(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(z).end()}).tween("zoom",function(){var H=this,M=arguments,B=x(H,M).event(z),G=t.apply(H,M),V=C==null?m(G):typeof C=="function"?C.apply(H,M):C,U=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),R=H.__zoom,P=typeof T=="function"?T.apply(H,M):T,F=u(R.invert(V).concat(U/R.k),P.invert(V).concat(U/P.k));return function($){if($===1)$=P;else{var j=F($),W=U/j[2];$=new $e(W,V[0]-j[0]*W,V[1]-j[1]*W)}B.zoom(null,$)}})}function x(w,T,C){return!C&&w.__zooming||new S(w,T)}function S(w,T){this.that=w,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,T),this.taps=0}S.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,T){return this.mouse&&w!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var T=xe(this.that).datum();l.call(w,this.that,new I0(w,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:l}),T)}};function N(w,...T){if(!e.apply(this,arguments))return;var C=x(this,T).event(w),z=this.__zoom,H=Math.max(a[0],Math.min(a[1],z.k*Math.pow(2,n.apply(this,arguments)))),M=Ne(w);if(C.wheel)(C.mouse[0][0]!==M[0]||C.mouse[0][1]!==M[1])&&(C.mouse[1]=z.invert(C.mouse[0]=M)),clearTimeout(C.wheel);else{if(z.k===H)return;C.mouse=[M,z.invert(M)],sr(this),C.start()}Nt(w),C.wheel=setTimeout(B,_),C.zoom("mouse",r(b(y(z,H),C.mouse[0],C.mouse[1]),C.extent,o));function B(){C.wheel=null,C.end()}}function q(w,...T){if(d||!e.apply(this,arguments))return;var C=w.currentTarget,z=x(this,T,!0).event(w),H=xe(w.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",U,!0),M=Ne(w,C),B=w.clientX,G=w.clientY;Iv(w.view),on(w),z.mouse=[M,this.__zoom.invert(M)],sr(this),z.start();function V(R){if(Nt(R),!z.moved){var P=R.clientX-B,F=R.clientY-G;z.moved=P*P+F*F>g}z.event(R).zoom("mouse",r(b(z.that.__zoom,z.mouse[0]=Ne(R,C),z.mouse[1]),z.extent,o))}function U(R){H.on("mousemove.zoom mouseup.zoom",null),Tv(R.view,z.moved),Nt(R),z.event(R).end()}}function A(w,...T){if(e.apply(this,arguments)){var C=this.__zoom,z=Ne(w.changedTouches?w.changedTouches[0]:w,this),H=C.invert(z),M=C.k*(w.shiftKey?.5:2),B=r(b(y(C,M),z,H),t.apply(this,T),o);Nt(w),s>0?xe(this).transition().duration(s).call(E,B,z,w):xe(this).call(p.transform,B,z,w)}}function I(w,...T){if(e.apply(this,arguments)){var C=w.touches,z=C.length,H=x(this,T,w.changedTouches.length===z).event(w),M,B,G,V;for(on(w),B=0;B"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},Bv=Ue.error001();function ne(e,t){const r=k.useContext(wr);if(r===null)throw new Error(Bv);return yv(r,e,t)}const fe=()=>{const e=k.useContext(wr);if(e===null)throw new Error(Bv);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},L0=e=>e.userSelectionActive?"none":"all";function Du({position:e,children:t,className:r,style:n,...i}){const a=ne(L0),o=`${e}`.split("-");return L.createElement("div",{className:pe(["react-flow__panel",r,...o]),style:{...n,pointerEvents:a},...i},t)}function F0({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:L.createElement(Du,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},L.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const z0=({x:e,y:t,label:r,labelStyle:n={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:u,className:l,...c})=>{const f=k.useRef(null),[d,h]=k.useState({x:0,y:0,width:0,height:0}),_=pe(["react-flow__edge-textwrapper",l]);return k.useEffect(()=>{if(f.current){const g=f.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[r]),typeof r>"u"||!r?null:L.createElement("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:_,visibility:d.width?"visible":"hidden",...c},i&&L.createElement("rect",{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:"react-flow__edge-textbg",style:a,rx:s,ry:s}),L.createElement("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:f,style:n},r),u)};var B0=k.memo(z0);const Lu=e=>({width:e.offsetWidth,height:e.offsetHeight}),wt=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),Fu=(e={x:0,y:0},t)=>({x:wt(e.x,t[0][0],t[1][0]),y:wt(e.y,t[0][1],t[1][1])}),zc=(e,t,r)=>er?-wt(Math.abs(e-r),1,50)/50:0,Hv=(e,t)=>{const r=zc(e.x,35,t.width-35)*20,n=zc(e.y,35,t.height-35)*20;return[r,n]},$v=e=>e.getRootNode?.()||window?.document,Gv=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Ht=({x:e,y:t,width:r,height:n})=>({x:e,y:t,x2:e+r,y2:t+n}),Vv=({x:e,y:t,x2:r,y2:n})=>({x:e,y:t,width:r-e,height:n-t}),Bc=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),H0=(e,t)=>Vv(Gv(Ht(e),Ht(t))),xu=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*n)},$0=e=>Se(e.width)&&Se(e.height)&&Se(e.x)&&Se(e.y),Se=e=>!isNaN(e)&&isFinite(e),se=Symbol.for("internals"),Uv=["Enter"," ","Escape"],G0=(e,t)=>{},V0=e=>"nativeEvent"in e;function Su(e){const r=(V0(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r?.nodeName)||r?.hasAttribute("contenteditable")||!!r?.closest(".nokey")}const jv=e=>"clientX"in e,Je=(e,t)=>{const r=jv(e),n=r?e.clientX:e.touches?.[0].clientX,i=r?e.clientY:e.touches?.[0].clientY;return{x:n-(t?.left??0),y:i-(t?.top??0)}},dr=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,Ut=({id:e,path:t,labelX:r,labelY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h=20})=>L.createElement(L.Fragment,null,L.createElement("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:d}),h&&L.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&Se(r)&&Se(n)?L.createElement(B0,{x:r,y:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l}):null);Ut.displayName="BaseEdge";function It(e,t,r){return r===void 0?r:n=>{const i=t().edges.find(a=>a.id===e);i&&r(n,{...i})}}function Kv({sourceX:e,sourceY:t,targetX:r,targetY:n}){const i=Math.abs(r-e)/2,a=r{const[v,p,y]=Wv({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:n,targetPosition:a});return L.createElement(Ut,{path:v,labelX:p,labelY:y,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:g})});zu.displayName="SimpleBezierEdge";const $c={[J.Left]:{x:-1,y:0},[J.Right]:{x:1,y:0},[J.Top]:{x:0,y:-1},[J.Bottom]:{x:0,y:1}},U0=({source:e,sourcePosition:t=J.Bottom,target:r})=>t===J.Left||t===J.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function j0({source:e,sourcePosition:t=J.Bottom,target:r,targetPosition:n=J.Top,center:i,offset:a}){const o=$c[t],s=$c[n],u={x:e.x+o.x*a,y:e.y+o.y*a},l={x:r.x+s.x*a,y:r.y+s.y*a},c=U0({source:u,sourcePosition:t,target:l}),f=c.x!==0?"x":"y",d=c[f];let h=[],_,g;const v={x:0,y:0},p={x:0,y:0},[y,b,m,E]=Kv({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(o[f]*s[f]===-1){_=i.x??y,g=i.y??b;const S=[{x:_,y:u.y},{x:_,y:l.y}],N=[{x:u.x,y:g},{x:l.x,y:g}];o[f]===d?h=f==="x"?S:N:h=f==="x"?N:S}else{const S=[{x:u.x,y:l.y}],N=[{x:l.x,y:u.y}];if(f==="x"?h=o.x===d?N:S:h=o.y===d?S:N,t===n){const O=Math.abs(e[f]-r[f]);if(O<=a){const w=Math.min(a-1,a-O);o[f]===d?v[f]=(u[f]>e[f]?-1:1)*w:p[f]=(l[f]>r[f]?-1:1)*w}}if(t!==n){const O=f==="x"?"y":"x",w=o[f]===s[O],T=u[O]>l[O],C=u[O]=D?(_=(q.x+A.x)/2,g=h[0].y):(_=h[0].x,g=(q.y+A.y)/2)}return[[e,{x:u.x+v.x,y:u.y+v.y},...h,{x:l.x+p.x,y:l.y+p.y},r],_,g,m,E]}function K0(e,t,r,n){const i=Math.min(Gc(e,t)/2,Gc(t,r)/2,n),{x:a,y:o}=t;if(e.x===a&&a===r.x||e.y===o&&o===r.y)return`L${a} ${o}`;if(e.y===o){const l=e.x{let b="";return y>0&&y{const[p,y,b]=qu({sourceX:e,sourceY:t,sourcePosition:f,targetX:r,targetY:n,targetPosition:d,borderRadius:g?.borderRadius,offset:g?.offset});return L.createElement(Ut,{path:p,labelX:y,labelY:b,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:h,markerStart:_,interactionWidth:v})});Er.displayName="SmoothStepEdge";const Bu=k.memo(e=>L.createElement(Er,{...e,pathOptions:k.useMemo(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));Bu.displayName="StepEdge";function Y0({sourceX:e,sourceY:t,targetX:r,targetY:n}){const[i,a,o,s]=Kv({sourceX:e,sourceY:t,targetX:r,targetY:n});return[`M ${e},${t}L ${r},${n}`,i,a,o,s]}const Hu=k.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h})=>{const[_,g,v]=Y0({sourceX:e,sourceY:t,targetX:r,targetY:n});return L.createElement(Ut,{path:_,labelX:g,labelY:v,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h})});Hu.displayName="StraightEdge";function er(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Vc({pos:e,x1:t,y1:r,x2:n,y2:i,c:a}){switch(e){case J.Left:return[t-er(t-n,a),r];case J.Right:return[t+er(n-t,a),r];case J.Top:return[t,r-er(r-i,a)];case J.Bottom:return[t,r+er(i-r,a)]}}function Zv({sourceX:e,sourceY:t,sourcePosition:r=J.Bottom,targetX:n,targetY:i,targetPosition:a=J.Top,curvature:o=.25}){const[s,u]=Vc({pos:r,x1:e,y1:t,x2:n,y2:i,c:o}),[l,c]=Vc({pos:a,x1:n,y1:i,x2:e,y2:t,c:o}),[f,d,h,_]=Yv({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:s,sourceControlY:u,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${u} ${l},${c} ${n},${i}`,f,d,h,_]}const pr=k.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,sourcePosition:i=J.Bottom,targetPosition:a=J.Top,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,pathOptions:g,interactionWidth:v})=>{const[p,y,b]=Zv({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:n,targetPosition:a,curvature:g?.curvature});return L.createElement(Ut,{path:p,labelX:y,labelY:b,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:v})});pr.displayName="BezierEdge";const $u=k.createContext(null),W0=$u.Provider;$u.Consumer;const Z0=()=>k.useContext($u),X0=e=>"id"in e&&"source"in e&&"target"in e,J0=({source:e,sourceHandle:t,target:r,targetHandle:n})=>`reactflow__edge-${e}${t||""}-${r}${n||""}`,Ru=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(n=>`${n}=${e[n]}`).join("&")}`,Q0=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),ew=(e,t)=>{if(!e.source||!e.target)return t;let r;return X0(e)?r={...e}:r={...e,id:J0(e)},Q0(r,t)?t:t.concat(r)},Cu=({x:e,y:t},[r,n,i],a,[o,s])=>{const u={x:(e-r)/i,y:(t-n)/i};return a?{x:o*Math.round(u.x/o),y:s*Math.round(u.y/s)}:u},Xv=({x:e,y:t},[r,n,i])=>({x:e*i+r,y:t*i+n}),it=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*t[0],n=(e.height??0)*t[1],i={x:e.position.x-r,y:e.position.y-n};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-n}:i}},xr=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((n,i)=>{const{x:a,y:o}=it(i,t).positionAbsolute;return Gv(n,Ht({x:a,y:o,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Vv(r)},Jv=(e,t,[r,n,i]=[0,0,1],a=!1,o=!1,s=[0,0])=>{const u={x:(t.x-r)/i,y:(t.y-n)/i,width:t.width/i,height:t.height/i},l=[];return e.forEach(c=>{const{width:f,height:d,selectable:h=!0,hidden:_=!1}=c;if(o&&!h||_)return!1;const{positionAbsolute:g}=it(c,s),v={x:g.x,y:g.y,width:f||0,height:d||0},p=xu(u,v),y=typeof f>"u"||typeof d>"u"||f===null||d===null,b=a&&p>0,m=(f||0)*(d||0);(y||b||p>=m||c.dragging)&&l.push(c)}),l},Qv=(e,t)=>{const r=e.map(n=>n.id);return t.filter(n=>r.includes(n.source)||r.includes(n.target))},eg=(e,t,r,n,i,a=.1)=>{const o=t/(e.width*(1+a)),s=r/(e.height*(1+a)),u=Math.min(o,s),l=wt(u,n,i),c=e.x+e.width/2,f=e.y+e.height/2,d=t/2-c*l,h=r/2-f*l;return{x:d,y:h,zoom:l}},rt=(e,t=0)=>e.transition().duration(t);function Uc(e,t,r,n){return(t[r]||[]).reduce((i,a)=>(`${e.id}-${a.id}-${r}`!==n&&i.push({id:a.id||null,type:r,nodeId:e.id,x:(e.positionAbsolute?.x??0)+a.x+a.width/2,y:(e.positionAbsolute?.y??0)+a.y+a.height/2}),i),[])}function tw(e,t,r,n,i,a){const{x:o,y:s}=Je(e),l=t.elementsFromPoint(o,s).find(_=>_.classList.contains("react-flow__handle"));if(l){const _=l.getAttribute("data-nodeid");if(_){const g=Gu(void 0,l),v=l.getAttribute("data-handleid"),p=a({nodeId:_,id:v,type:g});if(p){const y=i.find(b=>b.nodeId===_&&b.type===g&&b.id===v);return{handle:{id:v,type:g,nodeId:_,x:y?.x||r.x,y:y?.y||r.y},validHandleResult:p}}}}let c=[],f=1/0;if(i.forEach(_=>{const g=Math.sqrt((_.x-r.x)**2+(_.y-r.y)**2);if(g<=n){const v=a(_);g<=f&&(g_.isValid),h=c.some(({handle:_})=>_.type==="target");return c.find(({handle:_,validHandleResult:g})=>h?_.type==="target":d?g.isValid:!0)||c[0]}const rw={source:null,target:null,sourceHandle:null,targetHandle:null},tg=()=>({handleDomNode:null,isValid:!1,connection:rw,endHandle:null});function rg(e,t,r,n,i,a,o){const s=i==="target",u=o.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),l={...tg(),handleDomNode:u};if(u){const c=Gu(void 0,u),f=u.getAttribute("data-nodeid"),d=u.getAttribute("data-handleid"),h=u.classList.contains("connectable"),_=u.classList.contains("connectableend"),g={source:s?f:r,sourceHandle:s?d:n,target:s?r:f,targetHandle:s?n:d};l.connection=g,h&&_&&(t===ot.Strict?s&&c==="source"||!s&&c==="target":f!==r||d!==n)&&(l.endHandle={nodeId:f,handleId:d,type:c},l.isValid=a(g))}return l}function nw({nodes:e,nodeId:t,handleId:r,handleType:n}){return e.reduce((i,a)=>{if(a[se]){const{handleBounds:o}=a[se];let s=[],u=[];o&&(s=Uc(a,o,"source",`${t}-${r}-${n}`),u=Uc(a,o,"target",`${t}-${r}-${n}`)),i.push(...s,...u)}return i},[])}function Gu(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function sn(e){e?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function iw(e,t){let r=null;return t?r="valid":e&&!t&&(r="invalid"),r}function ng({event:e,handleId:t,nodeId:r,onConnect:n,isTarget:i,getState:a,setState:o,isValidConnection:s,edgeUpdaterType:u,onReconnectEnd:l}){const c=$v(e.target),{connectionMode:f,domNode:d,autoPanOnConnect:h,connectionRadius:_,onConnectStart:g,panBy:v,getNodes:p,cancelConnection:y}=a();let b=0,m;const{x:E,y:x}=Je(e),S=c?.elementFromPoint(E,x),N=Gu(u,S),q=d?.getBoundingClientRect();if(!q||!N)return;let A,I=Je(e,q),D=!1,O=null,w=!1,T=null;const C=nw({nodes:p(),nodeId:r,handleId:t,handleType:N}),z=()=>{if(!h)return;const[B,G]=Hv(I,q);v({x:B,y:G}),b=requestAnimationFrame(z)};o({connectionPosition:I,connectionStatus:null,connectionNodeId:r,connectionHandleId:t,connectionHandleType:N,connectionStartHandle:{nodeId:r,handleId:t,type:N},connectionEndHandle:null}),g?.(e,{nodeId:r,handleId:t,handleType:N});function H(B){const{transform:G}=a();I=Je(B,q);const{handle:V,validHandleResult:U}=tw(B,c,Cu(I,G,!1,[1,1]),_,C,R=>rg(R,f,r,t,i?"target":"source",s,c));if(m=V,D||(z(),D=!0),T=U.handleDomNode,O=U.connection,w=U.isValid,o({connectionPosition:m&&w?Xv({x:m.x,y:m.y},G):I,connectionStatus:iw(!!m,w),connectionEndHandle:U.endHandle}),!m&&!w&&!T)return sn(A);O.source!==O.target&&T&&(sn(A),A=T,T.classList.add("connecting","react-flow__handle-connecting"),T.classList.toggle("valid",w),T.classList.toggle("react-flow__handle-valid",w))}function M(B){(m||T)&&O&&w&&n?.(O),a().onConnectEnd?.(B),u&&l?.(B),sn(A),y(),cancelAnimationFrame(b),D=!1,w=!1,O=null,T=null,c.removeEventListener("mousemove",H),c.removeEventListener("mouseup",M),c.removeEventListener("touchmove",H),c.removeEventListener("touchend",M)}c.addEventListener("mousemove",H),c.addEventListener("mouseup",M),c.addEventListener("touchmove",H),c.addEventListener("touchend",M)}const jc=()=>!0,aw=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),ow=(e,t,r)=>n=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:o}=n;return{connecting:i?.nodeId===e&&i?.handleId===t&&i?.type===r||a?.nodeId===e&&a?.handleId===t&&a?.type===r,clickConnecting:o?.nodeId===e&&o?.handleId===t&&o?.type===r}},ig=k.forwardRef(({type:e="source",position:t=J.Top,isValidConnection:r,isConnectable:n=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:u,className:l,onMouseDown:c,onTouchStart:f,...d},h)=>{const _=o||null,g=e==="target",v=fe(),p=Z0(),{connectOnClick:y,noPanClassName:b}=ne(aw,he),{connecting:m,clickConnecting:E}=ne(ow(p,_,e),he);p||v.getState().onError?.("010",Ue.error010());const x=q=>{const{defaultEdgeOptions:A,onConnect:I,hasDefaultEdges:D}=v.getState(),O={...A,...q};if(D){const{edges:w,setEdges:T}=v.getState();T(ew(O,w))}I?.(O),s?.(O)},S=q=>{if(!p)return;const A=jv(q);i&&(A&&q.button===0||!A)&&ng({event:q,handleId:_,nodeId:p,onConnect:x,isTarget:g,getState:v.getState,setState:v.setState,isValidConnection:r||v.getState().isValidConnection||jc}),A?c?.(q):f?.(q)},N=q=>{const{onClickConnectStart:A,onClickConnectEnd:I,connectionClickStartHandle:D,connectionMode:O,isValidConnection:w}=v.getState();if(!p||!D&&!i)return;if(!D){A?.(q,{nodeId:p,handleId:_,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:p,type:e,handleId:_}});return}const T=$v(q.target),C=r||w||jc,{connection:z,isValid:H}=rg({nodeId:p,id:_,type:e},O,D.nodeId,D.handleId||null,D.type,C,T);H&&x(z),I?.(q),v.setState({connectionClickStartHandle:null})};return L.createElement("div",{"data-handleid":_,"data-nodeid":p,"data-handlepos":t,"data-id":`${p}-${_}-${e}`,className:pe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,l,{source:!g,target:g,connectable:n,connectablestart:i,connectableend:a,connecting:E,connectionindicator:n&&(i&&!m||a&&m)}]),onMouseDown:S,onTouchStart:S,onClick:y?N:void 0,ref:h,...d},u)});ig.displayName="Handle";var vr=k.memo(ig);const ag=({data:e,isConnectable:t,targetPosition:r=J.Top,sourcePosition:n=J.Bottom})=>L.createElement(L.Fragment,null,L.createElement(vr,{type:"target",position:r,isConnectable:t}),e?.label,L.createElement(vr,{type:"source",position:n,isConnectable:t}));ag.displayName="DefaultNode";var Au=k.memo(ag);const og=({data:e,isConnectable:t,sourcePosition:r=J.Bottom})=>L.createElement(L.Fragment,null,e?.label,L.createElement(vr,{type:"source",position:r,isConnectable:t}));og.displayName="InputNode";var sg=k.memo(og);const ug=({data:e,isConnectable:t,targetPosition:r=J.Top})=>L.createElement(L.Fragment,null,L.createElement(vr,{type:"target",position:r,isConnectable:t}),e?.label);ug.displayName="OutputNode";var cg=k.memo(ug);const Vu=()=>null;Vu.displayName="GroupNode";const sw=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),tr=e=>e.id;function uw(e,t){return he(e.selectedNodes.map(tr),t.selectedNodes.map(tr))&&he(e.selectedEdges.map(tr),t.selectedEdges.map(tr))}const lg=k.memo(({onSelectionChange:e})=>{const t=fe(),{selectedNodes:r,selectedEdges:n}=ne(sw,uw);return k.useEffect(()=>{const i={nodes:r,edges:n};e?.(i),t.getState().onSelectionChange.forEach(a=>a(i))},[r,n,e]),null});lg.displayName="SelectionListener";const cw=e=>!!e.onSelectionChange;function lw({onSelectionChange:e}){const t=ne(cw);return e||t?L.createElement(lg,{onSelectionChange:e}):null}const fw=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function dt(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Q(e,t,r){k.useEffect(()=>{typeof t<"u"&&r({[e]:t})},[t])}const dw=({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:i,onConnectStart:a,onConnectEnd:o,onClickConnectStart:s,onClickConnectEnd:u,nodesDraggable:l,nodesConnectable:c,nodesFocusable:f,edgesFocusable:d,edgesUpdatable:h,elevateNodesOnSelect:_,minZoom:g,maxZoom:v,nodeExtent:p,onNodesChange:y,onEdgesChange:b,elementsSelectable:m,connectionMode:E,snapGrid:x,snapToGrid:S,translateExtent:N,connectOnClick:q,defaultEdgeOptions:A,fitView:I,fitViewOptions:D,onNodesDelete:O,onEdgesDelete:w,onNodeDrag:T,onNodeDragStart:C,onNodeDragStop:z,onSelectionDrag:H,onSelectionDragStart:M,onSelectionDragStop:B,noPanClassName:G,nodeOrigin:V,rfId:U,autoPanOnConnect:R,autoPanOnNodeDrag:P,onError:F,connectionRadius:$,isValidConnection:j,nodeDragThreshold:W})=>{const{setNodes:Z,setEdges:te,setDefaultNodesAndEdges:ie,setMinZoom:re,setMaxZoom:ee,setTranslateExtent:X,setNodeExtent:ue,reset:K}=ne(fw,he),Y=fe();return k.useEffect(()=>{const oe=n?.map(Ce=>({...Ce,...A}));return ie(r,oe),()=>{K()}},[]),Q("defaultEdgeOptions",A,Y.setState),Q("connectionMode",E,Y.setState),Q("onConnect",i,Y.setState),Q("onConnectStart",a,Y.setState),Q("onConnectEnd",o,Y.setState),Q("onClickConnectStart",s,Y.setState),Q("onClickConnectEnd",u,Y.setState),Q("nodesDraggable",l,Y.setState),Q("nodesConnectable",c,Y.setState),Q("nodesFocusable",f,Y.setState),Q("edgesFocusable",d,Y.setState),Q("edgesUpdatable",h,Y.setState),Q("elementsSelectable",m,Y.setState),Q("elevateNodesOnSelect",_,Y.setState),Q("snapToGrid",S,Y.setState),Q("snapGrid",x,Y.setState),Q("onNodesChange",y,Y.setState),Q("onEdgesChange",b,Y.setState),Q("connectOnClick",q,Y.setState),Q("fitViewOnInit",I,Y.setState),Q("fitViewOnInitOptions",D,Y.setState),Q("onNodesDelete",O,Y.setState),Q("onEdgesDelete",w,Y.setState),Q("onNodeDrag",T,Y.setState),Q("onNodeDragStart",C,Y.setState),Q("onNodeDragStop",z,Y.setState),Q("onSelectionDrag",H,Y.setState),Q("onSelectionDragStart",M,Y.setState),Q("onSelectionDragStop",B,Y.setState),Q("noPanClassName",G,Y.setState),Q("nodeOrigin",V,Y.setState),Q("rfId",U,Y.setState),Q("autoPanOnConnect",R,Y.setState),Q("autoPanOnNodeDrag",P,Y.setState),Q("onError",F,Y.setState),Q("connectionRadius",$,Y.setState),Q("isValidConnection",j,Y.setState),Q("nodeDragThreshold",W,Y.setState),dt(e,Z),dt(t,te),dt(g,re),dt(v,ee),dt(N,X),dt(p,ue),null},Kc={display:"none"},hw={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},fg="react-flow__node-desc",dg="react-flow__edge-desc",pw="react-flow__aria-live",vw=e=>e.ariaLiveMessage;function gw({rfId:e}){const t=ne(vw);return L.createElement("div",{id:`${pw}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:hw},t)}function yw({rfId:e,disableKeyboardA11y:t}){return L.createElement(L.Fragment,null,L.createElement("div",{id:`${fg}-${e}`,style:Kc},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),L.createElement("div",{id:`${dg}-${e}`,style:Kc},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&L.createElement(gw,{rfId:e}))}var Gt=(e=null,t={actInsideInputWithModifier:!0})=>{const[r,n]=k.useState(!1),i=k.useRef(!1),a=k.useRef(new Set([])),[o,s]=k.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.split("+")),c=l.reduce((f,d)=>f.concat(...d),[]);return[l,c]}return[[],[]]},[e]);return k.useEffect(()=>{const u=typeof document<"u"?document:null,l=t?.target||u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Su(h))return!1;const g=Wc(h.code,s);a.current.add(h[g]),Yc(o,a.current,!1)&&(h.preventDefault(),n(!0))},f=h=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Su(h))return!1;const g=Wc(h.code,s);Yc(o,a.current,!0)?(n(!1),a.current.clear()):a.current.delete(h[g]),h.key==="Meta"&&a.current.clear(),i.current=!1},d=()=>{a.current.clear(),n(!1)};return l?.addEventListener("keydown",c),l?.addEventListener("keyup",f),window.addEventListener("blur",d),()=>{l?.removeEventListener("keydown",c),l?.removeEventListener("keyup",f),window.removeEventListener("blur",d)}}},[e,n]),r};function Yc(e,t,r){return e.filter(n=>r||n.length===t.size).some(n=>n.every(i=>t.has(i)))}function Wc(e,t){return t.includes(e)?"code":"key"}function hg(e,t,r,n){const i=e.parentNode||e.parentId;if(!i)return r;const a=t.get(i),o=it(a,n);return hg(a,t,{x:(r.x??0)+o.x,y:(r.y??0)+o.y,z:(a[se]?.z??0)>(r.z??0)?a[se]?.z??0:r.z??0},n)}function pg(e,t,r){e.forEach(n=>{const i=n.parentNode||n.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||r?.[n.id]){const{x:a,y:o,z:s}=hg(n,e,{...n.position,z:n[se]?.z??0},t);n.positionAbsolute={x:a,y:o},n[se].z=s,r?.[n.id]&&(n[se].isParent=!0)}})}function un(e,t,r,n){const i=new Map,a={},o=n?1e3:0;return e.forEach(s=>{const u=(Se(s.zIndex)?s.zIndex:0)+(s.selected?o:0),l=t.get(s.id),c={...s,positionAbsolute:{x:s.position.x,y:s.position.y}},f=s.parentNode||s.parentId;f&&(a[f]=!0);const d=l?.type&&l?.type!==s.type;Object.defineProperty(c,se,{enumerable:!1,value:{handleBounds:d?void 0:l?.[se]?.handleBounds,z:u}}),i.set(s.id,c)}),pg(i,r,a),i}function vg(e,t={}){const{getNodes:r,width:n,height:i,minZoom:a,maxZoom:o,d3Zoom:s,d3Selection:u,fitViewOnInitDone:l,fitViewOnInit:c,nodeOrigin:f}=e(),d=t.initial&&!l&&c;if(s&&u&&(d||!t.initial)){const _=r().filter(v=>{const p=t.includeHiddenNodes?v.width&&v.height:!v.hidden;return t.nodes?.length?p&&t.nodes.some(y=>y.id===v.id):p}),g=_.every(v=>v.width&&v.height);if(_.length>0&&g){const v=xr(_,f),{x:p,y,zoom:b}=eg(v,n,i,t.minZoom??a,t.maxZoom??o,t.padding??.1),m=Ge.translate(p,y).scale(b);return typeof t.duration=="number"&&t.duration>0?s.transform(rt(u,t.duration),m):s.transform(u,m),!0}}return!1}function mw(e,t){return e.forEach(r=>{const n=t.get(r.id);n&&t.set(n.id,{...n,[se]:n[se],selected:r.selected})}),new Map(t)}function _w(e,t){return t.map(r=>{const n=e.find(i=>i.id===r.id);return n&&(r.selected=n.selected),r})}function rr({changedNodes:e,changedEdges:t,get:r,set:n}){const{nodeInternals:i,edges:a,onNodesChange:o,onEdgesChange:s,hasDefaultNodes:u,hasDefaultEdges:l}=r();e?.length&&(u&&n({nodeInternals:mw(e,i)}),o?.(e)),t?.length&&(l&&n({edges:_w(t,a)}),s?.(t))}const ht=()=>{},bw={zoomIn:ht,zoomOut:ht,zoomTo:ht,getZoom:()=>1,setViewport:ht,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ht,fitBounds:ht,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},ww=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Ew=()=>{const e=fe(),{d3Zoom:t,d3Selection:r}=ne(ww,he);return k.useMemo(()=>r&&t?{zoomIn:i=>t.scaleBy(rt(r,i?.duration),1.2),zoomOut:i=>t.scaleBy(rt(r,i?.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(rt(r,a?.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[o,s,u]=e.getState().transform,l=Ge.translate(i.x??o,i.y??s).scale(i.zoom??u);t.transform(rt(r,a?.duration),l)},getViewport:()=>{const[i,a,o]=e.getState().transform;return{x:i,y:a,zoom:o}},fitView:i=>vg(e.getState,i),setCenter:(i,a,o)=>{const{width:s,height:u,maxZoom:l}=e.getState(),c=typeof o?.zoom<"u"?o.zoom:l,f=s/2-i*c,d=u/2-a*c,h=Ge.translate(f,d).scale(c);t.transform(rt(r,o?.duration),h)},fitBounds:(i,a)=>{const{width:o,height:s,minZoom:u,maxZoom:l}=e.getState(),{x:c,y:f,zoom:d}=eg(i,o,s,u,l,a?.padding??.1),h=Ge.translate(c,f).scale(d);t.transform(rt(r,a?.duration),h)},project:i=>{const{transform:a,snapToGrid:o,snapGrid:s}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Cu(i,a,o,s)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:o,snapGrid:s,domNode:u}=e.getState();if(!u)return i;const{x:l,y:c}=u.getBoundingClientRect(),f={x:i.x-l,y:i.y-c};return Cu(f,a,o,s)},flowToScreenPosition:i=>{const{transform:a,domNode:o}=e.getState();if(!o)return i;const{x:s,y:u}=o.getBoundingClientRect(),l=Xv(i,a);return{x:l.x+s,y:l.y+u}},viewportInitialized:!0}:bw,[t,r])};function Uu(){const e=Ew(),t=fe(),r=k.useCallback(()=>t.getState().getNodes().map(g=>({...g})),[]),n=k.useCallback(g=>t.getState().nodeInternals.get(g),[]),i=k.useCallback(()=>{const{edges:g=[]}=t.getState();return g.map(v=>({...v}))},[]),a=k.useCallback(g=>{const{edges:v=[]}=t.getState();return v.find(p=>p.id===g)},[]),o=k.useCallback(g=>{const{getNodes:v,setNodes:p,hasDefaultNodes:y,onNodesChange:b}=t.getState(),m=v(),E=typeof g=="function"?g(m):g;if(y)p(E);else if(b){const x=E.length===0?m.map(S=>({type:"remove",id:S.id})):E.map(S=>({item:S,type:"reset"}));b(x)}},[]),s=k.useCallback(g=>{const{edges:v=[],setEdges:p,hasDefaultEdges:y,onEdgesChange:b}=t.getState(),m=typeof g=="function"?g(v):g;if(y)p(m);else if(b){const E=m.length===0?v.map(x=>({type:"remove",id:x.id})):m.map(x=>({item:x,type:"reset"}));b(E)}},[]),u=k.useCallback(g=>{const v=Array.isArray(g)?g:[g],{getNodes:p,setNodes:y,hasDefaultNodes:b,onNodesChange:m}=t.getState();if(b){const x=[...p(),...v];y(x)}else if(m){const E=v.map(x=>({item:x,type:"add"}));m(E)}},[]),l=k.useCallback(g=>{const v=Array.isArray(g)?g:[g],{edges:p=[],setEdges:y,hasDefaultEdges:b,onEdgesChange:m}=t.getState();if(b)y([...p,...v]);else if(m){const E=v.map(x=>({item:x,type:"add"}));m(E)}},[]),c=k.useCallback(()=>{const{getNodes:g,edges:v=[],transform:p}=t.getState(),[y,b,m]=p;return{nodes:g().map(E=>({...E})),edges:v.map(E=>({...E})),viewport:{x:y,y:b,zoom:m}}},[]),f=k.useCallback(({nodes:g,edges:v})=>{const{nodeInternals:p,getNodes:y,edges:b,hasDefaultNodes:m,hasDefaultEdges:E,onNodesDelete:x,onEdgesDelete:S,onNodesChange:N,onEdgesChange:q}=t.getState(),A=(g||[]).map(T=>T.id),I=(v||[]).map(T=>T.id),D=y().reduce((T,C)=>{const z=C.parentNode||C.parentId,H=!A.includes(C.id)&&z&&T.find(B=>B.id===z);return(typeof C.deletable=="boolean"?C.deletable:!0)&&(A.includes(C.id)||H)&&T.push(C),T},[]),O=b.filter(T=>typeof T.deletable=="boolean"?T.deletable:!0),w=O.filter(T=>I.includes(T.id));if(D||w){const T=Qv(D,O),C=[...w,...T],z=C.reduce((H,M)=>(H.includes(M.id)||H.push(M.id),H),[]);if((E||m)&&(E&&t.setState({edges:b.filter(H=>!z.includes(H.id))}),m&&(D.forEach(H=>{p.delete(H.id)}),t.setState({nodeInternals:new Map(p)}))),z.length>0&&(S?.(C),q&&q(z.map(H=>({id:H,type:"remove"})))),D.length>0&&(x?.(D),N)){const H=D.map(M=>({id:M.id,type:"remove"}));N(H)}}},[]),d=k.useCallback(g=>{const v=$0(g),p=v?null:t.getState().nodeInternals.get(g.id);return!v&&!p?[null,null,v]:[v?g:Bc(p),p,v]},[]),h=k.useCallback((g,v=!0,p)=>{const[y,b,m]=d(g);return y?(p||t.getState().getNodes()).filter(E=>{if(!m&&(E.id===b.id||!E.positionAbsolute))return!1;const x=Bc(E),S=xu(x,y);return v&&S>0||S>=y.width*y.height}):[]},[]),_=k.useCallback((g,v,p=!0)=>{const[y]=d(g);if(!y)return!1;const b=xu(y,v);return p&&b>0||b>=y.width*y.height},[]);return k.useMemo(()=>({...e,getNodes:r,getNode:n,getEdges:i,getEdge:a,setNodes:o,setEdges:s,addNodes:u,addEdges:l,toObject:c,deleteElements:f,getIntersectingNodes:h,isNodeIntersecting:_}),[e,r,n,i,a,o,s,u,l,c,f,h,_])}const xw={actInsideInputWithModifier:!1};var Sw=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const r=fe(),{deleteElements:n}=Uu(),i=Gt(e,xw),a=Gt(t);k.useEffect(()=>{if(i){const{edges:o,getNodes:s}=r.getState(),u=s().filter(c=>c.selected),l=o.filter(c=>c.selected);n({nodes:u,edges:l}),r.setState({nodesSelectionActive:!1})}},[i]),k.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])};function qw(e){const t=fe();k.useEffect(()=>{let r;const n=()=>{if(!e.current)return;const i=Lu(e.current);(i.height===0||i.width===0)&&t.getState().onError?.("004",Ue.error004()),t.setState({width:i.width||500,height:i.height||500})};return n(),window.addEventListener("resize",n),e.current&&(r=new ResizeObserver(()=>n()),r.observe(e.current)),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}},[])}const ju={position:"absolute",width:"100%",height:"100%",top:0,left:0},Rw=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,nr=e=>({x:e.x,y:e.y,zoom:e.k}),pt=(e,t)=>e.target.closest(`.${t}`),Zc=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xc=e=>{const t=e.ctrlKey&&dr()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Cw=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Aw=({onMove:e,onMoveStart:t,onMoveEnd:r,onPaneContextMenu:n,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:u=nt.Free,zoomOnDoubleClick:l=!0,elementsSelectable:c,panOnDrag:f=!0,defaultViewport:d,translateExtent:h,minZoom:_,maxZoom:g,zoomActivationKeyCode:v,preventScrolling:p=!0,children:y,noWheelClassName:b,noPanClassName:m})=>{const E=k.useRef(),x=fe(),S=k.useRef(!1),N=k.useRef(!1),q=k.useRef(null),A=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:D,d3ZoomHandler:O,userSelectionActive:w}=ne(Cw,he),T=Gt(v),C=k.useRef(0),z=k.useRef(!1),H=k.useRef();return qw(q),k.useEffect(()=>{if(q.current){const M=q.current.getBoundingClientRect(),B=zv().scaleExtent([_,g]).translateExtent(h),G=xe(q.current).call(B),V=Ge.translate(d.x,d.y).scale(wt(d.zoom,_,g)),U=[[0,0],[M.width,M.height]],R=B.constrain()(V,U,h);B.transform(G,R),B.wheelDelta(Xc),x.setState({d3Zoom:B,d3Selection:G,d3ZoomHandler:G.on("wheel.zoom"),transform:[R.x,R.y,R.k],domNode:q.current.closest(".react-flow")})}},[]),k.useEffect(()=>{D&&I&&(o&&!T&&!w?D.on("wheel.zoom",M=>{if(pt(M,b))return!1;M.preventDefault(),M.stopImmediatePropagation();const B=D.property("__zoom").k||1;if(M.ctrlKey&&a){const j=Ne(M),W=Xc(M),Z=B*Math.pow(2,W);I.scaleTo(D,Z,j,M);return}const G=M.deltaMode===1?20:1;let V=u===nt.Vertical?0:M.deltaX*G,U=u===nt.Horizontal?0:M.deltaY*G;!dr()&&M.shiftKey&&u!==nt.Vertical&&(V=M.deltaY*G,U=0),I.translateBy(D,-(V/B)*s,-(U/B)*s,{internal:!0});const R=nr(D.property("__zoom")),{onViewportChangeStart:P,onViewportChange:F,onViewportChangeEnd:$}=x.getState();clearTimeout(H.current),z.current||(z.current=!0,t?.(M,R),P?.(R)),z.current&&(e?.(M,R),F?.(R),H.current=setTimeout(()=>{r?.(M,R),$?.(R),z.current=!1},150))},{passive:!1}):typeof O<"u"&&D.on("wheel.zoom",function(M,B){if(!p&&M.type==="wheel"&&!M.ctrlKey||pt(M,b))return null;M.preventDefault(),O.call(this,M,B)},{passive:!1}))},[w,o,u,D,I,O,T,a,p,b,t,e,r]),k.useEffect(()=>{I&&I.on("start",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;C.current=M.sourceEvent?.button;const{onViewportChangeStart:B}=x.getState(),G=nr(M.transform);S.current=!0,A.current=G,M.sourceEvent?.type==="mousedown"&&x.setState({paneDragging:!0}),B?.(G),t?.(M.sourceEvent,G)})},[I,t]),k.useEffect(()=>{I&&(w&&!S.current?I.on("zoom",null):w||I.on("zoom",M=>{const{onViewportChange:B}=x.getState();if(x.setState({transform:[M.transform.x,M.transform.y,M.transform.k]}),N.current=!!(n&&Zc(f,C.current??0)),(e||B)&&!M.sourceEvent?.internal){const G=nr(M.transform);B?.(G),e?.(M.sourceEvent,G)}}))},[w,I,e,f,n]),k.useEffect(()=>{I&&I.on("end",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=x.getState();if(S.current=!1,x.setState({paneDragging:!1}),n&&Zc(f,C.current??0)&&!N.current&&n(M.sourceEvent),N.current=!1,(r||B)&&Rw(A.current,M.transform)){const G=nr(M.transform);A.current=G,clearTimeout(E.current),E.current=setTimeout(()=>{B?.(G),r?.(M.sourceEvent,G)},o?150:0)}})},[I,o,f,r,n]),k.useEffect(()=>{I&&I.filter(M=>{const B=T||i,G=a&&M.ctrlKey;if((f===!0||Array.isArray(f)&&f.includes(1))&&M.button===1&&M.type==="mousedown"&&(pt(M,"react-flow__node")||pt(M,"react-flow__edge")))return!0;if(!f&&!B&&!o&&!l&&!a||w||!l&&M.type==="dblclick"||pt(M,b)&&M.type==="wheel"||pt(M,m)&&(M.type!=="wheel"||o&&M.type==="wheel"&&!T)||!a&&M.ctrlKey&&M.type==="wheel"||!B&&!o&&!G&&M.type==="wheel"||!f&&(M.type==="mousedown"||M.type==="touchstart")||Array.isArray(f)&&!f.includes(M.button)&&M.type==="mousedown")return!1;const V=Array.isArray(f)&&f.includes(M.button)||!M.button||M.button<=1;return(!M.ctrlKey||M.type==="wheel")&&V})},[w,I,i,a,o,l,f,c,T]),L.createElement("div",{className:"react-flow__renderer",ref:q,style:ju},y)},Nw=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Iw(){const{userSelectionActive:e,userSelectionRect:t}=ne(Nw,he);return e&&t?L.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Jc(e,t){const r=t.parentNode||t.parentId,n=e.find(i=>i.id===r);if(n){const i=t.position.x+t.width-n.width,a=t.position.y+t.height-n.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,i>0&&(n.style.width+=i),a>0&&(n.style.height+=a),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function gg(e,t){if(e.some(n=>n.type==="reset"))return e.filter(n=>n.type==="reset").map(n=>n.item);const r=e.filter(n=>n.type==="add").map(n=>n.item);return t.reduce((n,i)=>{const a=e.filter(s=>s.id===i.id);if(a.length===0)return n.push(i),n;const o={...i};for(const s of a)if(s)switch(s.type){case"select":{o.selected=s.selected;break}case"position":{typeof s.position<"u"&&(o.position=s.position),typeof s.positionAbsolute<"u"&&(o.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(o.dragging=s.dragging),o.expandParent&&Jc(n,o);break}case"dimensions":{typeof s.dimensions<"u"&&(o.width=s.dimensions.width,o.height=s.dimensions.height),typeof s.updateStyle<"u"&&(o.style={...o.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(o.resizing=s.resizing),o.expandParent&&Jc(n,o);break}case"remove":return n}return n.push(o),n},r)}function yg(e,t){return gg(e,t)}function Tw(e,t){return gg(e,t)}const Ze=(e,t)=>({id:e,type:"select",selected:t});function gt(e,t){return e.reduce((r,n)=>{const i=t.includes(n.id);return!n.selected&&i?(n.selected=!0,r.push(Ze(n.id,!0))):n.selected&&!i&&(n.selected=!1,r.push(Ze(n.id,!1))),r},[])}const cn=(e,t)=>r=>{r.target===t.current&&e?.(r)},Mw=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),mg=k.memo(({isSelecting:e,selectionMode:t=$t.Full,panOnDrag:r,onSelectionStart:n,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:o,onPaneScroll:s,onPaneMouseEnter:u,onPaneMouseMove:l,onPaneMouseLeave:c,children:f})=>{const d=k.useRef(null),h=fe(),_=k.useRef(0),g=k.useRef(0),v=k.useRef(),{userSelectionActive:p,elementsSelectable:y,dragging:b}=ne(Mw,he),m=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},E=O=>{a?.(O),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},x=O=>{if(Array.isArray(r)&&r?.includes(2)){O.preventDefault();return}o?.(O)},S=s?O=>s(O):void 0,N=O=>{const{resetSelectedElements:w,domNode:T}=h.getState();if(v.current=T?.getBoundingClientRect(),!y||!e||O.button!==0||O.target!==d.current||!v.current)return;const{x:C,y:z}=Je(O,v.current);w(),h.setState({userSelectionRect:{width:0,height:0,startX:C,startY:z,x:C,y:z}}),n?.(O)},q=O=>{const{userSelectionRect:w,nodeInternals:T,edges:C,transform:z,onNodesChange:H,onEdgesChange:M,nodeOrigin:B,getNodes:G}=h.getState();if(!e||!v.current||!w)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Je(O,v.current),U=w.startX??0,R=w.startY??0,P={...w,x:V.xZ.id),W=$.map(Z=>Z.id);if(_.current!==W.length){_.current=W.length;const Z=gt(F,W);Z.length&&H?.(Z)}if(g.current!==j.length){g.current=j.length;const Z=gt(C,j);Z.length&&M?.(Z)}h.setState({userSelectionRect:P})},A=O=>{if(O.button!==0)return;const{userSelectionRect:w}=h.getState();!p&&w&&O.target===d.current&&E?.(O),h.setState({nodesSelectionActive:_.current>0}),m(),i?.(O)},I=O=>{p&&(h.setState({nodesSelectionActive:_.current>0}),i?.(O)),m()},D=y&&(e||p);return L.createElement("div",{className:pe(["react-flow__pane",{dragging:b,selection:e}]),onClick:D?void 0:cn(E,d),onContextMenu:cn(x,d),onWheel:cn(S,d),onMouseEnter:D?void 0:u,onMouseDown:D?N:void 0,onMouseMove:D?q:l,onMouseUp:D?A:void 0,onMouseLeave:D?I:c,ref:d,style:ju},f,L.createElement(Iw,null))});mg.displayName="Pane";function _g(e,t){const r=e.parentNode||e.parentId;if(!r)return!1;const n=t.get(r);return n?n.selected?!0:_g(n,t):!1}function Qc(e,t,r){let n=e;do{if(n?.matches(t))return!0;if(n===r.current)return!1;n=n.parentElement}while(n);return!1}function Pw(e,t,r,n){return Array.from(e.values()).filter(i=>(i.selected||i.id===n)&&(!i.parentNode||i.parentId||!_g(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>({id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:r.x-(i.positionAbsolute?.x??0),y:r.y-(i.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}))}function Ow(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function bg(e,t,r,n,i=[0,0],a){const o=Ow(e,e.extent||n);let s=o;const u=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(u&&e.width&&e.height){const f=r.get(u),{x:d,y:h}=it(f,i).positionAbsolute;s=f&&Se(d)&&Se(h)&&Se(f.width)&&Se(f.height)?[[d+e.width*i[0],h+e.height*i[1]],[d+f.width-e.width+e.width*i[0],h+f.height-e.height+e.height*i[1]]]:s}else a?.("005",Ue.error005()),s=o;else if(e.extent&&u&&e.extent!=="parent"){const f=r.get(u),{x:d,y:h}=it(f,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+h],[e.extent[1][0]+d,e.extent[1][1]+h]]}let l={x:0,y:0};if(u){const f=r.get(u);l=it(f,i).positionAbsolute}const c=s&&s!=="parent"?Fu(t,s):t;return{position:{x:c.x-l.x,y:c.y-l.y},positionAbsolute:c}}function ln({nodeId:e,dragItems:t,nodeInternals:r}){const n=t.map(i=>({...r.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?n.find(i=>i.id===e):n[0],n]}const el=(e,t,r,n)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),o=t.getBoundingClientRect(),s={x:o.width*n[0],y:o.height*n[1]};return a.map(u=>{const l=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),position:u.getAttribute("data-handlepos"),x:(l.left-o.left-s.x)/r,y:(l.top-o.top-s.y)/r,...Lu(u)}})};function Tt(e,t,r){return r===void 0?r:n=>{const i=t().nodeInternals.get(e);i&&r(n,{...i})}}function Nu({id:e,store:t,unselect:r=!1,nodeRef:n}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeInternals:s,onError:u}=t.getState(),l=s.get(e);if(!l){u?.("012",Ue.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(r||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>n?.current?.blur())):i([e])}function kw(){const e=fe();return k.useCallback(({sourceEvent:r})=>{const{transform:n,snapGrid:i,snapToGrid:a}=e.getState(),o=r.touches?r.touches[0].clientX:r.clientX,s=r.touches?r.touches[0].clientY:r.clientY,u={x:(o-n[0])/n[2],y:(s-n[1])/n[2]};return{xSnapped:a?i[0]*Math.round(u.x/i[0]):u.x,ySnapped:a?i[1]*Math.round(u.y/i[1]):u.y,...u}},[])}function fn(e){return(t,r,n)=>e?.(t,n)}function wg({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:n,nodeId:i,isSelectable:a,selectNodesOnDrag:o}){const s=fe(),[u,l]=k.useState(!1),c=k.useRef([]),f=k.useRef({x:null,y:null}),d=k.useRef(0),h=k.useRef(null),_=k.useRef({x:0,y:0}),g=k.useRef(null),v=k.useRef(!1),p=k.useRef(!1),y=k.useRef(!1),b=kw();return k.useEffect(()=>{if(e?.current){const m=xe(e.current),E=({x:N,y:q})=>{const{nodeInternals:A,onNodeDrag:I,onSelectionDrag:D,updateNodePositions:O,nodeExtent:w,snapGrid:T,snapToGrid:C,nodeOrigin:z,onError:H}=s.getState();f.current={x:N,y:q};let M=!1,B={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&w){const V=xr(c.current,z);B=Ht(V)}if(c.current=c.current.map(V=>{const U={x:N-V.distance.x,y:q-V.distance.y};C&&(U.x=T[0]*Math.round(U.x/T[0]),U.y=T[1]*Math.round(U.y/T[1]));const R=[[w[0][0],w[0][1]],[w[1][0],w[1][1]]];c.current.length>1&&w&&!V.extent&&(R[0][0]=V.positionAbsolute.x-B.x+w[0][0],R[1][0]=V.positionAbsolute.x+(V.width??0)-B.x2+w[1][0],R[0][1]=V.positionAbsolute.y-B.y+w[0][1],R[1][1]=V.positionAbsolute.y+(V.height??0)-B.y2+w[1][1]);const P=bg(V,U,A,R,z,H);return M=M||V.position.x!==P.position.x||V.position.y!==P.position.y,V.position=P.position,V.positionAbsolute=P.positionAbsolute,V}),!M)return;O(c.current,!0,!0),l(!0);const G=i?I:fn(D);if(G&&g.current){const[V,U]=ln({nodeId:i,dragItems:c.current,nodeInternals:A});G(g.current,V,U)}},x=()=>{if(!h.current)return;const[N,q]=Hv(_.current,h.current);if(N!==0||q!==0){const{transform:A,panBy:I}=s.getState();f.current.x=(f.current.x??0)-N/A[2],f.current.y=(f.current.y??0)-q/A[2],I({x:N,y:q})&&E(f.current)}d.current=requestAnimationFrame(x)},S=N=>{const{nodeInternals:q,multiSelectionActive:A,nodesDraggable:I,unselectNodesAndEdges:D,onNodeDragStart:O,onSelectionDragStart:w}=s.getState();p.current=!0;const T=i?O:fn(w);(!o||!a)&&!A&&i&&(q.get(i)?.selected||D()),i&&a&&o&&Nu({id:i,store:s,nodeRef:e});const C=b(N);if(f.current=C,c.current=Pw(q,I,C,i),T&&c.current){const[z,H]=ln({nodeId:i,dragItems:c.current,nodeInternals:q});T(N.sourceEvent,z,H)}};if(t)m.on(".drag",null);else{const N=mb().on("start",q=>{const{domNode:A,nodeDragThreshold:I}=s.getState();I===0&&S(q),y.current=!1;const D=b(q);f.current=D,h.current=A?.getBoundingClientRect()||null,_.current=Je(q.sourceEvent,h.current)}).on("drag",q=>{const A=b(q),{autoPanOnNodeDrag:I,nodeDragThreshold:D}=s.getState();if(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!v.current&&p.current&&I&&(v.current=!0,x()),!p.current){const O=A.xSnapped-(f?.current?.x??0),w=A.ySnapped-(f?.current?.y??0);Math.sqrt(O*O+w*w)>D&&S(q)}(f.current.x!==A.xSnapped||f.current.y!==A.ySnapped)&&c.current&&p.current&&(g.current=q.sourceEvent,_.current=Je(q.sourceEvent,h.current),E(A))}}).on("end",q=>{if(!(!p.current||y.current)&&(l(!1),v.current=!1,p.current=!1,cancelAnimationFrame(d.current),c.current)){const{updateNodePositions:A,nodeInternals:I,onNodeDragStop:D,onSelectionDragStop:O}=s.getState(),w=i?D:fn(O);if(A(c.current,!1,!1),w){const[T,C]=ln({nodeId:i,dragItems:c.current,nodeInternals:I});w(q.sourceEvent,T,C)}}}).filter(q=>{const A=q.target;return!q.button&&(!r||!Qc(A,`.${r}`,e))&&(!n||Qc(A,n,e))});return m.call(N),()=>{m.on(".drag",null)}}}},[e,t,r,n,a,s,i,o,b]),u}function Eg(){const e=fe();return k.useCallback(r=>{const{nodeInternals:n,nodeExtent:i,updateNodePositions:a,getNodes:o,snapToGrid:s,snapGrid:u,onError:l,nodesDraggable:c}=e.getState(),f=o().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),d=s?u[0]:5,h=s?u[1]:5,_=r.isShiftPressed?4:1,g=r.x*d*_,v=r.y*h*_,p=f.map(y=>{if(y.positionAbsolute){const b={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+v};s&&(b.x=u[0]*Math.round(b.x/u[0]),b.y=u[1]*Math.round(b.y/u[1]));const{positionAbsolute:m,position:E}=bg(y,b,n,i,void 0,l);y.position=E,y.positionAbsolute=m}return y});a(p,!0,!1)},[])}const mt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Mt=e=>{const t=({id:r,type:n,data:i,xPos:a,yPos:o,xPosOrigin:s,yPosOrigin:u,selected:l,onClick:c,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,onContextMenu:_,onDoubleClick:g,style:v,className:p,isDraggable:y,isSelectable:b,isConnectable:m,isFocusable:E,selectNodesOnDrag:x,sourcePosition:S,targetPosition:N,hidden:q,resizeObserver:A,dragHandle:I,zIndex:D,isParent:O,noDragClassName:w,noPanClassName:T,initialized:C,disableKeyboardA11y:z,ariaLabel:H,rfId:M,hasHandleBounds:B})=>{const G=fe(),V=k.useRef(null),U=k.useRef(null),R=k.useRef(S),P=k.useRef(N),F=k.useRef(n),$=b||y||c||f||d||h,j=Eg(),W=Tt(r,G.getState,f),Z=Tt(r,G.getState,d),te=Tt(r,G.getState,h),ie=Tt(r,G.getState,_),re=Tt(r,G.getState,g),ee=K=>{const{nodeDragThreshold:Y}=G.getState();if(b&&(!x||!y||Y>0)&&Nu({id:r,store:G,nodeRef:V}),c){const oe=G.getState().nodeInternals.get(r);oe&&c(K,{...oe})}},X=K=>{if(!Su(K)&&!z)if(Uv.includes(K.key)&&b){const Y=K.key==="Escape";Nu({id:r,store:G,unselect:Y,nodeRef:V})}else y&&l&&Object.prototype.hasOwnProperty.call(mt,K.key)&&(G.setState({ariaLiveMessage:`Moved selected node ${K.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~o}`}),j({x:mt[K.key].x,y:mt[K.key].y,isShiftPressed:K.shiftKey}))};k.useEffect(()=>()=>{U.current&&(A?.unobserve(U.current),U.current=null)},[]),k.useEffect(()=>{if(V.current&&!q){const K=V.current;(!C||!B||U.current!==K)&&(U.current&&A?.unobserve(U.current),A?.observe(K),U.current=K)}},[q,C,B]),k.useEffect(()=>{const K=F.current!==n,Y=R.current!==S,oe=P.current!==N;V.current&&(K||Y||oe)&&(K&&(F.current=n),Y&&(R.current=S),oe&&(P.current=N),G.getState().updateNodeDimensions([{id:r,nodeElement:V.current,forceUpdate:!0}]))},[r,n,S,N]);const ue=wg({nodeRef:V,disabled:q||!y,noDragClassName:w,handleSelector:I,nodeId:r,isSelectable:b,selectNodesOnDrag:x});return q?null:L.createElement("div",{className:pe(["react-flow__node",`react-flow__node-${n}`,{[T]:y},p,{selected:l,selectable:b,parent:O,dragging:ue}]),ref:V,style:{zIndex:D,transform:`translate(${s}px,${u}px)`,pointerEvents:$?"all":"none",visibility:C?"visible":"hidden",...v},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:W,onMouseMove:Z,onMouseLeave:te,onContextMenu:ie,onClick:ee,onDoubleClick:re,onKeyDown:E?X:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":z?void 0:`${fg}-${M}`,"aria-label":H},L.createElement(W0,{value:r},L.createElement(e,{id:r,data:i,type:n,xPos:a,yPos:o,selected:l,isConnectable:m,sourcePosition:S,targetPosition:N,dragging:ue,dragHandle:I,zIndex:D})))};return t.displayName="NodeWrapper",k.memo(t)};const Dw=e=>{const t=e.getNodes().filter(r=>r.selected);return{...xr(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function Lw({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const n=fe(),{width:i,height:a,x:o,y:s,transformString:u,userSelectionActive:l}=ne(Dw,he),c=Eg(),f=k.useRef(null);if(k.useEffect(()=>{r||f.current?.focus({preventScroll:!0})},[r]),wg({nodeRef:f}),l||!i||!a)return null;const d=e?_=>{const g=n.getState().getNodes().filter(v=>v.selected);e(_,g)}:void 0,h=_=>{Object.prototype.hasOwnProperty.call(mt,_.key)&&c({x:mt[_.key].x,y:mt[_.key].y,isShiftPressed:_.shiftKey})};return L.createElement("div",{className:pe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u}},L.createElement("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:r?void 0:-1,onKeyDown:r?void 0:h,style:{width:i,height:a,top:s,left:o}}))}var Fw=k.memo(Lw);const zw=e=>e.nodesSelectionActive,xg=({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,deleteKeyCode:s,onMove:u,onMoveStart:l,onMoveEnd:c,selectionKeyCode:f,selectionOnDrag:d,selectionMode:h,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:v,panActivationKeyCode:p,zoomActivationKeyCode:y,elementsSelectable:b,zoomOnScroll:m,zoomOnPinch:E,panOnScroll:x,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:q,panOnDrag:A,defaultViewport:I,translateExtent:D,minZoom:O,maxZoom:w,preventScrolling:T,onSelectionContextMenu:C,noWheelClassName:z,noPanClassName:H,disableKeyboardA11y:M})=>{const B=ne(zw),G=Gt(f),V=Gt(p),U=V||A,R=V||x,P=G||d&&U!==!0;return Sw({deleteKeyCode:s,multiSelectionKeyCode:v}),L.createElement(Aw,{onMove:u,onMoveStart:l,onMoveEnd:c,onPaneContextMenu:a,elementsSelectable:b,zoomOnScroll:m,zoomOnPinch:E,panOnScroll:R,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:q,panOnDrag:!G&&U,defaultViewport:I,translateExtent:D,minZoom:O,maxZoom:w,zoomActivationKeyCode:y,preventScrolling:T,noWheelClassName:z,noPanClassName:H},L.createElement(mg,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:U,isSelecting:!!P,selectionMode:h},e,B&&L.createElement(Fw,{onSelectionContextMenu:C,noPanClassName:H,disableKeyboardA11y:M})))};xg.displayName="FlowRenderer";var Bw=k.memo(xg);function Hw(e){return ne(k.useCallback(r=>e?Jv(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function $w(e){const t={input:Mt(e.input||sg),default:Mt(e.default||Au),output:Mt(e.output||cg),group:Mt(e.group||Vu)},r={},n=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Mt(e[a]||Au),i),r);return{...t,...n}}const Gw=({x:e,y:t,width:r,height:n,origin:i})=>!r||!n?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-r*i[0],y:t-n*i[1]},Vw=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Sg=e=>{const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:n,elementsSelectable:i,updateNodeDimensions:a,onError:o}=ne(Vw,he),s=Hw(e.onlyRenderVisibleElements),u=k.useRef(),l=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(f=>{const d=f.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));a(d)});return u.current=c,c},[]);return k.useEffect(()=>()=>{u?.current?.disconnect()},[]),L.createElement("div",{className:"react-flow__nodes",style:ju},s.map(c=>{let f=c.type||"default";e.nodeTypes[f]||(o?.("003",Ue.error003(f)),f="default");const d=e.nodeTypes[f]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),_=!!(c.selectable||i&&typeof c.selectable>"u"),g=!!(c.connectable||r&&typeof c.connectable>"u"),v=!!(c.focusable||n&&typeof c.focusable>"u"),p=e.nodeExtent?Fu(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=p?.x??0,b=p?.y??0,m=Gw({x:y,y:b,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return L.createElement(d,{key:c.id,id:c.id,className:c.className,style:c.style,type:f,data:c.data,sourcePosition:c.sourcePosition||J.Bottom,targetPosition:c.targetPosition||J.Top,hidden:c.hidden,xPos:y,yPos:b,xPosOrigin:m.x,yPosOrigin:m.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:_,isConnectable:g,isFocusable:v,resizeObserver:l,dragHandle:c.dragHandle,zIndex:c[se]?.z??0,isParent:!!c[se]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel,hasHandleBounds:!!c[se]?.handleBounds})}))};Sg.displayName="NodeRenderer";var Uw=k.memo(Sg);const jw=(e,t,r)=>r===J.Left?e-t:r===J.Right?e+t:e,Kw=(e,t,r)=>r===J.Top?e-t:r===J.Bottom?e+t:e,tl="react-flow__edgeupdater",rl=({position:e,centerX:t,centerY:r,radius:n=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s})=>L.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:pe([tl,`${tl}-${s}`]),cx:jw(t,n,e),cy:Kw(r,n,e),r:n,stroke:"transparent",fill:"transparent"}),Yw=()=>!0;var vt=e=>{const t=({id:r,className:n,type:i,data:a,onClick:o,onEdgeDoubleClick:s,selected:u,animated:l,label:c,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:g,style:v,source:p,target:y,sourceX:b,sourceY:m,targetX:E,targetY:x,sourcePosition:S,targetPosition:N,elementsSelectable:q,hidden:A,sourceHandleId:I,targetHandleId:D,onContextMenu:O,onMouseEnter:w,onMouseMove:T,onMouseLeave:C,reconnectRadius:z,onReconnect:H,onReconnectStart:M,onReconnectEnd:B,markerEnd:G,markerStart:V,rfId:U,ariaLabel:R,isFocusable:P,isReconnectable:F,pathOptions:$,interactionWidth:j,disableKeyboardA11y:W})=>{const Z=k.useRef(null),[te,ie]=k.useState(!1),[re,ee]=k.useState(!1),X=fe(),ue=k.useMemo(()=>`url('#${Ru(V,U)}')`,[V,U]),K=k.useMemo(()=>`url('#${Ru(G,U)}')`,[G,U]);if(A)return null;const Y=de=>{const{edges:we,addSelectedEdges:ve,unselectNodesAndEdges:ye,multiSelectionActive:ft}=X.getState(),De=we.find(et=>et.id===r);De&&(q&&(X.setState({nodesSelectionActive:!1}),De.selected&&ft?(ye({nodes:[],edges:[De]}),Z.current?.blur()):ve([r])),o&&o(de,De))},oe=It(r,X.getState,s),Ce=It(r,X.getState,O),Oe=It(r,X.getState,w),ge=It(r,X.getState,T),ce=It(r,X.getState,C),me=(de,we)=>{if(de.button!==0)return;const{edges:ve,isValidConnection:ye}=X.getState(),ft=we?y:p,De=(we?D:I)||null,et=we?"target":"source",Hr=ye||Yw,$r=we,Ct=ve.find(tt=>tt.id===r);ee(!0),M?.(de,Ct,et);const Gr=tt=>{ee(!1),B?.(tt,Ct,et)};ng({event:de,handleId:De,nodeId:ft,onConnect:tt=>H?.(Ct,tt),isTarget:$r,getState:X.getState,setState:X.setState,isValidConnection:Hr,edgeUpdaterType:et,onReconnectEnd:Gr})},Ae=de=>me(de,!0),ze=de=>me(de,!1),ke=()=>ie(!0),be=()=>ie(!1),Be=!q&&!o,Ye=de=>{if(!W&&Uv.includes(de.key)&&q){const{unselectNodesAndEdges:we,addSelectedEdges:ve,edges:ye}=X.getState();de.key==="Escape"?(Z.current?.blur(),we({edges:[ye.find(De=>De.id===r)]})):ve([r])}};return L.createElement("g",{className:pe(["react-flow__edge",`react-flow__edge-${i}`,n,{selected:u,animated:l,inactive:Be,updating:te}]),onClick:Y,onDoubleClick:oe,onContextMenu:Ce,onMouseEnter:Oe,onMouseMove:ge,onMouseLeave:ce,onKeyDown:P?Ye:void 0,tabIndex:P?0:void 0,role:P?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":R===null?void 0:R||`Edge from ${p} to ${y}`,"aria-describedby":P?`${dg}-${U}`:void 0,ref:Z},!re&&L.createElement(e,{id:r,source:p,target:y,selected:u,animated:l,label:c,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:g,data:a,style:v,sourceX:b,sourceY:m,targetX:E,targetY:x,sourcePosition:S,targetPosition:N,sourceHandleId:I,targetHandleId:D,markerStart:ue,markerEnd:K,pathOptions:$,interactionWidth:j}),F&&L.createElement(L.Fragment,null,(F==="source"||F===!0)&&L.createElement(rl,{position:S,centerX:b,centerY:m,radius:z,onMouseDown:Ae,onMouseEnter:ke,onMouseOut:be,type:"source"}),(F==="target"||F===!0)&&L.createElement(rl,{position:N,centerX:E,centerY:x,radius:z,onMouseDown:ze,onMouseEnter:ke,onMouseOut:be,type:"target"})))};return t.displayName="EdgeWrapper",k.memo(t)};function Ww(e){const t={default:vt(e.default||pr),straight:vt(e.bezier||Hu),step:vt(e.step||Bu),smoothstep:vt(e.step||Er),simplebezier:vt(e.simplebezier||zu)},r={},n=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=vt(e[a]||pr),i),r);return{...t,...n}}function nl(e,t,r=null){const n=(r?.x||0)+t.x,i=(r?.y||0)+t.y,a=r?.width||t.width,o=r?.height||t.height;switch(e){case J.Top:return{x:n+a/2,y:i};case J.Right:return{x:n+a,y:i+o/2};case J.Bottom:return{x:n+a/2,y:i+o};case J.Left:return{x:n,y:i+o/2}}}function il(e,t){return e?e.length===1||!t?e[0]:t&&e.find(r=>r.id===t)||null:null}const Zw=(e,t,r,n,i,a)=>{const o=nl(r,e,t),s=nl(a,n,i);return{sourceX:o.x,sourceY:o.y,targetX:s.x,targetY:s.y}};function Xw({sourcePos:e,targetPos:t,sourceWidth:r,sourceHeight:n,targetWidth:i,targetHeight:a,width:o,height:s,transform:u}){const l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+r,t.x+i),y2:Math.max(e.y+n,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const c=Ht({x:(0-u[0])/u[2],y:(0-u[1])/u[2],width:o/u[2],height:s/u[2]}),f=Math.max(0,Math.min(c.x2,l.x2)-Math.max(c.x,l.x)),d=Math.max(0,Math.min(c.y2,l.y2)-Math.max(c.y,l.y));return Math.ceil(f*d)>0}function al(e){const t=e?.[se]?.handleBounds||null,r=t&&e?.width&&e?.height&&typeof e?.positionAbsolute?.x<"u"&&typeof e?.positionAbsolute?.y<"u";return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!r]}const Jw=[{level:0,isMaxLevel:!0,edges:[]}];function Qw(e,t,r=!1){let n=-1;const i=e.reduce((o,s)=>{const u=Se(s.zIndex);let l=u?s.zIndex:0;if(r){const c=t.get(s.target),f=t.get(s.source),d=s.selected||c?.selected||f?.selected,h=Math.max(f?.[se]?.z||0,c?.[se]?.z||0,1e3);l=(u?s.zIndex:0)+(d?h:0)}return o[l]?o[l].push(s):o[l]=[s],n=l>n?l:n,o},{}),a=Object.entries(i).map(([o,s])=>{const u=+o;return{edges:s,level:u,isMaxLevel:u===n}});return a.length===0?Jw:a}function e1(e,t,r){const n=ne(k.useCallback(i=>e?i.edges.filter(a=>{const o=t.get(a.source),s=t.get(a.target);return o?.width&&o?.height&&s?.width&&s?.height&&Xw({sourcePos:o.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:o.width,sourceHeight:o.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return Qw(n,t,r)}const t1=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),r1=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ol={[hr.Arrow]:t1,[hr.ArrowClosed]:r1};function n1(e){const t=fe();return k.useMemo(()=>Object.prototype.hasOwnProperty.call(ol,e)?ol[e]:(t.getState().onError?.("009",Ue.error009(e)),null),[e])}const i1=({id:e,type:t,color:r,width:n=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:o,orient:s="auto-start-reverse"})=>{const u=n1(t);return u?L.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${n}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:s,refX:"0",refY:"0"},L.createElement(u,{color:r,strokeWidth:o})):null},a1=({defaultColor:e,rfId:t})=>r=>{const n=[];return r.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(o=>{if(o&&typeof o=="object"){const s=Ru(o,t);n.includes(s)||(i.push({id:s,color:o.color||e,...o}),n.push(s))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},qg=({defaultColor:e,rfId:t})=>{const r=ne(k.useCallback(a1({defaultColor:e,rfId:t}),[e,t]),(n,i)=>!(n.length!==i.length||n.some((a,o)=>a.id!==i[o].id)));return L.createElement("defs",null,r.map(n=>L.createElement(i1,{id:n.id,key:n.id,type:n.type,color:n.color,width:n.width,height:n.height,markerUnits:n.markerUnits,strokeWidth:n.strokeWidth,orient:n.orient})))};qg.displayName="MarkerDefinitions";var o1=k.memo(qg);const s1=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Rg=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:r,rfId:n,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:u,onEdgeMouseLeave:l,onEdgeClick:c,onEdgeDoubleClick:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:g,children:v,disableKeyboardA11y:p})=>{const{edgesFocusable:y,edgesUpdatable:b,elementsSelectable:m,width:E,height:x,connectionMode:S,nodeInternals:N,onError:q}=ne(s1,he),A=e1(t,N,r);return E?L.createElement(L.Fragment,null,A.map(({level:I,edges:D,isMaxLevel:O})=>L.createElement("svg",{key:I,style:{zIndex:I},width:E,height:x,className:"react-flow__edges react-flow__container"},O&&L.createElement(o1,{defaultColor:e,rfId:n}),L.createElement("g",null,D.map(w=>{const[T,C,z]=al(N.get(w.source)),[H,M,B]=al(N.get(w.target));if(!z||!B)return null;let G=w.type||"default";i[G]||(q?.("011",Ue.error011(G)),G="default");const V=i[G]||i.default,U=S===ot.Strict?M.target:(M.target??[]).concat(M.source??[]),R=il(C.source,w.sourceHandle),P=il(U,w.targetHandle),F=R?.position||J.Bottom,$=P?.position||J.Top,j=!!(w.focusable||y&&typeof w.focusable>"u"),W=w.reconnectable||w.updatable,Z=typeof d<"u"&&(W||b&&typeof W>"u");if(!R||!P)return q?.("008",Ue.error008(R,w)),null;const{sourceX:te,sourceY:ie,targetX:re,targetY:ee}=Zw(T,R,F,H,P,$);return L.createElement(V,{key:w.id,id:w.id,className:pe([w.className,a]),type:G,data:w.data,selected:!!w.selected,animated:!!w.animated,hidden:!!w.hidden,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,style:w.style,source:w.source,target:w.target,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerEnd:w.markerEnd,markerStart:w.markerStart,sourceX:te,sourceY:ie,targetX:re,targetY:ee,sourcePosition:F,targetPosition:$,elementsSelectable:m,onContextMenu:o,onMouseEnter:s,onMouseMove:u,onMouseLeave:l,onClick:c,onEdgeDoubleClick:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:g,rfId:n,ariaLabel:w.ariaLabel,isFocusable:j,isReconnectable:Z,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth,disableKeyboardA11y:p})})))),v):null};Rg.displayName="EdgeRenderer";var u1=k.memo(Rg);const c1=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function l1({children:e}){const t=ne(c1);return L.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function f1(e){const t=Uu(),r=k.useRef(!1);k.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const d1={[J.Left]:J.Right,[J.Right]:J.Left,[J.Top]:J.Bottom,[J.Bottom]:J.Top},Cg=({nodeId:e,handleType:t,style:r,type:n=Xe.Bezier,CustomComponent:i,connectionStatus:a})=>{const{fromNode:o,handleId:s,toX:u,toY:l,connectionMode:c}=ne(k.useCallback(x=>({fromNode:x.nodeInternals.get(e),handleId:x.connectionHandleId,toX:(x.connectionPosition.x-x.transform[0])/x.transform[2],toY:(x.connectionPosition.y-x.transform[1])/x.transform[2],connectionMode:x.connectionMode}),[e]),he),f=o?.[se]?.handleBounds;let d=f?.[t];if(c===ot.Loose&&(d=d||f?.[t==="source"?"target":"source"]),!o||!d)return null;const h=s?d.find(x=>x.id===s):d[0],_=h?h.x+h.width/2:(o.width??0)/2,g=h?h.y+h.height/2:o.height??0,v=(o.positionAbsolute?.x??0)+_,p=(o.positionAbsolute?.y??0)+g,y=h?.position,b=y?d1[y]:null;if(!y||!b)return null;if(i)return L.createElement(i,{connectionLineType:n,connectionLineStyle:r,fromNode:o,fromHandle:h,fromX:v,fromY:p,toX:u,toY:l,fromPosition:y,toPosition:b,connectionStatus:a});let m="";const E={sourceX:v,sourceY:p,sourcePosition:y,targetX:u,targetY:l,targetPosition:b};return n===Xe.Bezier?[m]=Zv(E):n===Xe.Step?[m]=qu({...E,borderRadius:0}):n===Xe.SmoothStep?[m]=qu(E):n===Xe.SimpleBezier?[m]=Wv(E):m=`M${v},${p} ${u},${l}`,L.createElement("path",{d:m,fill:"none",className:"react-flow__connection-path",style:r})};Cg.displayName="ConnectionLine";const h1=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function p1({containerStyle:e,style:t,type:r,component:n}){const{nodeId:i,handleType:a,nodesConnectable:o,width:s,height:u,connectionStatus:l}=ne(h1,he);return!(i&&a&&s&&o)?null:L.createElement("svg",{style:e,width:s,height:u,className:"react-flow__edges react-flow__connectionline react-flow__container"},L.createElement("g",{className:pe(["react-flow__connection",l])},L.createElement(Cg,{nodeId:i,handleType:a,style:t,type:r,CustomComponent:n,connectionStatus:l})))}function sl(e,t){return k.useRef(null),fe(),k.useMemo(()=>t(e),[e])}const Ag=({nodeTypes:e,edgeTypes:t,onMove:r,onMoveStart:n,onMoveEnd:i,onInit:a,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:u,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:v,connectionLineType:p,connectionLineStyle:y,connectionLineComponent:b,connectionLineContainerStyle:m,selectionKeyCode:E,selectionOnDrag:x,selectionMode:S,multiSelectionKeyCode:N,panActivationKeyCode:q,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:D,elementsSelectable:O,selectNodesOnDrag:w,defaultViewport:T,translateExtent:C,minZoom:z,maxZoom:H,preventScrolling:M,defaultMarkerColor:B,zoomOnScroll:G,zoomOnPinch:V,panOnScroll:U,panOnScrollSpeed:R,panOnScrollMode:P,zoomOnDoubleClick:F,panOnDrag:$,onPaneClick:j,onPaneMouseEnter:W,onPaneMouseMove:Z,onPaneMouseLeave:te,onPaneScroll:ie,onPaneContextMenu:re,onEdgeContextMenu:ee,onEdgeMouseEnter:X,onEdgeMouseMove:ue,onEdgeMouseLeave:K,onReconnect:Y,onReconnectStart:oe,onReconnectEnd:Ce,reconnectRadius:Oe,noDragClassName:ge,noWheelClassName:ce,noPanClassName:me,elevateEdgesOnSelect:Ae,disableKeyboardA11y:ze,nodeOrigin:ke,nodeExtent:be,rfId:Be})=>{const Ye=sl(e,$w),de=sl(t,Ww);return f1(a),L.createElement(Bw,{onPaneClick:j,onPaneMouseEnter:W,onPaneMouseMove:Z,onPaneMouseLeave:te,onPaneContextMenu:re,onPaneScroll:ie,deleteKeyCode:I,selectionKeyCode:E,selectionOnDrag:x,selectionMode:S,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:N,panActivationKeyCode:q,zoomActivationKeyCode:A,elementsSelectable:O,onMove:r,onMoveStart:n,onMoveEnd:i,zoomOnScroll:G,zoomOnPinch:V,zoomOnDoubleClick:F,panOnScroll:U,panOnScrollSpeed:R,panOnScrollMode:P,panOnDrag:$,defaultViewport:T,translateExtent:C,minZoom:z,maxZoom:H,onSelectionContextMenu:_,preventScrolling:M,noDragClassName:ge,noWheelClassName:ce,noPanClassName:me,disableKeyboardA11y:ze},L.createElement(l1,null,L.createElement(u1,{edgeTypes:de,onEdgeClick:s,onEdgeDoubleClick:l,onlyRenderVisibleElements:D,onEdgeContextMenu:ee,onEdgeMouseEnter:X,onEdgeMouseMove:ue,onEdgeMouseLeave:K,onReconnect:Y,onReconnectStart:oe,onReconnectEnd:Ce,reconnectRadius:Oe,defaultMarkerColor:B,noPanClassName:me,elevateEdgesOnSelect:!!Ae,disableKeyboardA11y:ze,rfId:Be},L.createElement(p1,{style:y,type:p,component:b,containerStyle:m})),L.createElement("div",{className:"react-flow__edgelabel-renderer"}),L.createElement(Uw,{nodeTypes:Ye,onNodeClick:o,onNodeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,selectNodesOnDrag:w,onlyRenderVisibleElements:D,noPanClassName:me,noDragClassName:ge,disableKeyboardA11y:ze,nodeOrigin:ke,nodeExtent:be,rfId:Be})))};Ag.displayName="GraphView";var v1=k.memo(Ag);const Iu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],We={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Iu,nodeExtent:Iu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ot.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:G0,isValidConnection:void 0},g1=()=>Im((e,t)=>({...We,setNodes:r=>{const{nodeInternals:n,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:un(r,n,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:n={}}=t();e({edges:r.map(i=>({...n,...i}))})},setDefaultNodesAndEdges:(r,n)=>{const i=typeof r<"u",a=typeof n<"u",o=i?un(r,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:o,edges:a?n:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:r=>{const{onNodesChange:n,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:o,fitViewOnInitOptions:s,domNode:u,nodeOrigin:l}=t(),c=u?.querySelector(".react-flow__viewport");if(!c)return;const f=window.getComputedStyle(c),{m22:d}=new window.DOMMatrixReadOnly(f.transform),h=r.reduce((g,v)=>{const p=i.get(v.id);if(p?.hidden)i.set(p.id,{...p,[se]:{...p[se],handleBounds:void 0}});else if(p){const y=Lu(v.nodeElement);!!(y.width&&y.height&&(p.width!==y.width||p.height!==y.height||v.forceUpdate))&&(i.set(p.id,{...p,[se]:{...p[se],handleBounds:{source:el(".source",v.nodeElement,d,l),target:el(".target",v.nodeElement,d,l)}},...y}),g.push({id:p.id,type:"dimensions",dimensions:y}))}return g},[]);pg(i,l);const _=o||a&&!o&&vg(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:_}),h?.length>0&&n?.(h)},updateNodePositions:(r,n=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),o=r.map(s=>{const u={id:s.id,type:"position",dragging:i};return n&&(u.positionAbsolute=s.positionAbsolute,u.position=s.position),u});a(o)},triggerNodeChanges:r=>{const{onNodesChange:n,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:o,getNodes:s,elevateNodesOnSelect:u}=t();if(r?.length){if(a){const l=yg(r,s()),c=un(l,i,o,u);e({nodeInternals:c})}n?.(r)}},addSelectedNodes:r=>{const{multiSelectionActive:n,edges:i,getNodes:a}=t();let o,s=null;n?o=r.map(u=>Ze(u,!0)):(o=gt(a(),r),s=gt(i,[])),rr({changedNodes:o,changedEdges:s,get:t,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:n,edges:i,getNodes:a}=t();let o,s=null;n?o=r.map(u=>Ze(u,!0)):(o=gt(i,r),s=gt(a(),[])),rr({changedNodes:s,changedEdges:o,get:t,set:e})},unselectNodesAndEdges:({nodes:r,edges:n}={})=>{const{edges:i,getNodes:a}=t(),o=r||a(),s=n||i,u=o.map(c=>(c.selected=!1,Ze(c.id,!1))),l=s.map(c=>Ze(c.id,!1));rr({changedNodes:u,changedEdges:l,get:t,set:e})},setMinZoom:r=>{const{d3Zoom:n,maxZoom:i}=t();n?.scaleExtent([r,i]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:n,minZoom:i}=t();n?.scaleExtent([i,r]),e({maxZoom:r})},setTranslateExtent:r=>{t().d3Zoom?.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:n}=t(),a=n().filter(s=>s.selected).map(s=>Ze(s.id,!1)),o=r.filter(s=>s.selected).map(s=>Ze(s.id,!1));rr({changedNodes:a,changedEdges:o,get:t,set:e})},setNodeExtent:r=>{const{nodeInternals:n}=t();n.forEach(i=>{i.positionAbsolute=Fu(i.position,r)}),e({nodeExtent:r,nodeInternals:new Map(n)})},panBy:r=>{const{transform:n,width:i,height:a,d3Zoom:o,d3Selection:s,translateExtent:u}=t();if(!o||!s||!r.x&&!r.y)return!1;const l=Ge.translate(n[0]+r.x,n[1]+r.y).scale(n[2]),c=[[0,0],[i,a]],f=o?.constrain()(l,c,u);return o.transform(s,f),n[0]!==f.x||n[1]!==f.y||n[2]!==f.k},cancelConnection:()=>e({connectionNodeId:We.connectionNodeId,connectionHandleId:We.connectionHandleId,connectionHandleType:We.connectionHandleType,connectionStatus:We.connectionStatus,connectionStartHandle:We.connectionStartHandle,connectionEndHandle:We.connectionEndHandle}),reset:()=>e({...We})}),Object.is),Ng=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=g1()),L.createElement(D0,{value:t.current},e)};Ng.displayName="ReactFlowProvider";const Ig=({children:e})=>k.useContext(wr)?L.createElement(L.Fragment,null,e):L.createElement(Ng,null,e);Ig.displayName="ReactFlowWrapper";const y1={input:sg,default:Au,output:cg,group:Vu},m1={default:pr,straight:Hu,step:Bu,smoothstep:Er,simplebezier:zu},_1=[0,0],b1=[15,15],w1={x:0,y:0,zoom:1},E1={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},x1=k.forwardRef(({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,className:i,nodeTypes:a=y1,edgeTypes:o=m1,onNodeClick:s,onEdgeClick:u,onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:_,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:p,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:m,onNodeContextMenu:E,onNodeDoubleClick:x,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:q,onNodesDelete:A,onEdgesDelete:I,onSelectionChange:D,onSelectionDragStart:O,onSelectionDrag:w,onSelectionDragStop:T,onSelectionContextMenu:C,onSelectionStart:z,onSelectionEnd:H,connectionMode:M=ot.Strict,connectionLineType:B=Xe.Bezier,connectionLineStyle:G,connectionLineComponent:V,connectionLineContainerStyle:U,deleteKeyCode:R="Backspace",selectionKeyCode:P="Shift",selectionOnDrag:F=!1,selectionMode:$=$t.Full,panActivationKeyCode:j="Space",multiSelectionKeyCode:W=dr()?"Meta":"Control",zoomActivationKeyCode:Z=dr()?"Meta":"Control",snapToGrid:te=!1,snapGrid:ie=b1,onlyRenderVisibleElements:re=!1,selectNodesOnDrag:ee=!0,nodesDraggable:X,nodesConnectable:ue,nodesFocusable:K,nodeOrigin:Y=_1,edgesFocusable:oe,edgesUpdatable:Ce,elementsSelectable:Oe,defaultViewport:ge=w1,minZoom:ce=.5,maxZoom:me=2,translateExtent:Ae=Iu,preventScrolling:ze=!0,nodeExtent:ke,defaultMarkerColor:be="#b1b1b7",zoomOnScroll:Be=!0,zoomOnPinch:Ye=!0,panOnScroll:de=!1,panOnScrollSpeed:we=.5,panOnScrollMode:ve=nt.Free,zoomOnDoubleClick:ye=!0,panOnDrag:ft=!0,onPaneClick:De,onPaneMouseEnter:et,onPaneMouseMove:Hr,onPaneMouseLeave:$r,onPaneScroll:Ct,onPaneContextMenu:Gr,children:fc,onEdgeContextMenu:tt,onEdgeDoubleClick:Oy,onEdgeMouseEnter:ky,onEdgeMouseMove:Dy,onEdgeMouseLeave:Ly,onEdgeUpdate:Fy,onEdgeUpdateStart:zy,onEdgeUpdateEnd:By,onReconnect:Hy,onReconnectStart:$y,onReconnectEnd:Gy,reconnectRadius:Vy=10,edgeUpdaterRadius:Uy=10,onNodesChange:jy,onEdgesChange:Ky,noDragClassName:Yy="nodrag",noWheelClassName:Wy="nowheel",noPanClassName:dc="nopan",fitView:Zy=!1,fitViewOptions:Xy,connectOnClick:Jy=!0,attributionPosition:Qy,proOptions:em,defaultEdgeOptions:tm,elevateNodesOnSelect:rm=!0,elevateEdgesOnSelect:nm=!1,disableKeyboardA11y:hc=!1,autoPanOnConnect:im=!0,autoPanOnNodeDrag:am=!0,connectionRadius:om=20,isValidConnection:sm,onError:um,style:cm,id:pc,nodeDragThreshold:lm,...fm},dm)=>{const Vr=pc||"1";return L.createElement("div",{...fm,style:{...cm,...E1},ref:dm,className:pe(["react-flow",i]),"data-testid":"rf__wrapper",id:pc},L.createElement(Ig,null,L.createElement(v1,{onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onNodeClick:s,onEdgeClick:u,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:m,onNodeContextMenu:E,onNodeDoubleClick:x,nodeTypes:a,edgeTypes:o,connectionLineType:B,connectionLineStyle:G,connectionLineComponent:V,connectionLineContainerStyle:U,selectionKeyCode:P,selectionOnDrag:F,selectionMode:$,deleteKeyCode:R,multiSelectionKeyCode:W,panActivationKeyCode:j,zoomActivationKeyCode:Z,onlyRenderVisibleElements:re,selectNodesOnDrag:ee,defaultViewport:ge,translateExtent:Ae,minZoom:ce,maxZoom:me,preventScrolling:ze,zoomOnScroll:Be,zoomOnPinch:Ye,zoomOnDoubleClick:ye,panOnScroll:de,panOnScrollSpeed:we,panOnScrollMode:ve,panOnDrag:ft,onPaneClick:De,onPaneMouseEnter:et,onPaneMouseMove:Hr,onPaneMouseLeave:$r,onPaneScroll:Ct,onPaneContextMenu:Gr,onSelectionContextMenu:C,onSelectionStart:z,onSelectionEnd:H,onEdgeContextMenu:tt,onEdgeDoubleClick:Oy,onEdgeMouseEnter:ky,onEdgeMouseMove:Dy,onEdgeMouseLeave:Ly,onReconnect:Hy??Fy,onReconnectStart:$y??zy,onReconnectEnd:Gy??By,reconnectRadius:Vy??Uy,defaultMarkerColor:be,noDragClassName:Yy,noWheelClassName:Wy,noPanClassName:dc,elevateEdgesOnSelect:nm,rfId:Vr,disableKeyboardA11y:hc,nodeOrigin:Y,nodeExtent:ke}),L.createElement(dw,{nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:h,onConnectStart:_,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:p,nodesDraggable:X,nodesConnectable:ue,nodesFocusable:K,edgesFocusable:oe,edgesUpdatable:Ce,elementsSelectable:Oe,elevateNodesOnSelect:rm,minZoom:ce,maxZoom:me,nodeExtent:ke,onNodesChange:jy,onEdgesChange:Ky,snapToGrid:te,snapGrid:ie,connectionMode:M,translateExtent:Ae,connectOnClick:Jy,defaultEdgeOptions:tm,fitView:Zy,fitViewOptions:Xy,onNodesDelete:A,onEdgesDelete:I,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:q,onSelectionDrag:w,onSelectionDragStart:O,onSelectionDragStop:T,noPanClassName:dc,nodeOrigin:Y,rfId:Vr,autoPanOnConnect:im,autoPanOnNodeDrag:am,onError:um,connectionRadius:om,isValidConnection:sm,nodeDragThreshold:lm}),L.createElement(lw,{onSelectionChange:D}),fc,L.createElement(F0,{proOptions:em,position:Qy}),L.createElement(yw,{rfId:Vr,disableKeyboardA11y:hc})))});x1.displayName="ReactFlow";function Tg(e){return t=>{const[r,n]=k.useState(t),i=k.useCallback(a=>n(o=>e(a,o)),[]);return[r,n,i]}}const tq=Tg(yg),rq=Tg(Tw),Mg=({id:e,x:t,y:r,width:n,height:i,style:a,color:o,strokeColor:s,strokeWidth:u,className:l,borderRadius:c,shapeRendering:f,onClick:d,selected:h})=>{const{background:_,backgroundColor:g}=a||{},v=o||_||g;return L.createElement("rect",{className:pe(["react-flow__minimap-node",{selected:h},l]),x:t,y:r,rx:c,ry:c,width:n,height:i,fill:v,stroke:s,strokeWidth:u,shapeRendering:f,onClick:d?p=>d(p,e):void 0})};Mg.displayName="MiniMapNode";var S1=k.memo(Mg);const q1=e=>e.nodeOrigin,R1=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),dn=e=>e instanceof Function?e:()=>e;function C1({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:r="",nodeBorderRadius:n=5,nodeStrokeWidth:i=2,nodeComponent:a=S1,onClick:o}){const s=ne(R1,he),u=ne(q1),l=dn(t),c=dn(e),f=dn(r),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return L.createElement(L.Fragment,null,s.map(h=>{const{x:_,y:g}=it(h,u).positionAbsolute;return L.createElement(a,{key:h.id,x:_,y:g,width:h.width,height:h.height,style:h.style,selected:h.selected,className:f(h),color:l(h),borderRadius:n,strokeColor:c(h),strokeWidth:i,shapeRendering:d,onClick:o,id:h.id})}))}var A1=k.memo(C1);const N1=200,I1=150,T1=e=>{const t=e.getNodes(),r={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:r,boundingRect:t.length>0?H0(xr(t,e.nodeOrigin),r):r,rfId:e.rfId}},M1="react-flow__minimap-desc";function Pg({style:e,className:t,nodeStrokeColor:r="transparent",nodeColor:n="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:o=2,nodeComponent:s,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:l="none",maskStrokeWidth:c=1,position:f="bottom-right",onClick:d,onNodeClick:h,pannable:_=!1,zoomable:g=!1,ariaLabel:v="React Flow mini map",inversePan:p=!1,zoomStep:y=10,offsetScale:b=5}){const m=fe(),E=k.useRef(null),{boundingRect:x,viewBB:S,rfId:N}=ne(T1,he),q=e?.width??N1,A=e?.height??I1,I=x.width/q,D=x.height/A,O=Math.max(I,D),w=O*q,T=O*A,C=b*O,z=x.x-(w-x.width)/2-C,H=x.y-(T-x.height)/2-C,M=w+C*2,B=T+C*2,G=`${M1}-${N}`,V=k.useRef(0);V.current=O,k.useEffect(()=>{if(E.current){const P=xe(E.current),F=W=>{const{transform:Z,d3Selection:te,d3Zoom:ie}=m.getState();if(W.sourceEvent.type!=="wheel"||!te||!ie)return;const re=-W.sourceEvent.deltaY*(W.sourceEvent.deltaMode===1?.05:W.sourceEvent.deltaMode?1:.002)*y,ee=Z[2]*Math.pow(2,re);ie.scaleTo(te,ee)},$=W=>{const{transform:Z,d3Selection:te,d3Zoom:ie,translateExtent:re,width:ee,height:X}=m.getState();if(W.sourceEvent.type!=="mousemove"||!te||!ie)return;const ue=V.current*Math.max(1,Z[2])*(p?-1:1),K={x:Z[0]-W.sourceEvent.movementX*ue,y:Z[1]-W.sourceEvent.movementY*ue},Y=[[0,0],[ee,X]],oe=Ge.translate(K.x,K.y).scale(Z[2]),Ce=ie.constrain()(oe,Y,re);ie.transform(te,Ce)},j=zv().on("zoom",_?$:null).on("zoom.wheel",g?F:null);return P.call(j),()=>{P.on("zoom",null)}}},[_,g,p,y]);const U=d?P=>{const F=Ne(P);d(P,{x:F[0],y:F[1]})}:void 0,R=h?(P,F)=>{const $=m.getState().nodeInternals.get(F);h(P,$)}:void 0;return L.createElement(Du,{position:f,style:e,className:pe(["react-flow__minimap",t]),"data-testid":"rf__minimap"},L.createElement("svg",{width:q,height:A,viewBox:`${z} ${H} ${M} ${B}`,role:"img","aria-labelledby":G,ref:E,onClick:U},v&&L.createElement("title",{id:G},v),L.createElement(A1,{onClick:R,nodeColor:n,nodeStrokeColor:r,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),L.createElement("path",{className:"react-flow__minimap-mask",d:`M${z-C},${H-C}h${M+C*2}v${B+C*2}h${-M-C*2}z + M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fill:u,fillRule:"evenodd",stroke:l,strokeWidth:c,pointerEvents:"none"})))}Pg.displayName="MiniMap";var nq=k.memo(Pg);function P1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},L.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function O1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},L.createElement("path",{d:"M0 0h32v4.2H0z"}))}function k1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},L.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function D1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},L.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function L1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},L.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const kt=({children:e,className:t,...r})=>L.createElement("button",{type:"button",className:pe(["react-flow__controls-button",t]),...r},e);kt.displayName="ControlButton";const F1=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),Og=({style:e,showZoom:t=!0,showFitView:r=!0,showInteractive:n=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:u,className:l,children:c,position:f="bottom-left"})=>{const d=fe(),[h,_]=k.useState(!1),{isInteractive:g,minZoomReached:v,maxZoomReached:p}=ne(F1,he),{zoomIn:y,zoomOut:b,fitView:m}=Uu();if(k.useEffect(()=>{_(!0)},[]),!h)return null;const E=()=>{y(),a?.()},x=()=>{b(),o?.()},S=()=>{m(i),s?.()},N=()=>{d.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),u?.(!g)};return L.createElement(Du,{className:pe(["react-flow__controls",l]),position:f,style:e,"data-testid":"rf__controls"},t&&L.createElement(L.Fragment,null,L.createElement(kt,{onClick:E,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:p},L.createElement(P1,null)),L.createElement(kt,{onClick:x,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:v},L.createElement(O1,null))),r&&L.createElement(kt,{className:"react-flow__controls-fitview",onClick:S,title:"fit view","aria-label":"fit view"},L.createElement(k1,null)),n&&L.createElement(kt,{className:"react-flow__controls-interactive",onClick:N,title:"toggle interactivity","aria-label":"toggle interactivity"},g?L.createElement(L1,null):L.createElement(D1,null)),c)};Og.displayName="Controls";var iq=k.memo(Og),Ie;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ie||(Ie={}));function z1({color:e,dimensions:t,lineWidth:r}){return L.createElement("path",{stroke:e,strokeWidth:r,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function B1({color:e,radius:t}){return L.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const H1={[Ie.Dots]:"#91919a",[Ie.Lines]:"#eee",[Ie.Cross]:"#e2e2e2"},$1={[Ie.Dots]:1,[Ie.Lines]:1,[Ie.Cross]:6},G1=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function kg({id:e,variant:t=Ie.Dots,gap:r=20,size:n,lineWidth:i=1,offset:a=2,color:o,style:s,className:u}){const l=k.useRef(null),{transform:c,patternId:f}=ne(G1,he),d=o||H1[t],h=n||$1[t],_=t===Ie.Dots,g=t===Ie.Cross,v=Array.isArray(r)?r:[r,r],p=[v[0]*c[2]||1,v[1]*c[2]||1],y=h*c[2],b=g?[y,y]:p,m=_?[y/a,y/a]:[b[0]/a,b[1]/a];return L.createElement("svg",{className:pe(["react-flow__background",u]),style:{...s,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:l,"data-testid":"rf__background"},L.createElement("pattern",{id:f+e,x:c[0]%p[0],y:c[1]%p[1],width:p[0],height:p[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${m[0]},-${m[1]})`},_?L.createElement(B1,{color:d,radius:y/a}):L.createElement(z1,{dimensions:b,color:d,lineWidth:i})),L.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f+e})`}))}kg.displayName="Background";var aq=k.memo(kg);function Ku(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var hn,ul;function V1(){if(ul)return hn;ul=1;function e(){this.__data__=[],this.size=0}return hn=e,hn}var pn,cl;function St(){if(cl)return pn;cl=1;function e(t,r){return t===r||t!==t&&r!==r}return pn=e,pn}var vn,ll;function Sr(){if(ll)return vn;ll=1;var e=St();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return vn=t,vn}var gn,fl;function U1(){if(fl)return gn;fl=1;var e=Sr(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return gn=n,gn}var yn,dl;function j1(){if(dl)return yn;dl=1;var e=Sr();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return yn=t,yn}var mn,hl;function K1(){if(hl)return mn;hl=1;var e=Sr();function t(r){return e(this.__data__,r)>-1}return mn=t,mn}var _n,pl;function Y1(){if(pl)return _n;pl=1;var e=Sr();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return _n=t,_n}var bn,vl;function qr(){if(vl)return bn;vl=1;var e=V1(),t=U1(),r=j1(),n=K1(),i=Y1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s-1&&n%1==0&&n-1&&r%1==0&&r<=e}return si=t,si}var ui,af;function _E(){if(af)return ui;af=1;var e=st(),t=Xu(),r=Le(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",s="[object Error]",u="[object Function]",l="[object Map]",c="[object Number]",f="[object Object]",d="[object RegExp]",h="[object Set]",_="[object String]",g="[object WeakMap]",v="[object ArrayBuffer]",p="[object DataView]",y="[object Float32Array]",b="[object Float64Array]",m="[object Int8Array]",E="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",N="[object Uint8ClampedArray]",q="[object Uint16Array]",A="[object Uint32Array]",I={};I[y]=I[b]=I[m]=I[E]=I[x]=I[S]=I[N]=I[q]=I[A]=!0,I[n]=I[i]=I[v]=I[a]=I[p]=I[o]=I[s]=I[u]=I[l]=I[c]=I[f]=I[d]=I[h]=I[_]=I[g]=!1;function D(O){return r(O)&&t(O.length)&&!!I[e(O)]}return ui=D,ui}var ci,of;function Mr(){if(of)return ci;of=1;function e(t){return function(r){return t(r)}}return ci=e,ci}var Lt={exports:{}};Lt.exports;var sf;function Ju(){return sf||(sf=1,(function(e,t){var r=gv(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,s=(function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}})();e.exports=s})(Lt,Lt.exports)),Lt.exports}var li,uf;function Wt(){if(uf)return li;uf=1;var e=_E(),t=Mr(),r=Ju(),n=r&&r.isTypedArray,i=n?t(n):e;return li=i,li}var fi,cf;function Fg(){if(cf)return fi;cf=1;var e=gE(),t=Yt(),r=le(),n=qt(),i=Tr(),a=Wt(),o=Object.prototype,s=o.hasOwnProperty;function u(l,c){var f=r(l),d=!f&&t(l),h=!f&&!d&&n(l),_=!f&&!d&&!h&&a(l),g=f||d||h||_,v=g?e(l.length,String):[],p=v.length;for(var y in l)(c||s.call(l,y))&&!(g&&(y=="length"||h&&(y=="offset"||y=="parent")||_&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,p)))&&v.push(y);return v}return fi=u,fi}var di,lf;function Pr(){if(lf)return di;lf=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return di=t,di}var hi,ff;function zg(){if(ff)return hi;ff=1;function e(t,r){return function(n){return t(r(n))}}return hi=e,hi}var pi,df;function bE(){if(df)return pi;df=1;var e=zg(),t=e(Object.keys,Object);return pi=t,pi}var vi,hf;function Qu(){if(hf)return vi;hf=1;var e=Pr(),t=bE(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var s in Object(a))n.call(a,s)&&s!="constructor"&&o.push(s);return o}return vi=i,vi}var gi,pf;function je(){if(pf)return gi;pf=1;var e=jt(),t=Xu();function r(n){return n!=null&&t(n.length)&&!e(n)}return gi=r,gi}var yi,vf;function Qe(){if(vf)return yi;vf=1;var e=Fg(),t=Qu(),r=je();function n(i){return r(i)?e(i):t(i)}return yi=n,yi}var mi,gf;function wE(){if(gf)return mi;gf=1;var e=Kt(),t=Qe();function r(n,i){return n&&e(i,t(i),n)}return mi=r,mi}var _i,yf;function EE(){if(yf)return _i;yf=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return _i=e,_i}var bi,mf;function xE(){if(mf)return bi;mf=1;var e=qe(),t=Pr(),r=EE(),n=Object.prototype,i=n.hasOwnProperty;function a(o){if(!e(o))return r(o);var s=t(o),u=[];for(var l in o)l=="constructor"&&(s||!i.call(o,l))||u.push(l);return u}return bi=a,bi}var wi,_f;function ct(){if(_f)return wi;_f=1;var e=Fg(),t=xE(),r=je();function n(i){return r(i)?e(i,!0):t(i)}return wi=n,wi}var Ei,bf;function SE(){if(bf)return Ei;bf=1;var e=Kt(),t=ct();function r(n,i){return n&&e(i,t(i),n)}return Ei=r,Ei}var Ft={exports:{}};Ft.exports;var wf;function Bg(){return wf||(wf=1,(function(e,t){var r=Me(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a?r.Buffer:void 0,s=o?o.allocUnsafe:void 0;function u(l,c){if(c)return l.slice();var f=l.length,d=s?s(f):new l.constructor(f);return l.copy(d),d}e.exports=u})(Ft,Ft.exports)),Ft.exports}var xi,Ef;function Hg(){if(Ef)return xi;Ef=1;function e(t,r){var n=-1,i=t.length;for(r||(r=Array(i));++nh))return!1;var g=f.get(o),v=f.get(s);if(g&&v)return g==s&&v==o;var p=-1,y=!0,b=u&i?new e:void 0;for(f.set(o,s),f.set(s,o);++p0&&a(c)?i>1?r(c,i-1,a,o,s):e(s,c):o||(s[s.length]=c)}return s}return po=r,po}var vo,hh;function wx(){if(hh)return vo;hh=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return vo=e,vo}var go,ph;function my(){if(ph)return go;ph=1;var e=wx(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,s=-1,u=t(o.length-i,0),l=Array(u);++s0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return mo=n,mo}var _o,yh;function _y(){if(yh)return _o;yh=1;var e=Ex(),t=xx(),r=t(e);return _o=r,_o}var bo,mh;function zr(){if(mh)return bo;mh=1;var e=lt(),t=my(),r=_y();function n(i,a){return r(t(i,a,e),i+"")}return bo=n,bo}var wo,_h;function by(){if(_h)return wo;_h=1;function e(t,r,n,i){for(var a=t.length,o=n+(i?1:-1);i?o--:++o-1}return qo=t,qo}var Ro,Sh;function Ax(){if(Sh)return Ro;Sh=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i=o){var p=l?null:i(u);if(p)return a(p);_=!1,d=n,v=new e}else v=l?[]:g;e:for(;++f1?h.setNode(_,f):h.setNode(_)}),this},i.prototype.setNode=function(c,f){return e.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=f),this):(this._nodes[c]=arguments.length>1?f:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=r,this._children[c]={},this._children[r][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return e.has(this._nodes,c)},i.prototype.removeNode=function(c){var f=this;if(e.has(this._nodes,c)){var d=function(h){f.removeEdge(f._edgeObjs[h])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],e.each(this.children(c),function(h){f.setParent(h)}),delete this._children[c]),e.each(e.keys(this._in[c]),d),delete this._in[c],delete this._preds[c],e.each(e.keys(this._out[c]),d),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,f){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(f))f=r;else{f+="";for(var d=f;!e.isUndefined(d);d=this.parent(d))if(d===c)throw new Error("Setting "+f+" as parent of "+c+" would create a cycle");this.setNode(f)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=f,this._children[f][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var f=this._parent[c];if(f!==r)return f}},i.prototype.children=function(c){if(e.isUndefined(c)&&(c=r),this._isCompound){var f=this._children[c];if(f)return e.keys(f)}else{if(c===r)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var f=this._preds[c];if(f)return e.keys(f)},i.prototype.successors=function(c){var f=this._sucs[c];if(f)return e.keys(f)},i.prototype.neighbors=function(c){var f=this.predecessors(c);if(f)return e.union(f,this.successors(c))},i.prototype.isLeaf=function(c){var f;return this.isDirected()?f=this.successors(c):f=this.neighbors(c),f.length===0},i.prototype.filterNodes=function(c){var f=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});f.setGraph(this.graph());var d=this;e.each(this._nodes,function(g,v){c(v)&&f.setNode(v,g)}),e.each(this._edgeObjs,function(g){f.hasNode(g.v)&&f.hasNode(g.w)&&f.setEdge(g,d.edge(g))});var h={};function _(g){var v=d.parent(g);return v===void 0||f.hasNode(v)?(h[g]=v,v):v in h?h[v]:_(v)}return this._isCompound&&e.each(f.nodes(),function(g){f.setParent(g,_(g))}),f},i.prototype.setDefaultEdgeLabel=function(c){return e.isFunction(c)||(c=e.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(c,f){var d=this,h=arguments;return e.reduce(c,function(_,g){return h.length>1?d.setEdge(_,g,f):d.setEdge(_,g),g}),this},i.prototype.setEdge=function(){var c,f,d,h,_=!1,g=arguments[0];typeof g=="object"&&g!==null&&"v"in g?(c=g.v,f=g.w,d=g.name,arguments.length===2&&(h=arguments[1],_=!0)):(c=g,f=arguments[1],d=arguments[3],arguments.length>2&&(h=arguments[2],_=!0)),c=""+c,f=""+f,e.isUndefined(d)||(d=""+d);var v=s(this._isDirected,c,f,d);if(e.has(this._edgeLabels,v))return _&&(this._edgeLabels[v]=h),this;if(!e.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(f),this._edgeLabels[v]=_?h:this._defaultEdgeLabelFn(c,f,d);var p=u(this._isDirected,c,f,d);return c=p.v,f=p.w,Object.freeze(p),this._edgeObjs[v]=p,a(this._preds[f],c),a(this._sucs[c],f),this._in[f][v]=p,this._out[c][v]=p,this._edgeCount++,this},i.prototype.edge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d);return this._edgeLabels[h]},i.prototype.hasEdge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d);return e.has(this._edgeLabels,h)},i.prototype.removeEdge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d),_=this._edgeObjs[h];return _&&(c=_.v,f=_.w,delete this._edgeLabels[h],delete this._edgeObjs[h],o(this._preds[f],c),o(this._sucs[c],f),delete this._in[f][h],delete this._out[c][h],this._edgeCount--),this},i.prototype.inEdges=function(c,f){var d=this._in[c];if(d){var h=e.values(d);return f?e.filter(h,function(_){return _.v===f}):h}},i.prototype.outEdges=function(c,f){var d=this._out[c];if(d){var h=e.values(d);return f?e.filter(h,function(_){return _.w===f}):h}},i.prototype.nodeEdges=function(c,f){var d=this.inEdges(c,f);if(d)return d.concat(this.outEdges(c,f))};function a(c,f){c[f]?c[f]++:c[f]=1}function o(c,f){--c[f]||delete c[f]}function s(c,f,d,h){var _=""+f,g=""+d;if(!c&&_>g){var v=_;_=g,g=v}return _+n+g+n+(e.isUndefined(h)?t:h)}function u(c,f,d,h){var _=""+f,g=""+d;if(!c&&_>g){var v=_;_=g,g=v}var p={v:_,w:g};return h&&(p.name=h),p}function l(c,f){return s(c,f.v,f.w,f.name)}return ko}var Do,Oh;function Ox(){return Oh||(Oh=1,Do="2.1.8"),Do}var Lo,kh;function kx(){return kh||(kh=1,Lo={Graph:cc(),version:Ox()}),Lo}var Fo,Dh;function Dx(){if(Dh)return Fo;Dh=1;var e=Re(),t=cc();Fo={write:r,read:a};function r(o){var s={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:n(o),edges:i(o)};return e.isUndefined(o.graph())||(s.value=e.clone(o.graph())),s}function n(o){return e.map(o.nodes(),function(s){var u=o.node(s),l=o.parent(s),c={v:s};return e.isUndefined(u)||(c.value=u),e.isUndefined(l)||(c.parent=l),c})}function i(o){return e.map(o.edges(),function(s){var u=o.edge(s),l={v:s.v,w:s.w};return e.isUndefined(s.name)||(l.name=s.name),e.isUndefined(u)||(l.value=u),l})}function a(o){var s=new t(o.options).setGraph(o.value);return e.each(o.nodes,function(u){s.setNode(u.v,u.value),u.parent&&s.setParent(u.v,u.parent)}),e.each(o.edges,function(u){s.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),s}return Fo}var zo,Lh;function Lx(){if(Lh)return zo;Lh=1;var e=Re();zo=t;function t(r){var n={},i=[],a;function o(s){e.has(n,s)||(n[s]=!0,a.push(s),e.each(r.successors(s),o),e.each(r.predecessors(s),o))}return e.each(r.nodes(),function(s){a=[],o(s),a.length&&i.push(a)}),i}return zo}var Bo,Fh;function xy(){if(Fh)return Bo;Fh=1;var e=Re();Bo=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var n=this._keyIndices[r];if(n!==void 0)return this._arr[n].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,n){var i=this._keyIndices;if(r=String(r),!e.has(i,r)){var a=this._arr,o=a.length;return i[r]=o,a.push({key:r,priority:n}),this._decrease(o),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,n){var i=this._keyIndices[r];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},t.prototype._heapify=function(r){var n=this._arr,i=2*r,a=i+1,o=r;i>1,!(n[a].priority0&&(f=c.removeMin(),d=l[f],d.distance!==Number.POSITIVE_INFINITY);)u(f).forEach(h);return l}return Ho}var $o,Bh;function Fx(){if(Bh)return $o;Bh=1;var e=Sy(),t=Re();$o=r;function r(n,i,a){return t.transform(n.nodes(),function(o,s){o[s]=e(n,s,i,a)},{})}return $o}var Go,Hh;function qy(){if(Hh)return Go;Hh=1;var e=Re();Go=t;function t(r){var n=0,i=[],a={},o=[];function s(u){var l=a[u]={onStack:!0,lowlink:n,index:n++};if(i.push(u),r.successors(u).forEach(function(d){e.has(a,d)?a[d].onStack&&(l.lowlink=Math.min(l.lowlink,a[d].index)):(s(d),l.lowlink=Math.min(l.lowlink,a[d].lowlink))}),l.lowlink===l.index){var c=[],f;do f=i.pop(),a[f].onStack=!1,c.push(f);while(u!==f);o.push(c)}}return r.nodes().forEach(function(u){e.has(a,u)||s(u)}),o}return Go}var Vo,$h;function zx(){if($h)return Vo;$h=1;var e=Re(),t=qy();Vo=r;function r(n){return e.filter(t(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return Vo}var Uo,Gh;function Bx(){if(Gh)return Uo;Gh=1;var e=Re();Uo=r;var t=e.constant(1);function r(i,a,o){return n(i,a||t,o||function(s){return i.outEdges(s)})}function n(i,a,o){var s={},u=i.nodes();return u.forEach(function(l){s[l]={},s[l][l]={distance:0},u.forEach(function(c){l!==c&&(s[l][c]={distance:Number.POSITIVE_INFINITY})}),o(l).forEach(function(c){var f=c.v===l?c.w:c.v,d=a(c);s[l][f]={distance:d,predecessor:l}})}),u.forEach(function(l){var c=s[l];u.forEach(function(f){var d=s[f];u.forEach(function(h){var _=d[l],g=c[h],v=d[h],p=_.distance+g.distance;p0;){if(l=u.removeMin(),e.has(s,l))o.setEdge(l,s[l]);else{if(f)throw new Error("Input graph is not connected: "+i);f=!0}i.nodeEdges(l).forEach(c)}return o}return Xo}var Jo,Zh;function Ux(){return Zh||(Zh=1,Jo={components:Lx(),dijkstra:Sy(),dijkstraAll:Fx(),findCycles:zx(),floydWarshall:Bx(),isAcyclic:Hx(),postorder:$x(),preorder:Gx(),prim:Vx(),tarjan:qy(),topsort:Ry()}),Jo}var Qo,Xh;function jx(){if(Xh)return Qo;Xh=1;var e=kx();return Qo={Graph:e.Graph,json:Dx(),alg:Ux(),version:e.version},Qo}var es,Jh;function Te(){if(Jh)return es;Jh=1;var e;if(typeof Ku=="function")try{e=jx()}catch{}return e||(e=window.graphlib),es=e,es}var ts,Qh;function Kx(){if(Qh)return ts;Qh=1;var e=Jg(),t=1,r=4;function n(i){return e(i,t|r)}return ts=n,ts}var rs,ep;function Br(){if(ep)return rs;ep=1;var e=St(),t=je(),r=Tr(),n=qe();function i(a,o,s){if(!n(s))return!1;var u=typeof o;return(u=="number"?t(s)&&r(o,s.length):u=="string"&&o in s)?e(s[o],a):!1}return rs=i,rs}var ns,tp;function Yx(){if(tp)return ns;tp=1;var e=zr(),t=St(),r=Br(),n=ct(),i=Object.prototype,a=i.hasOwnProperty,o=e(function(s,u){s=Object(s);var l=-1,c=u.length,f=c>2?u[2]:void 0;for(f&&r(u[0],u[1],f)&&(c=1);++l-1?u[l?a[c]:c]:void 0}}return is=n,is}var as,np;function Ay(){if(np)return as;np=1;var e=Sm(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*r}return i===i?i:0}return as=n,as}var os,ip;function Zx(){if(ip)return os;ip=1;var e=Ay();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return os=t,os}var ss,ap;function Xx(){if(ap)return ss;ap=1;var e=by(),t=Ke(),r=Zx(),n=Math.max;function i(a,o,s){var u=a==null?0:a.length;if(!u)return-1;var l=s==null?0:r(s);return l<0&&(l=n(u+l,0)),e(a,t(o,3),l)}return ss=i,ss}var us,op;function Jx(){if(op)return us;op=1;var e=Wx(),t=Xx(),r=e(t);return us=r,us}var cs,sp;function Ny(){if(sp)return cs;sp=1;var e=uc();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return cs=t,cs}var ls,up;function Qx(){if(up)return ls;up=1;var e=ic(),t=Qg(),r=ct();function n(i,a){return i==null?i:e(i,t(a),r)}return ls=n,ls}var fs,cp;function eS(){if(cp)return fs;cp=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return fs=e,fs}var ds,lp;function tS(){if(lp)return ds;lp=1;var e=Nr(),t=ac(),r=Ke();function n(i,a){var o={};return a=r(a,3),t(i,function(s,u,l){e(o,u,a(s,u,l))}),o}return ds=n,ds}var hs,fp;function lc(){if(fp)return hs;fp=1;var e=xt();function t(r,n,i){for(var a=-1,o=r.length;++ar}return ps=e,ps}var vs,hp;function nS(){if(hp)return vs;hp=1;var e=lc(),t=rS(),r=lt();function n(i){return i&&i.length?e(i,r,t):void 0}return vs=n,vs}var gs,pp;function Iy(){if(pp)return gs;pp=1;var e=Nr(),t=St();function r(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&e(n,i,a)}return gs=r,gs}var ys,vp;function iS(){if(vp)return ys;vp=1;var e=st(),t=Or(),r=Le(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,u=o.call(Object);function l(c){if(!r(c)||e(c)!=n)return!1;var f=t(c);if(f===null)return!0;var d=s.call(f,"constructor")&&f.constructor;return typeof d=="function"&&d instanceof d&&o.call(d)==u}return ys=l,ys}var ms,gp;function Ty(){if(gp)return ms;gp=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return ms=e,ms}var _s,yp;function aS(){if(yp)return _s;yp=1;var e=Kt(),t=ct();function r(n){return e(n,t(n))}return _s=r,_s}var bs,mp;function oS(){if(mp)return bs;mp=1;var e=Iy(),t=Bg(),r=Wg(),n=Hg(),i=Xg(),a=Yt(),o=le(),s=wy(),u=qt(),l=jt(),c=qe(),f=iS(),d=Wt(),h=Ty(),_=aS();function g(v,p,y,b,m,E,x){var S=h(v,y),N=h(p,y),q=x.get(N);if(q){e(v,y,q);return}var A=E?E(S,N,y+"",v,p,x):void 0,I=A===void 0;if(I){var D=o(N),O=!D&&u(N),w=!D&&!O&&d(N);A=N,D||O||w?o(S)?A=S:s(S)?A=n(S):O?(I=!1,A=t(N,!0)):w?(I=!1,A=r(N,!0)):A=[]:f(N)||a(N)?(A=S,a(S)?A=_(S):(!c(S)||l(S))&&(A=i(N))):I=!1}I&&(x.set(N,A),m(A,N,b,E,x),x.delete(N)),e(v,y,A)}return bs=g,bs}var ws,_p;function sS(){if(_p)return ws;_p=1;var e=Ar(),t=Iy(),r=ic(),n=oS(),i=qe(),a=ct(),o=Ty();function s(u,l,c,f,d){u!==l&&r(l,function(h,_){if(d||(d=new e),i(h))n(u,l,_,c,s,f,d);else{var g=f?f(o(u,_),h,_+"",u,l,d):void 0;g===void 0&&(g=h),t(u,_,g)}},a)}return ws=s,ws}var Es,bp;function uS(){if(bp)return Es;bp=1;var e=zr(),t=Br();function r(n){return e(function(i,a){var o=-1,s=a.length,u=s>1?a[s-1]:void 0,l=s>2?a[2]:void 0;for(u=n.length>3&&typeof u=="function"?(s--,u):void 0,l&&t(a[0],a[1],l)&&(u=s<3?void 0:u,s=1),i=Object(i);++on||s&&u&&c&&!l&&!f||a&&u&&c||!i&&c||!o)return 1;if(!a&&!s&&!f&&r=l)return c;var f=i[a];return c*(f=="desc"?-1:1)}}return r.index-n.index}return Ls=t,Ls}var Fs,Dp;function xS(){if(Dp)return Fs;Dp=1;var e=Dr(),t=Fr(),r=Ke(),n=vy(),i=bS(),a=Mr(),o=ES(),s=lt(),u=le();function l(c,f,d){f.length?f=e(f,function(g){return u(g)?function(v){return t(v,g.length===1?g[0]:g)}:g}):f=[s];var h=-1;f=e(f,a(r));var _=n(c,function(g,v,p){var y=e(f,function(b){return b(g)});return{criteria:y,index:++h,value:g}});return i(_,function(g,v){return o(g,v,d)})}return Fs=l,Fs}var zs,Lp;function SS(){if(Lp)return zs;Lp=1;var e=uc(),t=xS(),r=zr(),n=Br(),i=r(function(a,o){if(a==null)return[];var s=o.length;return s>1&&n(a,o[0],o[1])?o=[]:s>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return zs=i,zs}var Bs,Fp;function qS(){if(Fp)return Bs;Fp=1;var e=uy(),t=0;function r(n){var i=++t;return e(n)+i}return Bs=r,Bs}var Hs,zp;function RS(){if(zp)return Hs;zp=1;function e(t,r,n){for(var i=-1,a=t.length,o=r.length,s={};++i0;--v)if(g=c[v].dequeue(),g){d=d.concat(o(l,c,f,g,!0));break}}}return d}function o(l,c,f,d,h){var _=h?[]:void 0;return e.forEach(l.inEdges(d.v),function(g){var v=l.edge(g),p=l.node(g.v);h&&_.push({v:g.v,w:g.w}),p.out-=v,u(c,f,p)}),e.forEach(l.outEdges(d.v),function(g){var v=l.edge(g),p=g.w,y=l.node(p);y.in-=v,u(c,f,y)}),l.removeNode(d.v),_}function s(l,c){var f=new t,d=0,h=0;e.forEach(l.nodes(),function(v){f.setNode(v,{v,in:0,out:0})}),e.forEach(l.edges(),function(v){var p=f.edge(v.v,v.w)||0,y=c(v),b=p+y;f.setEdge(v.v,v.w,b),h=Math.max(h,f.node(v.v).out+=y),d=Math.max(d,f.node(v.w).in+=y)});var _=e.range(h+d+3).map(function(){return new r}),g=d+1;return e.forEach(f.nodes(),function(v){u(_,g,f.node(v))}),{graph:f,buckets:_,zeroIdx:g}}function u(l,c,f){f.out?f.in?l[f.out-f.in+c].enqueue(f):l[l.length-1].enqueue(f):l[0].enqueue(f)}return Us}var js,Vp;function IS(){if(Vp)return js;Vp=1;var e=ae(),t=NS();js={run:r,undo:i};function r(a){var o=a.graph().acyclicer==="greedy"?t(a,s(a)):n(a);e.forEach(o,function(u){var l=a.edge(u);a.removeEdge(u),l.forwardName=u.name,l.reversed=!0,a.setEdge(u.w,u.v,l,e.uniqueId("rev"))});function s(u){return function(l){return u.edge(l).weight}}}function n(a){var o=[],s={},u={};function l(c){e.has(u,c)||(u[c]=!0,s[c]=!0,e.forEach(a.outEdges(c),function(f){e.has(s,f.w)?o.push(f):l(f.w)}),delete s[c])}return e.forEach(a.nodes(),l),o}function i(a){e.forEach(a.edges(),function(o){var s=a.edge(o);if(s.reversed){a.removeEdge(o);var u=s.forwardName;delete s.reversed,delete s.forwardName,a.setEdge(o.w,o.v,s,u)}})}return js}var Ks,Up;function _e(){if(Up)return Ks;Up=1;var e=ae(),t=Te().Graph;Ks={addDummyNode:r,simplify:n,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:o,intersectRect:s,buildLayerMatrix:u,normalizeRanks:l,removeEmptyRanks:c,addBorderNode:f,maxRank:d,partition:h,time:_,notime:g};function r(v,p,y,b){var m;do m=e.uniqueId(b);while(v.hasNode(m));return y.dummy=p,v.setNode(m,y),m}function n(v){var p=new t().setGraph(v.graph());return e.forEach(v.nodes(),function(y){p.setNode(y,v.node(y))}),e.forEach(v.edges(),function(y){var b=p.edge(y.v,y.w)||{weight:0,minlen:1},m=v.edge(y);p.setEdge(y.v,y.w,{weight:b.weight+m.weight,minlen:Math.max(b.minlen,m.minlen)})}),p}function i(v){var p=new t({multigraph:v.isMultigraph()}).setGraph(v.graph());return e.forEach(v.nodes(),function(y){v.children(y).length||p.setNode(y,v.node(y))}),e.forEach(v.edges(),function(y){p.setEdge(y,v.edge(y))}),p}function a(v){var p=e.map(v.nodes(),function(y){var b={};return e.forEach(v.outEdges(y),function(m){b[m.w]=(b[m.w]||0)+v.edge(m).weight}),b});return e.zipObject(v.nodes(),p)}function o(v){var p=e.map(v.nodes(),function(y){var b={};return e.forEach(v.inEdges(y),function(m){b[m.v]=(b[m.v]||0)+v.edge(m).weight}),b});return e.zipObject(v.nodes(),p)}function s(v,p){var y=v.x,b=v.y,m=p.x-y,E=p.y-b,x=v.width/2,S=v.height/2;if(!m&&!E)throw new Error("Not possible to find intersection inside of the rectangle");var N,q;return Math.abs(E)*x>Math.abs(m)*S?(E<0&&(S=-S),N=S*m/E,q=S):(m<0&&(x=-x),N=x,q=x*E/m),{x:y+N,y:b+q}}function u(v){var p=e.map(e.range(d(v)+1),function(){return[]});return e.forEach(v.nodes(),function(y){var b=v.node(y),m=b.rank;e.isUndefined(m)||(p[m][b.order]=y)}),p}function l(v){var p=e.min(e.map(v.nodes(),function(y){return v.node(y).rank}));e.forEach(v.nodes(),function(y){var b=v.node(y);e.has(b,"rank")&&(b.rank-=p)})}function c(v){var p=e.min(e.map(v.nodes(),function(E){return v.node(E).rank})),y=[];e.forEach(v.nodes(),function(E){var x=v.node(E).rank-p;y[x]||(y[x]=[]),y[x].push(E)});var b=0,m=v.graph().nodeRankFactor;e.forEach(y,function(E,x){e.isUndefined(E)&&x%m!==0?--b:b&&e.forEach(E,function(S){v.node(S).rank+=b})})}function f(v,p,y,b){var m={width:0,height:0};return arguments.length>=4&&(m.rank=y,m.order=b),r(v,"border",m,p)}function d(v){return e.max(e.map(v.nodes(),function(p){var y=v.node(p).rank;if(!e.isUndefined(y))return y}))}function h(v,p){var y={lhs:[],rhs:[]};return e.forEach(v,function(b){p(b)?y.lhs.push(b):y.rhs.push(b)}),y}function _(v,p){var y=e.now();try{return p()}finally{console.log(v+" time: "+(e.now()-y)+"ms")}}function g(v,p){return p()}return Ks}var Ys,jp;function TS(){if(jp)return Ys;jp=1;var e=ae(),t=_e();Ys={run:r,undo:i};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(o){n(a,o)})}function n(a,o){var s=o.v,u=a.node(s).rank,l=o.w,c=a.node(l).rank,f=o.name,d=a.edge(o),h=d.labelRank;if(c!==u+1){a.removeEdge(o);var _,g,v;for(v=0,++u;uq.lim&&(A=q,I=!0);var D=e.filter(m.edges(),function(O){return I===y(b,b.node(O.v),A)&&I!==y(b,b.node(O.w),A)});return e.minBy(D,function(O){return r(m,O)})}function g(b,m,E,x){var S=E.v,N=E.w;b.removeEdge(S,N),b.setEdge(x.v,x.w,{}),f(b),u(b,m),v(b,m)}function v(b,m){var E=e.find(b.nodes(),function(S){return!m.node(S).parent}),x=i(b,E);x=x.slice(1),e.forEach(x,function(S){var N=b.node(S).parent,q=m.edge(S,N),A=!1;q||(q=m.edge(N,S),A=!0),m.node(S).rank=m.node(N).rank+(A?q.minlen:-q.minlen)})}function p(b,m,E){return b.hasEdge(m,E)}function y(b,m,E){return E.low<=m.lim&&m.lim<=E.lim}return Xs}var Js,Zp;function PS(){if(Zp)return Js;Zp=1;var e=gr(),t=e.longestPath,r=Py(),n=MS();Js=i;function i(u){switch(u.graph().ranker){case"network-simplex":s(u);break;case"tight-tree":o(u);break;case"longest-path":a(u);break;default:s(u)}}var a=t;function o(u){t(u),r(u)}function s(u){n(u)}return Js}var Qs,Xp;function OS(){if(Xp)return Qs;Xp=1;var e=ae();Qs=t;function t(i){var a=n(i);e.forEach(i.graph().dummyChains,function(o){for(var s=i.node(o),u=s.edgeObj,l=r(i,a,u.v,u.w),c=l.path,f=l.lca,d=0,h=c[d],_=!0;o!==u.w;){if(s=i.node(o),_){for(;(h=c[d])!==f&&i.node(h).maxRankc||f>a[d].lim));for(h=d,d=s;(d=i.parent(d))!==h;)l.push(d);return{path:u.concat(l.reverse()),lca:h}}function n(i){var a={},o=0;function s(u){var l=o;e.forEach(i.children(u),s),a[u]={low:l,lim:o++}}return e.forEach(i.children(),s),a}return Qs}var eu,Jp;function kS(){if(Jp)return eu;Jp=1;var e=ae(),t=_e();eu={run:r,cleanup:o};function r(s){var u=t.addDummyNode(s,"root",{},"_root"),l=i(s),c=e.max(e.values(l))-1,f=2*c+1;s.graph().nestingRoot=u,e.forEach(s.edges(),function(h){s.edge(h).minlen*=f});var d=a(s)+1;e.forEach(s.children(),function(h){n(s,u,f,d,c,l,h)}),s.graph().nodeRankFactor=f}function n(s,u,l,c,f,d,h){var _=s.children(h);if(!_.length){h!==u&&s.setEdge(u,h,{weight:0,minlen:l});return}var g=t.addBorderNode(s,"_bt"),v=t.addBorderNode(s,"_bb"),p=s.node(h);s.setParent(g,h),p.borderTop=g,s.setParent(v,h),p.borderBottom=v,e.forEach(_,function(y){n(s,u,l,c,f,d,y);var b=s.node(y),m=b.borderTop?b.borderTop:y,E=b.borderBottom?b.borderBottom:y,x=b.borderTop?c:2*c,S=m!==E?1:f-d[h]+1;s.setEdge(g,m,{weight:x,minlen:S,nestingEdge:!0}),s.setEdge(E,v,{weight:x,minlen:S,nestingEdge:!0})}),s.parent(h)||s.setEdge(u,g,{weight:0,minlen:f+d[h]})}function i(s){var u={};function l(c,f){var d=s.children(c);d&&d.length&&e.forEach(d,function(h){l(h,f+1)}),u[c]=f}return e.forEach(s.children(),function(c){l(c,1)}),u}function a(s){return e.reduce(s.edges(),function(u,l){return u+s.edge(l).weight},0)}function o(s){var u=s.graph();s.removeNode(u.nestingRoot),delete u.nestingRoot,e.forEach(s.edges(),function(l){var c=s.edge(l);c.nestingEdge&&s.removeEdge(l)})}return eu}var tu,Qp;function DS(){if(Qp)return tu;Qp=1;var e=ae(),t=_e();tu=r;function r(i){function a(o){var s=i.children(o),u=i.node(o);if(s.length&&e.forEach(s,a),e.has(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(var l=u.minRank,c=u.maxRank+1;l0;)h%2&&(_+=c[h+1]),h=h-1>>1,c[h]+=d.weight;f+=d.weight*_})),f}return iu}var au,nv;function BS(){if(nv)return au;nv=1;var e=ae();au=t;function t(r,n){return e.map(n,function(i){var a=r.inEdges(i);if(a.length){var o=e.reduce(a,function(s,u){var l=r.edge(u),c=r.node(u.v);return{sum:s.sum+l.weight*c.order,weight:s.weight+l.weight}},{sum:0,weight:0});return{v:i,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:i}})}return au}var ou,iv;function HS(){if(iv)return ou;iv=1;var e=ae();ou=t;function t(i,a){var o={};e.forEach(i,function(u,l){var c=o[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:l};e.isUndefined(u.barycenter)||(c.barycenter=u.barycenter,c.weight=u.weight)}),e.forEach(a.edges(),function(u){var l=o[u.v],c=o[u.w];!e.isUndefined(l)&&!e.isUndefined(c)&&(c.indegree++,l.out.push(o[u.w]))});var s=e.filter(o,function(u){return!u.indegree});return r(s)}function r(i){var a=[];function o(l){return function(c){c.merged||(e.isUndefined(c.barycenter)||e.isUndefined(l.barycenter)||c.barycenter>=l.barycenter)&&n(l,c)}}function s(l){return function(c){c.in.push(l),--c.indegree===0&&i.push(c)}}for(;i.length;){var u=i.pop();a.push(u),e.forEach(u.in.reverse(),o(u)),e.forEach(u.out,s(u))}return e.map(e.filter(a,function(l){return!l.merged}),function(l){return e.pick(l,["vs","i","barycenter","weight"])})}function n(i,a){var o=0,s=0;i.weight&&(o+=i.barycenter*i.weight,s+=i.weight),a.weight&&(o+=a.barycenter*a.weight,s+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=o/s,i.weight=s,i.i=Math.min(a.i,i.i),a.merged=!0}return ou}var su,av;function $S(){if(av)return su;av=1;var e=ae(),t=_e();su=r;function r(a,o){var s=t.partition(a,function(g){return e.has(g,"barycenter")}),u=s.lhs,l=e.sortBy(s.rhs,function(g){return-g.i}),c=[],f=0,d=0,h=0;u.sort(i(!!o)),h=n(c,l,h),e.forEach(u,function(g){h+=g.vs.length,c.push(g.vs),f+=g.barycenter*g.weight,d+=g.weight,h=n(c,l,h)});var _={vs:e.flatten(c,!0)};return d&&(_.barycenter=f/d,_.weight=d),_}function n(a,o,s){for(var u;o.length&&(u=e.last(o)).i<=s;)o.pop(),a.push(u.vs),s++;return s}function i(a){return function(o,s){return o.barycenters.barycenter?1:a?s.i-o.i:o.i-s.i}}return su}var uu,ov;function GS(){if(ov)return uu;ov=1;var e=ae(),t=BS(),r=HS(),n=$S();uu=i;function i(s,u,l,c){var f=s.children(u),d=s.node(u),h=d?d.borderLeft:void 0,_=d?d.borderRight:void 0,g={};h&&(f=e.filter(f,function(E){return E!==h&&E!==_}));var v=t(s,f);e.forEach(v,function(E){if(s.children(E.v).length){var x=i(s,E.v,l,c);g[E.v]=x,e.has(x,"barycenter")&&o(E,x)}});var p=r(v,l);a(p,g);var y=n(p,c);if(h&&(y.vs=e.flatten([h,y.vs,_],!0),s.predecessors(h).length)){var b=s.node(s.predecessors(h)[0]),m=s.node(s.predecessors(_)[0]);e.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+b.order+m.order)/(y.weight+2),y.weight+=2}return y}function a(s,u){e.forEach(s,function(l){l.vs=e.flatten(l.vs.map(function(c){return u[c]?u[c].vs:c}),!0)})}function o(s,u){e.isUndefined(s.barycenter)?(s.barycenter=u.barycenter,s.weight=u.weight):(s.barycenter=(s.barycenter*s.weight+u.barycenter*u.weight)/(s.weight+u.weight),s.weight+=u.weight)}return uu}var cu,sv;function VS(){if(sv)return cu;sv=1;var e=ae(),t=Te().Graph;cu=r;function r(i,a,o){var s=n(i),u=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(function(l){return i.node(l)});return e.forEach(i.nodes(),function(l){var c=i.node(l),f=i.parent(l);(c.rank===a||c.minRank<=a&&a<=c.maxRank)&&(u.setNode(l),u.setParent(l,f||s),e.forEach(i[o](l),function(d){var h=d.v===l?d.w:d.v,_=u.edge(h,l),g=e.isUndefined(_)?0:_.weight;u.setEdge(h,l,{weight:i.edge(d).weight+g})}),e.has(c,"minRank")&&u.setNode(l,{borderLeft:c.borderLeft[a],borderRight:c.borderRight[a]}))}),u}function n(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return cu}var lu,uv;function US(){if(uv)return lu;uv=1;var e=ae();lu=t;function t(r,n,i){var a={},o;e.forEach(i,function(s){for(var u=r.parent(s),l,c;u;){if(l=r.parent(u),l?(c=a[l],a[l]=u):(c=o,o=u),c&&c!==u){n.setEdge(c,u);return}u=l}})}return lu}var fu,cv;function jS(){if(cv)return fu;cv=1;var e=ae(),t=FS(),r=zS(),n=GS(),i=VS(),a=US(),o=Te().Graph,s=_e();fu=u;function u(d){var h=s.maxRank(d),_=l(d,e.range(1,h+1),"inEdges"),g=l(d,e.range(h-1,-1,-1),"outEdges"),v=t(d);f(d,v);for(var p=Number.POSITIVE_INFINITY,y,b=0,m=0;m<4;++b,++m){c(b%2?_:g,b%4>=2),v=s.buildLayerMatrix(d);var E=r(d,v);EA)&&o(b,O,I)})})}function E(x,S){var N=-1,q,A=0;return e.forEach(S,function(I,D){if(p.node(I).dummy==="border"){var O=p.predecessors(I);O.length&&(q=p.node(O[0]).order,m(S,A,D,N,q),A=D,N=q)}m(S,A,S.length,q,x.length)}),S}return e.reduce(y,E),b}function a(p,y){if(p.node(y).dummy)return e.find(p.predecessors(y),function(b){return p.node(b).dummy})}function o(p,y,b){if(y>b){var m=y;y=b,b=m}var E=p[y];E||(p[y]=E={}),E[b]=!0}function s(p,y,b){if(y>b){var m=y;y=b,b=m}return e.has(p[y],b)}function u(p,y,b,m){var E={},x={},S={};return e.forEach(y,function(N){e.forEach(N,function(q,A){E[q]=q,x[q]=q,S[q]=A})}),e.forEach(y,function(N){var q=-1;e.forEach(N,function(A){var I=m(A);if(I.length){I=e.sortBy(I,function(C){return S[C]});for(var D=(I.length-1)/2,O=Math.floor(D),w=Math.ceil(D);O<=w;++O){var T=I[O];x[A]===A&&qn[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var P=Cs(),b=le();const at=ue(b),Co=Ms({__proto__:null,default:at},[b]),re=new WeakMap,Is=new WeakMap,Tt={current:[]};let qt=!1,mt=0;const pt=new Set,Pt=new Map;function Qe(t){for(const s of t){if(Tt.current.includes(s))continue;Tt.current.push(s),s.recompute();const e=Is.get(s);if(e)for(const n of e){const o=re.get(n);o?.length&&Qe(o)}}}function Es(t){const s={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(s)}function ks(t){const s={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(s)}function ts(t){if(mt>0&&!Pt.has(t)&&Pt.set(t,t.prevState),pt.add(t),!(mt>0)&&!qt)try{for(qt=!0;pt.size>0;){const s=Array.from(pt);pt.clear();for(const e of s){const n=Pt.get(e)??e.prevState;e.prevState=n,Es(e)}for(const e of s){const n=re.get(e);n&&(Tt.current.push(e),Qe(n))}for(const e of s){const n=re.get(e);if(n)for(const o of n)ks(o)}}}finally{qt=!1,Tt.current=[],Pt.clear()}}function gt(t){mt++;try{t()}finally{if(mt--,mt===0){const s=pt.values().next().value;s&&ts(s)}}}function Ts(t){return typeof t=="function"}class Os{constructor(s,e){this.listeners=new Set,this.subscribe=n=>{var o,i;this.listeners.add(n);const r=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,n,this);return()=>{this.listeners.delete(n),r?.()}},this.prevState=s,this.state=s,this.options=e}setState(s){var e,n,o;this.prevState=this.state,(e=this.options)!=null&&e.updateFn?this.state=this.options.updateFn(this.prevState)(s):Ts(s)?this.state=s(this.prevState):this.state=s,(o=(n=this.options)==null?void 0:n.onUpdate)==null||o.call(n),ts(this)}}const G="__TSR_index",Me="popstate",Ie="beforeunload";function Fs(t){let s=t.getLocation();const e=new Set,n=r=>{s=t.getLocation(),e.forEach(a=>a({location:s,action:r}))},o=r=>{t.notifyOnIndexChange??!0?n(r):s=t.getLocation()},i=async({task:r,navigateOpts:a,...c})=>{if(a?.ignoreBlocker??!1){r();return}const d=t.getBlockers?.()??[],l=c.type==="PUSH"||c.type==="REPLACE";if(typeof document<"u"&&d.length&&l)for(const u of d){const f=Ot(c.path,c.state);if(await u.blockerFn({currentLocation:s,nextLocation:f,action:c.type})){t.onBlocked?.();return}}r()};return{get location(){return s},get length(){return t.getLength()},subscribers:e,subscribe:r=>(e.add(r),()=>{e.delete(r)}),push:(r,a,c)=>{const h=s.state[G];a=Ee(h+1,a),i({task:()=>{t.pushState(r,a),n({type:"PUSH"})},navigateOpts:c,type:"PUSH",path:r,state:a})},replace:(r,a,c)=>{const h=s.state[G];a=Ee(h,a),i({task:()=>{t.replaceState(r,a),n({type:"REPLACE"})},navigateOpts:c,type:"REPLACE",path:r,state:a})},go:(r,a)=>{i({task:()=>{t.go(r),o({type:"GO",index:r})},navigateOpts:a,type:"GO"})},back:r=>{i({task:()=>{t.back(r?.ignoreBlocker??!1),o({type:"BACK"})},navigateOpts:r,type:"BACK"})},forward:r=>{i({task:()=>{t.forward(r?.ignoreBlocker??!1),o({type:"FORWARD"})},navigateOpts:r,type:"FORWARD"})},canGoBack:()=>s.state[G]!==0,createHref:r=>t.createHref(r),block:r=>{if(!t.setBlockers)return()=>{};const a=t.getBlockers?.()??[];return t.setBlockers([...a,r]),()=>{const c=t.getBlockers?.()??[];t.setBlockers?.(c.filter(h=>h!==r))}},flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:n}}function Ee(t,s){s||(s={});const e=he();return{...s,key:e,__TSR_key:e,[G]:t}}function As(t){const s=typeof document<"u"?window:void 0,e=s.history.pushState,n=s.history.replaceState;let o=[];const i=()=>o,r=w=>o=w,a=(w=>w),c=(()=>Ot(`${s.location.pathname}${s.location.search}${s.location.hash}`,s.history.state));if(!s.history.state?.__TSR_key&&!s.history.state?.key){const w=he();s.history.replaceState({[G]:0,key:w,__TSR_key:w},"")}let h=c(),d,l=!1,u=!1,f=!1,p=!1;const g=()=>h;let m,y;const v=()=>{m&&(R._ignoreSubscribers=!0,(m.isPush?s.history.pushState:s.history.replaceState)(m.state,"",m.href),R._ignoreSubscribers=!1,m=void 0,y=void 0,d=void 0)},S=(w,C,M)=>{const I=a(C);y||(d=h),h=Ot(C,M),m={href:I,state:M,isPush:m?.isPush||w==="push"},y||(y=Promise.resolve().then(()=>v()))},x=w=>{h=c(),R.notify({type:w})},L=async()=>{if(u){u=!1;return}const w=c(),C=w.state[G]-h.state[G],M=C===1,I=C===-1,F=!M&&!I||l;l=!1;const A=F?"GO":I?"BACK":"FORWARD",j=F?{type:"GO",index:C}:{type:I?"BACK":"FORWARD"};if(f)f=!1;else{const N=i();if(typeof document<"u"&&N.length){for(const nt of N)if(await nt.blockerFn({currentLocation:h,nextLocation:w,action:A})){u=!0,s.history.go(1),R.notify(j);return}}}h=c(),R.notify(j)},_=w=>{if(p){p=!1;return}let C=!1;const M=i();if(typeof document<"u"&&M.length)for(const I of M){const F=I.enableBeforeUnload??!0;if(F===!0){C=!0;break}if(typeof F=="function"&&F()===!0){C=!0;break}}if(C)return w.preventDefault(),w.returnValue=""},R=Fs({getLocation:g,getLength:()=>s.history.length,pushState:(w,C)=>S("push",w,C),replaceState:(w,C)=>S("replace",w,C),back:w=>(w&&(f=!0),p=!0,s.history.back()),forward:w=>{w&&(f=!0),p=!0,s.history.forward()},go:w=>{l=!0,s.history.go(w)},createHref:w=>a(w),flush:v,destroy:()=>{s.history.pushState=e,s.history.replaceState=n,s.removeEventListener(Ie,_,{capture:!0}),s.removeEventListener(Me,L)},onBlocked:()=>{d&&h!==d&&(h=d)},getBlockers:i,setBlockers:r,notifyOnIndexChange:!1});return s.addEventListener(Ie,_,{capture:!0}),s.addEventListener(Me,L),s.history.pushState=function(...w){const C=e.apply(s.history,w);return R._ignoreSubscribers||x("PUSH"),C},s.history.replaceState=function(...w){const C=n.apply(s.history,w);return R._ignoreSubscribers||x("REPLACE"),C},R}function Ot(t,s){const e=t.indexOf("#"),n=t.indexOf("?"),o=he();return{href:t,pathname:t.substring(0,e>0?n>0?Math.min(e,n):e:n>0?n:t.length),hash:e>-1?t.substring(e):"",search:n>-1?t.slice(n,e===-1?void 0:e):"",state:s||{[G]:0,key:o,__TSR_key:o}}}function he(){return(Math.random()+1).toString(36).substring(7)}function Ft(t){return t[t.length-1]}function Bs(t){return typeof t=="function"}function H(t,s){return Bs(t)?t(s):t}const zs=Object.prototype.hasOwnProperty;function z(t,s){if(t===s)return t;const e=s,n=Oe(t)&&Oe(e);if(!n&&!(At(t)&&At(e)))return e;const o=n?t:ke(t);if(!o)return e;const i=n?e:ke(e);if(!i)return e;const r=o.length,a=i.length,c=n?new Array(a):{};let h=0;for(let d=0;d"u")return!0;const e=s.prototype;return!(!Te(e)||!e.hasOwnProperty("isPrototypeOf"))}function Te(t){return Object.prototype.toString.call(t)==="[object Object]"}function Oe(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Z(t,s,e){if(t===s)return!0;if(typeof t!=typeof s)return!1;if(Array.isArray(t)&&Array.isArray(s)){if(t.length!==s.length)return!1;for(let n=0,o=t.length;no||!Z(t[r],s[r],e)))return!1;return o===i}return!1}function ct(t){let s,e;const n=new Promise((o,i)=>{s=o,e=i});return n.status="pending",n.resolve=o=>{n.status="resolved",n.value=o,s(o),t?.(o)},n.reject=o=>{n.status="rejected",e(o)},n}function J(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}function Fe(t){try{return decodeURI(t)}catch{return t.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}}function Ae(t,s){if(!t)return t;const e=/%25|%5C/gi;let n=0,o="",i;for(;(i=e.exec(t))!==null;)o+=Fe(t.slice(n,i.index))+i[0],n=e.lastIndex;return o+Fe(n?t.slice(n):t)}var Ds="Invariant failed";function K(t,s){if(!t)throw new Error(Ds)}function Bt(t){const s=new Map;let e,n;const o=i=>{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,n&&(n.next=i,i.prev=n)):(i.next.prev=void 0,e=i.next,i.next=void 0,n&&(i.prev=n,n.next=i)),n=i)};return{get(i){const r=s.get(i);if(r)return o(r),r.value},set(i,r){if(s.size>=t&&e){const c=e;s.delete(c.key),c.next&&(e=c.next,c.next.prev=void 0),c===n&&(n=void 0)}const a=s.get(i);if(a)a.value=r,o(a);else{const c={key:i,value:r,prev:n};n&&(n.next=c),n=c,e||(e=c),s.set(i,c)}},clear(){s.clear(),e=void 0,n=void 0}}}const lt=0,et=1,st=2,vt=3,js=/^([^{]*)\{\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,Ns=/^([^{]*)\{-\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,Ws=/^([^{]*)\{\$\}([^}]*)$/;function de(t,s,e=new Uint16Array(6)){const n=t.indexOf("/",s),o=n===-1?t.length:n,i=t.substring(s,o);if(!i||!i.includes("$"))return e[0]=lt,e[1]=s,e[2]=s,e[3]=o,e[4]=o,e[5]=o,e;if(i==="$"){const h=t.length;return e[0]=st,e[1]=s,e[2]=s,e[3]=h,e[4]=h,e[5]=h,e}if(i.charCodeAt(0)===36)return e[0]=et,e[1]=s,e[2]=s+1,e[3]=o,e[4]=o,e[5]=o,e;const r=i.match(Ws);if(r){const d=r[1].length;return e[0]=st,e[1]=s+d,e[2]=s+d+1,e[3]=s+d+2,e[4]=s+d+3,e[5]=t.length,e}const a=i.match(Ns);if(a){const h=a[1],d=a[2],l=a[3],u=h.length;return e[0]=vt,e[1]=s+u,e[2]=s+u+3,e[3]=s+u+3+d.length,e[4]=o-l.length,e[5]=o,e}const c=i.match(js);if(c){const h=c[1],d=c[2],l=c[3],u=h.length;return e[0]=et,e[1]=s+u,e[2]=s+u+2,e[3]=s+u+2+d.length,e[4]=o-l.length,e[5]=o,e}return e[0]=lt,e[1]=s,e[2]=s,e[3]=o,e[4]=o,e[5]=o,e}function Wt(t,s,e,n,o,i,r){r?.(e);let a=n;{const c=e.fullPath??e.from,h=c.length,d=e.options?.caseSensitive??t;for(;a_.caseSensitive===v&&_.prefix===S&&_.suffix===x);if(L)u=L;else{const _=Jt(et,e.fullPath??e.from,v,S,x);u=_,_.depth=i,_.parent=o,o.dynamic??=[],o.dynamic.push(_)}break}case vt:{const m=c.substring(f,l[1]),y=c.substring(l[4],p),v=d&&!!(m||y),S=m?v?m:m.toLowerCase():void 0,x=y?v?y:y.toLowerCase():void 0,L=o.optional?.find(_=>_.caseSensitive===v&&_.prefix===S&&_.suffix===x);if(L)u=L;else{const _=Jt(vt,e.fullPath??e.from,v,S,x);u=_,_.parent=o,_.depth=i,o.optional??=[],o.optional.push(_)}break}case st:{const m=c.substring(f,l[1]),y=c.substring(l[4],p),v=d&&!!(m||y),S=m?v?m:m.toLowerCase():void 0,x=y?v?y:y.toLowerCase():void 0,L=Jt(st,e.fullPath??e.from,v,S,x);u=L,L.parent=o,L.depth=i,o.wildcard??=[],o.wildcard.push(L)}}o=u}if((e.path||!e.children)&&!e.isRoot){const l=c.endsWith("/");l||(o.notFound=e),(!o.route||!o.isIndex&&l)&&(o.route=e,o.fullPath=e.fullPath??e.from),o.isIndex||=l}}if(e.children)for(const c of e.children)Wt(t,s,c,a,o,i,r)}function Gt(t,s){if(t.prefix&&s.prefix&&t.prefix!==s.prefix){if(t.prefix.startsWith(s.prefix))return-1;if(s.prefix.startsWith(t.prefix))return 1}if(t.suffix&&s.suffix&&t.suffix!==s.suffix){if(t.suffix.endsWith(s.suffix))return-1;if(s.suffix.endsWith(t.suffix))return 1}return t.prefix&&!s.prefix?-1:!t.prefix&&s.prefix?1:t.suffix&&!s.suffix?-1:!t.suffix&&s.suffix?1:t.caseSensitive&&!s.caseSensitive?-1:!t.caseSensitive&&s.caseSensitive?1:0}function X(t){if(t.static)for(const s of t.static.values())X(s);if(t.staticInsensitive)for(const s of t.staticInsensitive.values())X(s);if(t.dynamic?.length){t.dynamic.sort(Gt);for(const s of t.dynamic)X(s)}if(t.optional?.length){t.optional.sort(Gt);for(const s of t.optional)X(s)}if(t.wildcard?.length){t.wildcard.sort(Gt);for(const s of t.wildcard)X(s)}}function St(t){return{kind:lt,depth:0,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,isIndex:!1,notFound:null}}function Jt(t,s,e,n,o){return{kind:t,depth:0,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:s,parent:null,isIndex:!1,notFound:null,caseSensitive:e,prefix:n,suffix:o}}function $s(t,s){const e=St("/"),n=new Uint16Array(6);for(const o of t)Wt(!1,n,o,1,e,0);X(e),s.masksTree=e,s.flatCache=Bt(1e3)}function Us(t,s){t||="/";const e=s.flatCache.get(t);if(e)return e;const n=fe(t,s.masksTree);return s.flatCache.set(t,n),n}function Vs(t,s,e,n,o){t||="/",n||="/";const i=s?`case\0${t}`:t;let r=o.singleCache.get(i);if(!r){r=St("/");const a=new Uint16Array(6);Wt(s,a,{from:t},1,r,0),o.singleCache.set(i,r)}return fe(n,r,e)}function Ks(t,s,e=!1){const n=e?t:`nofuzz\0${t}`,o=s.matchCache.get(n);if(o!==void 0)return o;t||="/";const i=fe(t,s.segmentTree,e);return i&&(i.branch=Js(i.route)),s.matchCache.set(n,i),i}function Hs(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}function qs(t,s=!1,e){const n=St(t.fullPath),o=new Uint16Array(6),i={},r={};let a=0;return Wt(s,o,t,1,n,0,h=>{if(e?.(h,a),K(!(h.id in i),`Duplicate routes found with id: ${String(h.id)}`),i[h.id]=h,a!==0&&h.path){const d=Hs(h.fullPath);(!r[d]||h.fullPath.endsWith("/"))&&(r[d]=h)}a++}),X(n),{processedTree:{segmentTree:n,singleCache:Bt(1e3),matchCache:Bt(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:r}}function fe(t,s,e=!1){const n=t.split("/"),o=Xs(t,n,s,e);if(!o)return null;const i=Gs(t,n,o),r="**"in o;return r&&(i["**"]=o["**"]),{route:r?o.node.notFound??o.node.route:o.node.route,params:i}}function Gs(t,s,e){const n=Ys(e.node);let o=null;const i={};for(let r=0,a=0,c=0;a=0;w--){const C=u.optional[w];a.push({node:C,index:f,skipped:_,depth:R,statics:m,dynamics:y,optionals:v})}if(!S)for(let w=u.optional.length-1;w>=0;w--){const C=u.optional[w],{prefix:M,suffix:I}=C;if(M||I){const F=C.caseSensitive?x:L??=x.toLowerCase();if(M&&!F.startsWith(M)||I&&!F.endsWith(I))continue}a.push({node:C,index:f+1,skipped:p,depth:R,statics:m,dynamics:y,optionals:v+1})}}if(!S&&u.dynamic&&x)for(let _=u.dynamic.length-1;_>=0;_--){const R=u.dynamic[_],{prefix:w,suffix:C}=R;if(w||C){const M=R.caseSensitive?x:L??=x.toLowerCase();if(w&&!M.startsWith(w)||C&&!M.endsWith(C))continue}a.push({node:R,index:f+1,skipped:p,depth:g+1,statics:m,dynamics:y+1,optionals:v})}if(!S&&u.staticInsensitive){const _=u.staticInsensitive.get(L??=x.toLowerCase());_&&a.push({node:_,index:f+1,skipped:p,depth:g+1,statics:m+1,dynamics:y,optionals:v})}if(!S&&u.static){const _=u.static.get(x);_&&a.push({node:_,index:f+1,skipped:p,depth:g+1,statics:m+1,dynamics:y,optionals:v})}}if(d&&c)return bt(c,d)?d:c;if(d)return d;if(c)return c;if(n&&h){let l=h.index;for(let f=0;ft.statics||s.statics===t.statics&&(s.dynamics>t.dynamics||s.dynamics===t.dynamics&&(s.optionals>t.optionals||s.optionals===t.optionals&&(s.node.isIndex>t.node.isIndex||s.node.isIndex===t.node.isIndex&&s.depth>t.depth))):!0}function It(t){return pe(t.filter(s=>s!==void 0).join("/"))}function pe(t){return t.replace(/\/{2,}/g,"/")}function es(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}function Q(t){const s=t.length;return s>1&&t[s-1]==="/"?t.replace(/\/{1,}$/,""):t}function Et(t){return Q(es(t))}function zt(t,s){return t?.endsWith("/")&&t!=="/"&&t!==`${s}/`?t.slice(0,-1):t}function Zs(t,s,e){return zt(t,e)===zt(s,e)}function Qs({base:t,to:s,trailingSlash:e="never",cache:n}){const o=s.startsWith("/"),i=!o&&s===".";let r;if(n){r=o?s:i?t:t+"\0"+s;const l=n.get(r);if(l)return l}let a;if(i)a=t.split("/");else if(o)a=s.split("/");else{for(a=t.split("/");a.length>1&&Ft(a)==="";)a.pop();const l=s.split("/");for(let u=0,f=l.length;u1&&(Ft(a)===""?e==="never"&&a.pop():e==="always"&&a.push(""));let c,h="";for(let l=0;l0&&(h+="/");const u=a[l];if(!u)continue;c=de(u,0,c);const f=c[0];if(f===lt){h+=u;continue}const p=c[5],g=u.substring(0,c[1]),m=u.substring(c[4],p),y=u.substring(c[2],c[3]);f===et?h+=g||m?`${g}{$${y}}${m}`:`$${y}`:f===st?h+=g||m?`${g}{$}${m}`:"$":h+=`${g}{-$${y}}${m}`}h=pe(h);const d=h||"/";return r&&n&&n.set(r,d),d}function Yt(t,s,e){const n=s[t];return typeof n!="string"?n:t==="_splat"?encodeURI(n):tn(n,e)}function Xt({path:t,params:s,decodeCharMap:e}){let n=!1;const o={};if(!t||t==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:n};if(!t.includes("$"))return{interpolatedPath:t,usedParams:o,isMissingParams:n};const i=t.length;let r=0,a,c="";for(;r{let e;return(...n)=>{e||(e=setTimeout(()=>{t(...n),e=null},s))}};function nn(){const t=en();if(!t)return null;const s=t.getItem(Dt);let e=s?JSON.parse(s):{};return{state:e,set:n=>(e=H(n,e)||e,t.setItem(Dt,JSON.stringify(e)))}}const Ct=nn(),ae=t=>t.state.__TSR_key||t.href;function on(t){const s=[];let e;for(;e=t.parentNode;)s.push(`${t.tagName}:nth-child(${Array.prototype.indexOf.call(e.children,t)+1})`),t=e;return`${s.reverse().join(" > ")}`.toLowerCase()}let jt=!1;function ss({storageKey:t,key:s,behavior:e,shouldScrollRestoration:n,scrollToTopSelectors:o,location:i}){let r;try{r=JSON.parse(sessionStorage.getItem(t)||"{}")}catch(h){console.error(h);return}const a=s||window.history.state?.__TSR_key,c=r[a];jt=!0;t:{if(n&&c&&Object.keys(c).length>0){for(const l in c){const u=c[l];if(l==="window")window.scrollTo({top:u.scrollY,left:u.scrollX,behavior:e});else if(l){const f=document.querySelector(l);f&&(f.scrollLeft=u.scrollX,f.scrollTop=u.scrollY)}}break t}const h=(i??window.location).hash.split("#",2)[1];if(h){const l=window.history.state?.__hashScrollIntoViewOptions??!0;if(l){const u=document.getElementById(h);u&&u.scrollIntoView(l)}break t}const d={top:0,left:0,behavior:e};if(window.scrollTo(d),o)for(const l of o){if(l==="window")continue;const u=typeof l=="function"?l():document.querySelector(l);u&&u.scrollTo(d)}}jt=!1}function rn(t,s){if(!Ct&&!t.isServer||((t.options.scrollRestoration??!1)&&(t.isScrollRestoring=!0),t.isServer||t.isScrollRestorationSetup||!Ct))return;t.isScrollRestorationSetup=!0,jt=!1;const n=t.options.getScrollRestorationKey||ae;window.history.scrollRestoration="manual";const o=i=>{if(jt||!t.isScrollRestoring)return;let r="";if(i.target===document||i.target===window)r="window";else{const c=i.target.getAttribute("data-scroll-restoration-id");c?r=`[data-scroll-restoration-id="${c}"]`:r=on(i.target)}const a=n(t.state.location);Ct.set(c=>{const h=c[a]||={},d=h[r]||={};if(r==="window")d.scrollX=window.scrollX||0,d.scrollY=window.scrollY||0;else if(r){const l=document.querySelector(r);l&&(d.scrollX=l.scrollLeft||0,d.scrollY=l.scrollTop||0)}return c})};typeof document<"u"&&document.addEventListener("scroll",sn(o,100),!0),t.subscribe("onRendered",i=>{const r=n(i.toLocation);if(!t.resetNextScroll){t.resetNextScroll=!0;return}typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation})||(ss({storageKey:Dt,key:r,behavior:t.options.scrollRestorationBehavior,shouldScrollRestoration:t.isScrollRestoring,scrollToTopSelectors:t.options.scrollToTopSelectors,location:t.history.location}),t.isScrollRestoring&&Ct.set(a=>(a[r]||={},a)))})}function an(t){if(typeof document<"u"&&document.querySelector){const s=t.state.location.state.__hashScrollIntoViewOptions??!0;if(s&&t.state.location.hash!==""){const e=document.getElementById(t.state.location.hash);e&&e.scrollIntoView(s)}}}function cn(t,s=String){const e=new URLSearchParams;for(const n in t){const o=t[n];o!==void 0&&e.set(n,s(o))}return e.toString()}function Zt(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}function ln(t){const s=new URLSearchParams(t),e={};for(const[n,o]of s.entries()){const i=e[n];i==null?e[n]=Zt(o):Array.isArray(i)?i.push(Zt(o)):e[n]=[i,Zt(o)]}return e}const un=dn(JSON.parse),hn=fn(JSON.stringify,JSON.parse);function dn(t){return s=>{s[0]==="?"&&(s=s.substring(1));const e=ln(s);for(const n in e){const o=e[n];if(typeof o=="string")try{e[n]=t(o)}catch{}}return e}}function fn(t,s){const e=typeof s=="function";function n(o){if(typeof o=="object"&&o!==null)try{return t(o)}catch{}else if(e&&typeof o=="string")try{return s(o),t(o)}catch{}return o}return o=>{const i=cn(o,n);return i?`?${i}`:""}}const B="__root__";function pn(t){if(t.statusCode=t.statusCode||t.code||307,!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}const s=new Headers(t.headers);t.href&&s.get("Location")===null&&s.set("Location",t.href);const e=new Response(null,{status:t.statusCode,headers:s});if(e.options=t,t.throw)throw e;return e}function $(t){return t instanceof Response&&!!t.options}const kt=t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},$t=(t,s)=>!!(t.preload&&!t.router.state.matches.some(e=>e.id===s)),ns=(t,s)=>{const e=t.router.routesById[s.routeId??""]??t.router.routeTree;!e.options.notFoundComponent&&t.router.options?.defaultNotFoundComponent&&(e.options.notFoundComponent=t.router.options.defaultNotFoundComponent),K(e.options.notFoundComponent);const n=t.matches.find(o=>o.routeId===e.id);K(n,"Could not find match for route: "+e.id),t.updateMatch(n.id,o=>({...o,status:"notFound",error:s,isFetching:!1})),s.routerCode==="BEFORE_LOAD"&&e.parentRoute&&(s.routeId=e.parentRoute.id,ns(t,s))},q=(t,s,e)=>{if(!(!$(e)&&!D(e))){if($(e)&&e.redirectHandled&&!e.options.reloadDocument)throw e;if(s){s._nonReactive.beforeLoadPromise?.resolve(),s._nonReactive.loaderPromise?.resolve(),s._nonReactive.beforeLoadPromise=void 0,s._nonReactive.loaderPromise=void 0;const n=$(e)?"redirected":"notFound";s._nonReactive.error=e,t.updateMatch(s.id,o=>({...o,status:n,isFetching:!1,error:e})),D(e)&&!e.routeId&&(e.routeId=s.routeId),s._nonReactive.loadPromise?.resolve()}throw $(e)?(t.rendered=!0,e.options._fromLocation=t.location,e.redirectHandled=!0,e=t.router.resolveRedirect(e),e):(ns(t,e),e)}},os=(t,s)=>{const e=t.router.getMatch(s);return!!(!t.router.isServer&&e._nonReactive.dehydrated||t.router.isServer&&e.ssr===!1)},ht=(t,s,e,n)=>{const{id:o,routeId:i}=t.matches[s],r=t.router.looseRoutesById[i];if(e instanceof Promise)throw e;e.routerCode=n,t.firstBadMatchIndex??=s,q(t,t.router.getMatch(o),e);try{r.options.onError?.(e)}catch(a){e=a,q(t,t.router.getMatch(o),e)}t.updateMatch(o,a=>(a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,a._nonReactive.loadPromise?.resolve(),{...a,error:e,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},mn=(t,s,e,n)=>{const o=t.router.getMatch(s),i=t.matches[e-1]?.id,r=i?t.router.getMatch(i):void 0;if(t.router.isShell()){o.ssr=n.id===B;return}if(r?.ssr===!1){o.ssr=!1;return}const a=f=>f===!0&&r?.ssr==="data-only"?"data-only":f,c=t.router.options.defaultSsr??!0;if(n.options.ssr===void 0){o.ssr=a(c);return}if(typeof n.options.ssr!="function"){o.ssr=a(n.options.ssr);return}const{search:h,params:d}=o,l={search:Lt(h,o.searchError),params:Lt(d,o.paramsError),location:t.location,matches:t.matches.map(f=>({index:f.index,pathname:f.pathname,fullPath:f.fullPath,staticData:f.staticData,id:f.id,routeId:f.routeId,search:Lt(f.search,f.searchError),params:Lt(f.params,f.paramsError),ssr:f.ssr}))},u=n.options.ssr(l);if(J(u))return u.then(f=>{o.ssr=a(f??c)});o.ssr=a(u??c)},is=(t,s,e,n)=>{if(n._nonReactive.pendingTimeout!==void 0)return;const o=e.options.pendingMs??t.router.options.defaultPendingMs;if(!!(t.onReady&&!t.router.isServer&&!$t(t,s)&&(e.options.loader||e.options.beforeLoad||cs(e))&&typeof o=="number"&&o!==1/0&&(e.options.pendingComponent??t.router.options?.defaultPendingComponent))){const r=setTimeout(()=>{kt(t)},o);n._nonReactive.pendingTimeout=r}},gn=(t,s,e)=>{const n=t.router.getMatch(s);if(!n._nonReactive.beforeLoadPromise&&!n._nonReactive.loaderPromise)return;is(t,s,e,n);const o=()=>{const i=t.router.getMatch(s);i.preload&&(i.status==="redirected"||i.status==="notFound")&&q(t,i,i.error)};return n._nonReactive.beforeLoadPromise?n._nonReactive.beforeLoadPromise.then(o):o()},yn=(t,s,e,n)=>{const o=t.router.getMatch(s),i=o._nonReactive.loadPromise;o._nonReactive.loadPromise=ct(()=>{i?.resolve()});const{paramsError:r,searchError:a}=o;r&&ht(t,e,r,"PARSE_PARAMS"),a&&ht(t,e,a,"VALIDATE_SEARCH"),is(t,s,n,o);const c=new AbortController,h=t.matches[e-1]?.id,u={...(h?t.router.getMatch(h):void 0)?.context??t.router.options.context??void 0,...o.__routeContext};let f=!1;const p=()=>{f||(f=!0,t.updateMatch(s,R=>({...R,isFetching:"beforeLoad",fetchCount:R.fetchCount+1,abortController:c,context:u})))},g=()=>{o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,t.updateMatch(s,R=>({...R,isFetching:!1}))};if(!n.options.beforeLoad){gt(()=>{p(),g()});return}o._nonReactive.beforeLoadPromise=ct();const{search:m,params:y,cause:v}=o,S=$t(t,s),x={search:m,abortController:c,params:y,preload:S,context:u,location:t.location,navigate:R=>t.router.navigate({...R,_fromLocation:t.location}),buildLocation:t.router.buildLocation,cause:S?"preload":v,matches:t.matches,...t.router.options.additionalContext},L=R=>{if(R===void 0){gt(()=>{p(),g()});return}($(R)||D(R))&&(p(),ht(t,e,R,"BEFORE_LOAD")),gt(()=>{p(),t.updateMatch(s,w=>({...w,__beforeLoadContext:R,context:{...w.context,...R}})),g()})};let _;try{if(_=n.options.beforeLoad(x),J(_))return p(),_.catch(R=>{ht(t,e,R,"BEFORE_LOAD")}).then(L)}catch(R){p(),ht(t,e,R,"BEFORE_LOAD")}L(_)},vn=(t,s)=>{const{id:e,routeId:n}=t.matches[s],o=t.router.looseRoutesById[n],i=()=>{if(t.router.isServer){const c=mn(t,e,s,o);if(J(c))return c.then(a)}return a()},r=()=>yn(t,e,s,o),a=()=>{if(os(t,e))return;const c=gn(t,e,o);return J(c)?c.then(r):r()};return i()},yt=(t,s,e)=>{const n=t.router.getMatch(s);if(!n||!e.options.head&&!e.options.scripts&&!e.options.headers)return;const o={matches:t.matches,match:n,params:n.params,loaderData:n.loaderData};return Promise.all([e.options.head?.(o),e.options.scripts?.(o),e.options.headers?.(o)]).then(([i,r,a])=>{const c=i?.meta,h=i?.links,d=i?.scripts,l=i?.styles;return{meta:c,links:h,headScripts:d,headers:a,scripts:r,styles:l}})},rs=(t,s,e,n)=>{const o=t.matchPromises[e-1],{params:i,loaderDeps:r,abortController:a,cause:c}=t.router.getMatch(s);let h=t.router.options.context??{};for(let l=0;l<=e;l++){const u=t.matches[l];if(!u)continue;const f=t.router.getMatch(u.id);f&&(h={...h,...f.__routeContext??{},...f.__beforeLoadContext??{}})}const d=$t(t,s);return{params:i,deps:r,preload:!!d,parentMatchPromise:o,abortController:a,context:h,location:t.location,navigate:l=>t.router.navigate({...l,_fromLocation:t.location}),cause:d?"preload":c,route:n,...t.router.options.additionalContext}},Be=async(t,s,e,n)=>{try{const o=t.router.getMatch(s);try{(!t.router.isServer||o.ssr===!0)&&as(n);const i=n.options.loader?.(rs(t,s,e,n)),r=n.options.loader&&J(i);if(!!(r||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||o._nonReactive.minPendingPromise)&&t.updateMatch(s,l=>({...l,isFetching:"loader"})),n.options.loader){const l=r?await i:i;q(t,t.router.getMatch(s),l),l!==void 0&&t.updateMatch(s,u=>({...u,loaderData:l}))}n._lazyPromise&&await n._lazyPromise;const c=yt(t,s,n),h=c?await c:void 0,d=o._nonReactive.minPendingPromise;d&&await d,n._componentsPromise&&await n._componentsPromise,t.updateMatch(s,l=>({...l,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),...h}))}catch(i){let r=i;const a=o._nonReactive.minPendingPromise;a&&await a,D(i)&&await n.options.notFoundComponent?.preload?.(),q(t,t.router.getMatch(s),i);try{n.options.onError?.(i)}catch(d){r=d,q(t,t.router.getMatch(s),d)}const c=yt(t,s,n),h=c?await c:void 0;t.updateMatch(s,d=>({...d,error:r,status:"error",isFetching:!1,...h}))}}catch(o){const i=t.router.getMatch(s);if(i){const r=yt(t,s,n);if(r){const a=await r;t.updateMatch(s,c=>({...c,...a}))}i._nonReactive.loaderPromise=void 0}q(t,i,o)}},Sn=async(t,s)=>{const{id:e,routeId:n}=t.matches[s];let o=!1,i=!1;const r=t.router.looseRoutesById[n];if(os(t,e)){if(t.router.isServer){const h=yt(t,e,r);if(h){const d=await h;t.updateMatch(e,l=>({...l,...d}))}return t.router.getMatch(e)}}else{const h=t.router.getMatch(e);if(h._nonReactive.loaderPromise){if(h.status==="success"&&!t.sync&&!h.preload)return h;await h._nonReactive.loaderPromise;const d=t.router.getMatch(e),l=d._nonReactive.error||d.error;l&&q(t,d,l)}else{const d=Date.now()-h.updatedAt,l=$t(t,e),u=l?r.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:r.options.staleTime??t.router.options.defaultStaleTime??0,f=r.options.shouldReload,p=typeof f=="function"?f(rs(t,e,s,r)):f,g=!!l&&!t.router.state.matches.some(S=>S.id===e),m=t.router.getMatch(e);m._nonReactive.loaderPromise=ct(),g!==m.preload&&t.updateMatch(e,S=>({...S,preload:g}));const{status:y,invalid:v}=m;if(o=y==="success"&&(v||(p??d>u)),!(l&&r.options.preload===!1))if(o&&!t.sync)i=!0,(async()=>{try{await Be(t,e,s,r);const S=t.router.getMatch(e);S._nonReactive.loaderPromise?.resolve(),S._nonReactive.loadPromise?.resolve(),S._nonReactive.loaderPromise=void 0}catch(S){$(S)&&await t.router.navigate(S.options)}})();else if(y!=="success"||o&&t.sync)await Be(t,e,s,r);else{const S=yt(t,e,r);if(S){const x=await S;t.updateMatch(e,L=>({...L,...x}))}}}}const a=t.router.getMatch(e);i||(a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loadPromise?.resolve()),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0,i||(a._nonReactive.loaderPromise=void 0),a._nonReactive.dehydrated=void 0;const c=i?a.isFetching:!1;return c!==a.isFetching||a.invalid!==!1?(t.updateMatch(e,h=>({...h,isFetching:c,invalid:!1})),t.router.getMatch(e)):a};async function ze(t){const s=Object.assign(t,{matchPromises:[]});!s.router.isServer&&s.router.state.matches.some(e=>e._forcePending)&&kt(s);try{for(let o=0;o{const{id:e,...n}=s.options;Object.assign(t.options,n),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0),!t._componentsLoaded&&t._componentsPromise===void 0){const s=()=>{const e=[];for(const n of ls){const o=t.options[n]?.preload;o&&e.push(o())}if(e.length)return Promise.all(e).then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0});t._componentsLoaded=!0,t._componentsPromise=void 0};t._componentsPromise=t._lazyPromise?t._lazyPromise.then(s):s()}return t._componentsPromise}function Lt(t,s){return s?{status:"error",error:s}:{status:"success",value:t}}function cs(t){for(const s of ls)if(t.options[s]?.preload)return!0;return!1}const ls=["component","errorComponent","pendingComponent","notFoundComponent"];function _n(t){return{input:({url:s})=>{for(const e of t)s=us(e,s);return s},output:({url:s})=>{for(let e=t.length-1;e>=0;e--)s=hs(t[e],s);return s}}}function wn(t){const s=Et(t.basepath),e=`/${s}`,n=`${e}/`,o=t.caseSensitive?e:e.toLowerCase(),i=t.caseSensitive?n:n.toLowerCase();return{input:({url:r})=>{const a=t.caseSensitive?r.pathname:r.pathname.toLowerCase();return a===o?r.pathname="/":a.startsWith(i)&&(r.pathname=r.pathname.slice(e.length)),r},output:({url:r})=>(r.pathname=It(["/",s,r.pathname]),r)}}function us(t,s){const e=t?.input?.({url:s});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return s}function hs(t,s){const e=t?.output?.({url:s});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return s}function tt(t){const s=t.resolvedLocation,e=t.location,n=s?.pathname!==e.pathname,o=s?.href!==e.href,i=s?.hash!==e.hash;return{fromLocation:s,toLocation:e,pathChanged:n,hrefChanged:o,hashChanged:i}}class Rn{constructor(s){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const n=this.options,o=this.basepath??n?.basepath??"/",i=this.basepath===void 0,r=n?.rewrite;this.options={...n,...e},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(u=>[encodeURIComponent(u),u])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=As())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new Os(Pn(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(u=>!["redirected"].includes(u.status))}}}),rn(this));let a=!1;const c=this.options.basepath??"/",h=this.options.rewrite;if(i||o!==c||r!==h){this.basepath=c;const u=[];Et(c)!==""&&u.push(wn({basepath:c})),h&&u.push(h),this.rewrite=u.length===0?void 0:u.length===1?u[0]:_n(u),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:e,routesByPath:n,processedTree:o}=qs(this.routeTree,this.options.caseSensitive,(r,a)=>{r.init({originalIndex:a})});this.options.routeMasks&&$s(this.options.routeMasks,o),this.routesById=e,this.routesByPath=n,this.processedTree=o;const i=this.options.notFoundRoute;i&&(i.init({originalIndex:99999999999}),this.routesById[i.id]=i)},this.subscribe=(e,n)=>{const o={eventType:e,fn:n};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=e=>{this.subscribers.forEach(n=>{n.eventType===e.type&&n.fn(e)})},this.parseLocation=(e,n)=>{const o=({href:c,state:h})=>{const d=new URL(c,this.origin),l=us(this.rewrite,d),u=this.options.parseSearch(l.search),f=this.options.stringifySearch(u);l.search=f;const p=l.href.replace(l.origin,""),{pathname:g,hash:m}=l;return{href:p,publicHref:c,url:l.href,pathname:Ae(g),searchStr:f,search:z(n?.search,u),hash:m.split("#").reverse()[0]??"",state:z(n?.state,h)}},i=o(e),{__tempLocation:r,__tempKey:a}=i.state;if(r&&(!a||a===this.tempLocationKey)){const c=o(r);return c.state.key=i.state.key,c.state.__TSR_key=i.state.__TSR_key,delete c.state.__tempLocation,{...c,maskedLocation:i}}return i},this.resolvePathCache=Bt(1e3),this.resolvePathWithBase=(e,n)=>Qs({base:e,to:pe(n),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,n,o)=>typeof e=="string"?this.matchRoutesInternal({pathname:e,search:n},o):this.matchRoutesInternal(e,n),this.getMatchedRoutes=e=>bn({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{const n=this.getMatch(e);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const e=this.state.matches.filter(i=>i.status==="pending"),n=this.state.matches.filter(i=>i.isFetching==="loader");new Set([...this.state.pendingMatches??[],...e,...n]).forEach(i=>{this.cancelMatch(i.id)})},this.buildLocation=e=>{const n=(i={})=>{const r=i._fromLocation||this.pendingBuiltLocation||this.latestLocation,a=this.matchRoutes(r,{_buildLocation:!0}),c=Ft(a);i.from;const h=i.unsafeRelative==="path"?r.pathname:i.from??c.fullPath,d=this.resolvePathWithBase(h,"."),l=c.search,u={...c.params},f=i.to?this.resolvePathWithBase(d,`${i.to}`):this.resolvePathWithBase(d,"."),p=i.params===!1||i.params===null?{}:(i.params??!0)===!0?u:Object.assign(u,H(i.params,u)),g=Xt({path:f,params:p}).interpolatedPath,m=this.matchRoutes(g,void 0,{_buildLocation:!0}).map(M=>this.looseRoutesById[M.routeId]);if(Object.keys(p).length>0)for(const M of m){const I=M.options.params?.stringify??M.options.stringifyParams;I&&Object.assign(p,I(p))}const y=e.leaveParams?f:Ae(Xt({path:f,params:p,decodeCharMap:this.pathParamsDecodeCharMap}).interpolatedPath);let v=l;if(e._includeValidateSearch&&this.options.search?.strict){const M={};m.forEach(I=>{if(I.options.validateSearch)try{Object.assign(M,ce(I.options.validateSearch,{...M,...v}))}catch{}}),v=M}v=Cn({search:v,dest:i,destRoutes:m,_includeValidateSearch:e._includeValidateSearch}),v=z(l,v);const S=this.options.stringifySearch(v),x=i.hash===!0?r.hash:i.hash?H(i.hash,r.hash):void 0,L=x?`#${x}`:"";let _=i.state===!0?r.state:i.state?H(i.state,r.state):{};_=z(r.state,_);const R=`${y}${S}${L}`,w=new URL(R,this.origin),C=hs(this.rewrite,w);return{publicHref:C.pathname+C.search+C.hash,href:R,url:C.href,pathname:y,search:v,searchStr:S,state:_,hash:x??"",unmaskOnReload:i.unmaskOnReload}},o=(i={},r)=>{const a=n(i);let c=r?n(r):void 0;if(!c){const h={};if(this.options.routeMasks){const d=Us(a.pathname,this.processedTree);if(d){Object.assign(h,d.params);const{from:l,params:u,...f}=d.route,p=u===!1||u===null?{}:(u??!0)===!0?h:Object.assign(h,H(u,h));r={from:e.from,...f,params:p},c=n(r)}}}return c&&(a.maskedLocation=c),a};return e.mask?o(e,{from:e.from,...e.mask}):o(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:n,...o})=>{const i=()=>{const c=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];c.forEach(d=>{o.state[d]=this.latestLocation.state[d]});const h=Z(o.state,this.latestLocation.state);return c.forEach(d=>{delete o.state[d]}),h},r=Q(this.latestLocation.href)===Q(o.href),a=this.commitLocationPromise;if(this.commitLocationPromise=ct(()=>{a?.resolve()}),r&&i())this.load();else{let{maskedLocation:c,hashScrollIntoView:h,...d}=o;c&&(d={...c,state:{...c.state,__tempKey:void 0,__tempLocation:{...d,search:d.searchStr,state:{...d.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(d.unmaskOnReload??this.options.unmaskOnReload??!1)&&(d.state.__tempKey=this.tempLocationKey)),d.state.__hashScrollIntoViewOptions=h??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[o.replace?"replace":"push"](d.publicHref,d.state,{ignoreBlocker:n})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:n,hashScrollIntoView:o,viewTransition:i,ignoreBlocker:r,href:a,...c}={})=>{if(a){const l=this.history.location.state.__TSR_index,u=Ot(a,{__TSR_index:e?l:l+1});c.to=u.pathname,c.search=this.options.parseSearch(u.search),c.hash=u.hash.slice(1)}const h=this.buildLocation({...c,_includeValidateSearch:!0});this.pendingBuiltLocation=h;const d=this.commitLocation({...h,viewTransition:i,replace:e,resetScroll:n,hashScrollIntoView:o,ignoreBlocker:r});return Promise.resolve().then(()=>{this.pendingBuiltLocation===h&&(this.pendingBuiltLocation=void 0)}),d},this.navigate=async({to:e,reloadDocument:n,href:o,...i})=>{if(!n&&o)try{new URL(`${o}`),n=!0}catch{}if(n){if(o||(o=this.buildLocation({to:e,...i}).url),!i.ignoreBlocker){const a=this.history.getBlockers?.()??[];for(const c of a)if(c?.blockerFn&&await c.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return i.replace?window.location.replace(o):window.location.href=o,Promise.resolve()}return this.buildAndCommitLocation({...i,href:o,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const n=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),o=i=>{try{return encodeURI(decodeURI(i))}catch{return i}};if(Et(o(this.latestLocation.href))!==Et(o(n.href))){let i=n.url;throw this.origin&&i.startsWith(this.origin)&&(i=i.replace(this.origin,"")||"/"),pn({href:i})}}const e=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:n.cachedMatches.filter(o=>!e.some(i=>i.id===o.id))}))},this.load=async e=>{let n,o,i;for(i=new Promise(a=>{this.startTransition(async()=>{try{this.beforeLoad();const c=this.latestLocation,h=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...tt({resolvedLocation:h,location:c})}),this.emit({type:"onBeforeLoad",...tt({resolvedLocation:h,location:c})}),await ze({router:this,sync:e?.sync,matches:this.state.pendingMatches,location:c,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let d=[],l=[],u=[];gt(()=>{this.__store.setState(f=>{const p=f.matches,g=f.pendingMatches||f.matches;return d=p.filter(m=>!g.some(y=>y.id===m.id)),l=g.filter(m=>!p.some(y=>y.id===m.id)),u=g.filter(m=>p.some(y=>y.id===m.id)),{...f,isLoading:!1,loadedAt:Date.now(),matches:g,pendingMatches:void 0,cachedMatches:[...f.cachedMatches,...d.filter(m=>m.status!=="error"&&m.status!=="notFound")]}}),this.clearExpiredCache()}),[[d,"onLeave"],[l,"onEnter"],[u,"onStay"]].forEach(([f,p])=>{f.forEach(g=>{this.looseRoutesById[g.routeId].options[p]?.(g)})})})})}})}catch(c){$(c)?(n=c,this.isServer||this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):D(c)&&(o=c),this.__store.setState(h=>({...h,statusCode:n?n.status:o?404:h.matches.some(d=>d.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let r;this.hasNotFoundMatch()?r=404:this.__store.state.matches.some(a=>a.status==="error")&&(r=500),r!==void 0&&this.__store.setState(a=>({...a,statusCode:r}))},this.startViewTransition=e=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let o;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const i=this.latestLocation,r=this.state.resolvedLocation,a=typeof n.types=="function"?n.types(tt({resolvedLocation:r,location:i})):n.types;if(a===!1){e();return}o={update:e,types:a}}else o=e;document.startViewTransition(o)}else e()},this.updateMatch=(e,n)=>{this.startTransition(()=>{const o=this.state.pendingMatches?.some(i=>i.id===e)?"pendingMatches":this.state.matches.some(i=>i.id===e)?"matches":this.state.cachedMatches.some(i=>i.id===e)?"cachedMatches":"";o&&this.__store.setState(i=>({...i,[o]:i[o]?.map(r=>r.id===e?n(r):r)}))})},this.getMatch=e=>{const n=o=>o.id===e;return this.state.cachedMatches.find(n)??this.state.pendingMatches?.find(n)??this.state.matches.find(n)},this.invalidate=e=>{const n=o=>e?.filter?.(o)??!0?{...o,invalid:!0,...e?.forcePending||o.status==="error"||o.status==="notFound"?{status:"pending",error:void 0}:void 0}:o;return this.__store.setState(o=>({...o,matches:o.matches.map(n),cachedMatches:o.cachedMatches.map(n),pendingMatches:o.pendingMatches?.map(n)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{if(!e.options.href){const n=this.buildLocation(e.options);let o=n.url;this.origin&&o.startsWith(this.origin)&&(o=o.replace(this.origin,"")||"/"),e.options.href=n.href,e.headers.set("Location",o)}return e.headers.get("Location")||e.headers.set("Location",e.options.href),e},this.clearCache=e=>{const n=e?.filter;n!==void 0?this.__store.setState(o=>({...o,cachedMatches:o.cachedMatches.filter(i=>!n(i))})):this.__store.setState(o=>({...o,cachedMatches:[]}))},this.clearExpiredCache=()=>{const e=n=>{const o=this.looseRoutesById[n.routeId];if(!o.options.loader)return!0;const i=(n.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=i};this.clearCache({filter:e})},this.loadRouteChunk=as,this.preloadRoute=async e=>{const n=this.buildLocation(e);let o=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:e});const i=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(a=>a.id)),r=new Set([...i,...this.state.cachedMatches.map(a=>a.id)]);gt(()=>{o.forEach(a=>{r.has(a.id)||this.__store.setState(c=>({...c,cachedMatches:[...c.cachedMatches,a]}))})});try{return o=await ze({router:this,matches:o,location:n,preload:!0,updateMatch:(a,c)=>{i.has(a)?o=o.map(h=>h.id===a?c(h):h):this.updateMatch(a,c)}}),o}catch(a){if($(a))return a.options.reloadDocument?void 0:await this.preloadRoute({...a.options,_fromLocation:n});D(a)||console.error(a);return}},this.matchRoute=(e,n)=>{const o={...e,to:e.to?this.resolvePathWithBase(e.from||"",e.to):void 0,params:e.params||{},leaveParams:!0},i=this.buildLocation(o);if(n?.pending&&this.state.status!=="pending")return!1;const a=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,c=Vs(i.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,a.pathname,this.processedTree);return!c||e.params&&!Z(c.params,e.params,{partial:!0})?!1:n?.includeSearch??!0?Z(a.search,i.search,{partial:!0})?c.params:!1:c.params},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status==="notFound"||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...s,caseSensitive:s.caseSensitive??!1,notFoundMode:s.notFoundMode??"fuzzy",stringifySearch:s.stringifySearch??hn,parseSearch:s.parseSearch??un}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(s,e){const n=this.getMatchedRoutes(s.pathname),{foundRoute:o,routeParams:i}=n;let{matchedRoutes:r}=n,a=!1;(o?o.path!=="/"&&i["**"]:Q(s.pathname))&&(this.options.notFoundRoute?r=[...r,this.options.notFoundRoute]:a=!0);const c=(()=>{if(a){if(this.options.notFoundMode!=="root")for(let l=r.length-1;l>=0;l--){const u=r[l];if(u.children)return u.id}return B}})(),h=[],d=l=>l?.id?l.context??this.options.context??void 0:this.options.context??void 0;return r.forEach((l,u)=>{const f=h[u-1],[p,g,m]=(()=>{const A=f?.search??s.search,j=f?._strictSearch??void 0;try{const N=ce(l.options.validateSearch,{...A})??void 0;return[{...A,...N},{...j,...N},void 0]}catch(N){let nt=N;if(N instanceof Nt||(nt=new Nt(N.message,{cause:N})),e?.throwOnError)throw nt;return[A,{},nt]}})(),y=l.options.loaderDeps?.({search:p})??"",v=y?JSON.stringify(y):"",{interpolatedPath:S,usedParams:x}=Xt({path:l.fullPath,params:i,decodeCharMap:this.pathParamsDecodeCharMap}),L=l.id+S+v,_=this.getMatch(L),R=this.state.matches.find(A=>A.routeId===l.id),w=_?._strictParams??x;let C;if(!_){const A=l.options.params?.parse??l.options.parseParams;if(A)try{Object.assign(w,A(w))}catch(j){if(D(j)||$(j)?C=j:C=new xn(j.message,{cause:j}),e?.throwOnError)throw C}}Object.assign(i,w);const M=R?"stay":"enter";let I;if(_)I={..._,cause:M,params:R?z(R.params,i):i,_strictParams:w,search:z(R?R.search:_.search,p),_strictSearch:g};else{const A=l.options.loader||l.options.beforeLoad||l.lazyFn||cs(l)?"pending":"success";I={id:L,ssr:this.isServer?void 0:l.options.ssr,index:u,routeId:l.id,params:R?z(R.params,i):i,_strictParams:w,pathname:S,updatedAt:Date.now(),search:R?z(R.search,p):p,_strictSearch:g,searchError:void 0,status:A,isFetching:!1,error:void 0,paramsError:C,__routeContext:void 0,_nonReactive:{loadPromise:ct()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:M,loaderDeps:R?z(R.loaderDeps,y):y,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:l.options.staticData||{},fullPath:l.fullPath}}e?.preload||(I.globalNotFound=c===l.id),I.searchError=m;const F=d(f);I.context={...F,...I.__routeContext,...I.__beforeLoadContext},h.push(I)}),h.forEach((l,u)=>{const f=this.looseRoutesById[l.routeId];if(!this.getMatch(l.id)&&e?._buildLocation!==!0){const g=h[u-1],m=d(g);if(f.options.context){const y={deps:l.loaderDeps,params:l.params,context:m??{},location:s,navigate:v=>this.navigate({...v,_fromLocation:s}),buildLocation:this.buildLocation,cause:l.cause,abortController:l.abortController,preload:!!l.preload,matches:h};l.__routeContext=f.options.context(y)??void 0}l.context={...m,...l.__routeContext,...l.__beforeLoadContext}}}),h}}class Nt extends Error{}class xn extends Error{}function Pn(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function ce(t,s){if(t==null)return{};if("~standard"in t){const e=t["~standard"].validate(s);if(e instanceof Promise)throw new Nt("Async validation not supported");if(e.issues)throw new Nt(JSON.stringify(e.issues,void 0,2),{cause:e});return e.value}return"parse"in t?t.parse(s):typeof t=="function"?t(s):{}}function bn({pathname:t,routesById:s,processedTree:e}){const n={},o=Q(t);let i;const r=Ks(o,e,!0);return r&&(i=r.route,Object.assign(n,r.params)),{matchedRoutes:r?.branch||[s[B]],routeParams:n,foundRoute:i}}function Cn({search:t,dest:s,destRoutes:e,_includeValidateSearch:n}){const o=e.reduce((a,c)=>{const h=[];if("search"in c.options)c.options.search?.middlewares&&h.push(...c.options.search.middlewares);else if(c.options.preSearchFilters||c.options.postSearchFilters){const d=({search:l,next:u})=>{let f=l;"preSearchFilters"in c.options&&c.options.preSearchFilters&&(f=c.options.preSearchFilters.reduce((g,m)=>m(g),l));const p=u(f);return"postSearchFilters"in c.options&&c.options.postSearchFilters?c.options.postSearchFilters.reduce((g,m)=>m(g),p):p};h.push(d)}if(n&&c.options.validateSearch){const d=({search:l,next:u})=>{const f=u(l);try{return{...f,...ce(c.options.validateSearch,f)??void 0}}catch{return f}};h.push(d)}return a.concat(h)},[])??[],i=({search:a})=>s.search?s.search===!0?a:H(s.search,a):{};o.push(i);const r=(a,c)=>{if(a>=o.length)return c;const h=o[a];return h({search:c,next:l=>r(a+1,l)})};return r(0,t)}const Ln="Error preloading route! ☝️";class ds{constructor(s){if(this.init=e=>{this.originalIndex=e.originalIndex;const n=this.options,o=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),o?this._path=B:this.parentRoute||K(!1);let i=o?B:n?.path;i&&i!=="/"&&(i=es(i));const r=n?.id||i;let a=o?B:It([this.parentRoute.id===B?"":this.parentRoute.id,r]);i===B&&(i="/"),a!==B&&(a=It(["/",a]));const c=a===B?"/":It([this.parentRoute.fullPath,i]);this._path=i,this._id=a,this._fullPath=c,this._to=c},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e=="object"&&e!==null&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.options=s||{},this.isRoot=!s?.getParentRoute,s?.id&&s?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class Mn extends ds{constructor(s){super(s)}}function me(t){const s=t.errorComponent??Ut;return P.jsx(In,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:e,reset:n})=>e?b.createElement(s,{error:e,reset:n}):t.children})}class In extends b.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(s){return{resetKey:s.getResetKey()}}static getDerivedStateFromError(s){return{error:s}}reset(){this.setState({error:null})}componentDidUpdate(s,e){e.error&&e.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(s,e){this.props.onCatch&&this.props.onCatch(s,e)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Ut({error:t}){const[s,e]=b.useState(!1);return P.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[P.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[P.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),P.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>e(n=>!n),children:s?"Hide Error":"Show Error"})]}),P.jsx("div",{style:{height:".25rem"}}),s?P.jsx("div",{children:P.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?P.jsx("code",{children:t.message}):null})}):null]})}function En({children:t,fallback:s=null}){return kn()?P.jsx(at.Fragment,{children:t}):P.jsx(at.Fragment,{children:s})}function kn(){return at.useSyncExternalStore(Tn,()=>!0,()=>!1)}function Tn(){return()=>{}}var Qt={exports:{}},te={},ee={exports:{}},se={};var De;function On(){if(De)return se;De=1;var t=le();function s(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var e=typeof Object.is=="function"?Object.is:s,n=t.useState,o=t.useEffect,i=t.useLayoutEffect,r=t.useDebugValue;function a(l,u){var f=u(),p=n({inst:{value:f,getSnapshot:u}}),g=p[0].inst,m=p[1];return i(function(){g.value=f,g.getSnapshot=u,c(g)&&m({inst:g})},[l,f,u]),o(function(){return c(g)&&m({inst:g}),l(function(){c(g)&&m({inst:g})})},[l]),r(f),f}function c(l){var u=l.getSnapshot;l=l.value;try{var f=u();return!e(l,f)}catch{return!0}}function h(l,u){return u()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:a;return se.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,se}var je;function Fn(){return je||(je=1,ee.exports=On()),ee.exports}var Ne;function An(){if(Ne)return te;Ne=1;var t=le(),s=Fn();function e(h,d){return h===d&&(h!==0||1/h===1/d)||h!==h&&d!==d}var n=typeof Object.is=="function"?Object.is:e,o=s.useSyncExternalStore,i=t.useRef,r=t.useEffect,a=t.useMemo,c=t.useDebugValue;return te.useSyncExternalStoreWithSelector=function(h,d,l,u,f){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function y(_){if(!v){if(v=!0,S=_,_=u(_),f!==void 0&&g.hasValue){var R=g.value;if(f(R,_))return x=R}return x=_}if(R=x,n(S,_))return R;var w=u(_);return f!==void 0&&f(R,w)?(S=_,R):(S=_,x=w)}var v=!1,S,x,L=l===void 0?null:l;return[function(){return y(d())},L===null?void 0:function(){return y(L())}]},[d,l,u,f]);var m=o(h,p[0],p[1]);return r(function(){g.hasValue=!0,g.value=m},[m]),c(m),m},te}var We;function Bn(){return We||(We=1,Qt.exports=An()),Qt.exports}var fs=Bn();const Lo=ue(fs);function zn(t,s=n=>n,e={}){const n=e.equal??Dn;return fs.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,s,n)}function Dn(t,s){if(Object.is(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(const[n,o]of t)if(!s.has(n)||!Object.is(o,s.get(n)))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(const n of t)if(!s.has(n))return!1;return!0}if(t instanceof Date&&s instanceof Date)return t.getTime()===s.getTime();const e=$e(t);if(e.length!==$e(s).length)return!1;for(let n=0;n"u"?ne:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=ne,ne)}function O(t){const s=b.useContext(ps());return t?.warn,s}function T(t){const s=O({warn:t?.router===void 0}),e=t?.router||s,n=b.useRef(void 0);return zn(e.__store,o=>{if(t?.select){if(t.structuralSharing??e.options.defaultStructuralSharing){const i=z(n.current,t.select(o));return n.current=i,i}return t.select(o)}return o})}const Vt=b.createContext(void 0),jn=b.createContext(void 0);function U(t){const s=b.useContext(t.from?jn:Vt);return T({select:n=>{const o=n.matches.find(i=>t.from?t.from===i.routeId:i.id===s);if(K(!((t.shouldThrow??!0)&&!o),`Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`),o!==void 0)return t.select?t.select(o):o},structuralSharing:t.structuralSharing})}function ge(t){return U({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:s=>t.select?t.select(s.loaderData):s.loaderData})}function ye(t){const{select:s,...e}=t;return U({...e,select:n=>s?s(n.loaderDeps):n.loaderDeps})}function ve(t){return U({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:s=>{const e=t.strict===!1?s.params:s._strictParams;return t.select?t.select(e):e}})}function Se(t){return U({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:s=>t.select?t.select(s.search):s.search})}const Mt=typeof window<"u"?b.useLayoutEffect:b.useEffect;function oe(t){const s=b.useRef({value:t,prev:null}),e=s.current.value;return t!==e&&(s.current={value:t,prev:e}),s.current.prev}function Nn(t,s,e={},n={}){b.useEffect(()=>{if(!t.current||n.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([i])=>{s(i)},e);return o.observe(t.current),()=>{o.disconnect()}},[s,e,n.disabled,t])}function Wn(t){const s=b.useRef(null);return b.useImperativeHandle(t,()=>s.current,[]),s}function _e(t){const s=O();return b.useCallback(e=>s.navigate({...e,from:e.from??t?.from}),[t?.from,s])}var we=Ls();const Mo=ue(we);function $n(t,s){const e=O(),[n,o]=b.useState(!1),i=b.useRef(!1),r=Wn(s),{activeProps:a,inactiveProps:c,activeOptions:h,to:d,preload:l,preloadDelay:u,hashScrollIntoView:f,replace:p,startTransition:g,resetScroll:m,viewTransition:y,children:v,target:S,disabled:x,style:L,className:_,onClick:R,onFocus:w,onMouseEnter:C,onMouseLeave:M,onTouchStart:I,ignoreBlocker:F,params:A,search:j,hash:N,state:nt,mask:Ss,reloadDocument:wo,unsafeRelative:Ro,from:xo,_fromLocation:Po,...Re}=t,_s=T({select:E=>E.location.search,structuralSharing:!0}),xe=t.from,ut=b.useMemo(()=>({...t,from:xe}),[e,_s,xe,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),V=b.useMemo(()=>e.buildLocation({...ut}),[e,ut]),_t=b.useMemo(()=>{if(x)return;let E=V.maskedLocation?V.maskedLocation.url:V.url,k=!1;return e.origin&&(E.startsWith(e.origin)?E=e.history.createHref(E.replace(e.origin,""))||"/":k=!0),{href:E,external:k}},[x,V.maskedLocation,V.url,e.origin,e.history]),wt=b.useMemo(()=>{if(_t?.external)return _t.href;try{return new URL(d),d}catch{}},[d,_t]),ot=t.reloadDocument||wt?!1:l??e.options.defaultPreload,Kt=u??e.options.defaultPreloadDelay??0,Ht=T({select:E=>{if(wt)return!1;if(h?.exact){if(!Zs(E.location.pathname,V.pathname,e.basepath))return!1}else{const k=zt(E.location.pathname,e.basepath),W=zt(V.pathname,e.basepath);if(!(k.startsWith(W)&&(k.length===W.length||k[W.length]==="/")))return!1}return(h?.includeSearch??!0)&&!Z(E.location.search,V.search,{partial:!h?.exact,ignoreUndefined:!h?.explicitUndefined})?!1:h?.includeHash?E.location.hash===V.hash:!0}}),Y=b.useCallback(()=>{e.preloadRoute({...ut}).catch(E=>{console.warn(E),console.warn(Ln)})},[e,ut]),ws=b.useCallback(E=>{E?.isIntersecting&&Y()},[Y]);Nn(r,ws,qn,{disabled:!!x||ot!=="viewport"}),b.useEffect(()=>{i.current||!x&&ot==="render"&&(Y(),i.current=!0)},[x,Y,ot]);const Rs=E=>{const k=E.currentTarget.getAttribute("target"),W=S!==void 0?S:k;if(!x&&!Gn(E)&&!E.defaultPrevented&&(!W||W==="_self")&&E.button===0){E.preventDefault(),we.flushSync(()=>{o(!0)});const Le=e.subscribe("onResolved",()=>{Le(),o(!1)});e.navigate({...ut,replace:p,resetScroll:m,hashScrollIntoView:f,startTransition:g,viewTransition:y,ignoreBlocker:F})}};if(wt)return{...Re,ref:r,href:wt,...v&&{children:v},...S&&{target:S},...x&&{disabled:x},...L&&{style:L},..._&&{className:_},...R&&{onClick:R},...w&&{onFocus:w},...C&&{onMouseEnter:C},...M&&{onMouseLeave:M},...I&&{onTouchStart:I}};const Pe=E=>{x||ot&&Y()},xs=Pe,Ps=E=>{if(!(x||!ot))if(!Kt)Y();else{const k=E.target;if(dt.has(k))return;const W=setTimeout(()=>{dt.delete(k),Y()},Kt);dt.set(k,W)}},bs=E=>{if(x||!ot||!Kt)return;const k=E.target,W=dt.get(k);W&&(clearTimeout(W),dt.delete(k))},Rt=Ht?H(a,{})??Un:ie,xt=Ht?ie:H(c,{})??ie,be=[_,Rt.className,xt.className].filter(Boolean).join(" "),Ce=(L||Rt.style||xt.style)&&{...L,...Rt.style,...xt.style};return{...Re,...Rt,...xt,href:_t?.href,ref:r,onClick:ft([R,Rs]),onFocus:ft([w,Pe]),onMouseEnter:ft([C,Ps]),onMouseLeave:ft([M,bs]),onTouchStart:ft([I,xs]),disabled:!!x,target:S,...Ce&&{style:Ce},...be&&{className:be},...x&&Vn,...Ht&&Kn,...n&&Hn}}const ie={},Un={className:"active"},Vn={role:"link","aria-disabled":!0},Kn={"data-status":"active","aria-current":"page"},Hn={"data-transitioning":"transitioning"},dt=new WeakMap,qn={rootMargin:"100px"},ft=t=>s=>{for(const e of t)if(e){if(s.defaultPrevented)return;e(s)}},ms=b.forwardRef((t,s)=>{const{_asChild:e,...n}=t,{type:o,ref:i,...r}=$n(n,s),a=typeof n.children=="function"?n.children({isActive:r["data-status"]==="active"}):n.children;return e===void 0&&delete r.disabled,b.createElement(e||"a",{...r,ref:i},a)});function Gn(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}class Jn extends ds{constructor(s){super(s),this.useMatch=e=>U({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>U({...e,from:this.id,select:n=>e?.select?e.select(n.context):n.context}),this.useSearch=e=>Se({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ve({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ye({...e,from:this.id}),this.useLoaderData=e=>ge({...e,from:this.id}),this.useNavigate=()=>_e({from:this.fullPath}),this.Link=at.forwardRef((e,n)=>P.jsx(ms,{ref:n,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function Yn(t){return new Jn(t)}class Xn extends Mn{constructor(s){super(s),this.useMatch=e=>U({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>U({...e,from:this.id,select:n=>e?.select?e.select(n.context):n.context}),this.useSearch=e=>Se({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ve({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ye({...e,from:this.id}),this.useLoaderData=e=>ge({...e,from:this.id}),this.useNavigate=()=>_e({from:this.fullPath}),this.Link=at.forwardRef((e,n)=>P.jsx(ms,{ref:n,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function Io(t){return new Xn(t)}function Ue(t){return typeof t=="object"?new Ve(t,{silent:!0}).createRoute(t):new Ve(t,{silent:!0}).createRoute}class Ve{constructor(s,e){this.path=s,this.createRoute=n=>{this.silent;const o=Yn(n);return o.isRoot=!1,o},this.silent=e?.silent}}class Ke{constructor(s){this.useMatch=e=>U({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>U({from:this.options.id,select:n=>e?.select?e.select(n.context):n.context}),this.useSearch=e=>Se({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>ve({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>ye({...e,from:this.options.id}),this.useLoaderData=e=>ge({...e,from:this.options.id}),this.useNavigate=()=>{const e=O();return _e({from:e.routesById[this.options.id].fullPath})},this.options=s,this.$$typeof=Symbol.for("react.memo")}}function He(t){return typeof t=="object"?new Ke(t):s=>new Ke({id:t,...s})}function Zn(){const t=O(),s=b.useRef({router:t,mounted:!1}),[e,n]=b.useState(!1),{hasPendingMatches:o,isLoading:i}=T({select:l=>({isLoading:l.isLoading,hasPendingMatches:l.matches.some(u=>u.status==="pending")}),structuralSharing:!0}),r=oe(i),a=i||e||o,c=oe(a),h=i||o,d=oe(h);return t.startTransition=l=>{n(!0),b.startTransition(()=>{l(),n(!1)})},b.useEffect(()=>{const l=t.history.subscribe(t.load),u=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Q(t.latestLocation.href)!==Q(u.href)&&t.commitLocation({...u,replace:!0}),()=>{l()}},[t,t.history]),Mt(()=>{if(typeof window<"u"&&t.ssr||s.current.router===t&&s.current.mounted)return;s.current={router:t,mounted:!0},(async()=>{try{await t.load()}catch(u){console.error(u)}})()},[t]),Mt(()=>{r&&!i&&t.emit({type:"onLoad",...tt(t.state)})},[r,t,i]),Mt(()=>{d&&!h&&t.emit({type:"onBeforeRouteMount",...tt(t.state)})},[h,d,t]),Mt(()=>{if(c&&!a){const l=tt(t.state);t.emit({type:"onResolved",...l}),t.__store.setState(u=>({...u,status:"idle",resolvedLocation:u.location})),l.hrefChanged&&an(t)}},[a,c,t]),null}function Qn(t){const s=T({select:e=>`not-found-${e.location.pathname}-${e.status}`});return P.jsx(me,{getResetKey:()=>s,onCatch:(e,n)=>{if(D(e))t.onCatch?.(e,n);else throw e},errorComponent:({error:e})=>{if(D(e))return t.fallback?.(e);throw e},children:t.children})}function to(){return P.jsx("p",{children:"Not Found"})}function rt(t){return P.jsx(P.Fragment,{children:t.children})}function gs(t,s,e){return s.options.notFoundComponent?P.jsx(s.options.notFoundComponent,{...e}):t.options.defaultNotFoundComponent?P.jsx(t.options.defaultNotFoundComponent,{...e}):P.jsx(to,{})}function eo({children:t}){const s=O();return s.isServer?P.jsx("script",{nonce:s.options.ssr?.nonce,className:"$tsr",dangerouslySetInnerHTML:{__html:t+';typeof $_TSR !== "undefined" && $_TSR.c()'}}):null}function so(){const t=O();if(!t.isScrollRestoring||!t.isServer||typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return null;const e=(t.options.getScrollRestorationKey||ae)(t.latestLocation),n=e!==ae(t.latestLocation)?e:void 0,o={storageKey:Dt,shouldScrollRestoration:!0};return n&&(o.key=n),P.jsx(eo,{children:`(${ss.toString()})(${JSON.stringify(o)})`})}const ys=b.memo(function({matchId:s}){const e=O(),n=T({select:y=>{const v=y.matches.find(S=>S.id===s);return K(v),{routeId:v.routeId,ssr:v.ssr,_displayPending:v._displayPending}},structuralSharing:!0}),o=e.routesById[n.routeId],i=o.options.pendingComponent??e.options.defaultPendingComponent,r=i?P.jsx(i,{}):null,a=o.options.errorComponent??e.options.defaultErrorComponent,c=o.options.onCatch??e.options.defaultOnCatch,h=o.isRoot?o.options.notFoundComponent??e.options.notFoundRoute?.options.component:o.options.notFoundComponent,d=n.ssr===!1||n.ssr==="data-only",l=(!o.isRoot||o.options.wrapInSuspense||d)&&(o.options.wrapInSuspense??i??(o.options.errorComponent?.preload||d))?b.Suspense:rt,u=a?me:rt,f=h?Qn:rt,p=T({select:y=>y.loadedAt}),g=T({select:y=>{const v=y.matches.findIndex(S=>S.id===s);return y.matches[v-1]?.routeId}}),m=o.isRoot?o.options.shellComponent??rt:rt;return P.jsxs(m,{children:[P.jsx(Vt.Provider,{value:s,children:P.jsx(l,{fallback:r,children:P.jsx(u,{getResetKey:()=>p,errorComponent:a||Ut,onCatch:(y,v)=>{if(D(y))throw y;c?.(y,v)},children:P.jsx(f,{fallback:y=>{if(!h||y.routeId&&y.routeId!==n.routeId||!y.routeId&&!o.isRoot)throw y;return b.createElement(h,y)},children:d||n._displayPending?P.jsx(En,{fallback:r,children:P.jsx(qe,{matchId:s})}):P.jsx(qe,{matchId:s})})})})}),g===B&&e.options.scrollRestoration?P.jsxs(P.Fragment,{children:[P.jsx(no,{}),P.jsx(so,{})]}):null]})});function no(){const t=O(),s=b.useRef(void 0);return P.jsx("script",{suppressHydrationWarning:!0,ref:e=>{e&&(s.current===void 0||s.current.href!==t.latestLocation.href)&&(t.emit({type:"onRendered",...tt(t.state)}),s.current=t.latestLocation)}},t.latestLocation.state.__TSR_key)}const qe=b.memo(function({matchId:s}){const e=O(),{match:n,key:o,routeId:i}=T({select:c=>{const h=c.matches.find(p=>p.id===s),d=h.routeId,u=(e.routesById[d].options.remountDeps??e.options.defaultRemountDeps)?.({routeId:d,loaderDeps:h.loaderDeps,params:h._strictParams,search:h._strictSearch});return{key:u?JSON.stringify(u):void 0,routeId:d,match:{id:h.id,status:h.status,error:h.error,_forcePending:h._forcePending,_displayPending:h._displayPending}}},structuralSharing:!0}),r=e.routesById[i],a=b.useMemo(()=>{const c=r.options.component??e.options.defaultComponent;return c?P.jsx(c,{},o):P.jsx(oo,{})},[o,r.options.component,e.options.defaultComponent]);if(n._displayPending)throw e.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw e.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status==="pending"){const c=r.options.pendingMinMs??e.options.defaultPendingMinMs;if(c){const h=e.getMatch(n.id);if(h&&!h._nonReactive.minPendingPromise&&!e.isServer){const d=ct();h._nonReactive.minPendingPromise=d,setTimeout(()=>{d.resolve(),h._nonReactive.minPendingPromise=void 0},c)}}throw e.getMatch(n.id)?._nonReactive.loadPromise}if(n.status==="notFound")return K(D(n.error)),gs(e,r,n.error);if(n.status==="redirected")throw K($(n.error)),e.getMatch(n.id)?._nonReactive.loadPromise;if(n.status==="error"){if(e.isServer){const c=(r.options.errorComponent??e.options.defaultErrorComponent)||Ut;return P.jsx(c,{error:n.error,reset:void 0,info:{componentStack:""}})}throw n.error}return a}),oo=b.memo(function(){const s=O(),e=b.useContext(Vt),n=T({select:h=>h.matches.find(d=>d.id===e)?.routeId}),o=s.routesById[n],i=T({select:h=>{const l=h.matches.find(u=>u.id===e);return K(l),l.globalNotFound}}),r=T({select:h=>{const d=h.matches,l=d.findIndex(u=>u.id===e);return d[l+1]?.id}}),a=s.options.defaultPendingComponent?P.jsx(s.options.defaultPendingComponent,{}):null;if(i)return gs(s,o,void 0);if(!r)return null;const c=P.jsx(ys,{matchId:r});return n===B?P.jsx(b.Suspense,{fallback:a,children:c}):c});function io(){const t=O(),e=t.routesById[B].options.pendingComponent??t.options.defaultPendingComponent,n=e?P.jsx(e,{}):null,o=t.isServer||typeof document<"u"&&t.ssr?rt:b.Suspense,i=P.jsxs(o,{fallback:n,children:[!t.isServer&&P.jsx(Zn,{}),P.jsx(ro,{})]});return t.options.InnerWrap?P.jsx(t.options.InnerWrap,{children:i}):i}function ro(){const t=O(),s=T({select:o=>o.matches[0]?.id}),e=T({select:o=>o.loadedAt}),n=s?P.jsx(ys,{matchId:s}):null;return P.jsx(Vt.Provider,{value:s,children:t.options.disableGlobalCatchBoundary?n:P.jsx(me,{getResetKey:()=>e,errorComponent:Ut,onCatch:o=>{o.message||o.toString()},children:n})})}function Eo(){const t=O();return T({select:s=>[s.location.href,s.resolvedLocation?.href,s.status],structuralSharing:!0}),b.useCallback(s=>{const{pending:e,caseSensitive:n,fuzzy:o,includeSearch:i,...r}=s;return t.matchRoute(r,{pending:e,caseSensitive:n,fuzzy:o,includeSearch:i})},[t])}const ko=t=>new ao(t);class ao extends Rn{constructor(s){super(s)}}typeof globalThis<"u"?(globalThis.createFileRoute=Ue,globalThis.createLazyFileRoute=He):typeof window<"u"&&(window.createFileRoute=Ue,window.createLazyFileRoute=He);function co({router:t,children:s,...e}){Object.keys(e).length>0&&t.update({...t.options,...e,context:{...t.options.context,...e.context}});const n=ps(),o=P.jsx(n.Provider,{value:t,children:s});return t.options.Wrap?P.jsx(t.options.Wrap,{children:o}):o}function To({router:t,...s}){return P.jsx(co,{router:t,...s,children:P.jsx(io,{})})}function it(t,s,e){let n=e.initialDeps??[],o,i=!0;function r(){var a,c,h;let d;e.key&&((a=e.debug)!=null&&a.call(e))&&(d=Date.now());const l=t();if(!(l.length!==n.length||l.some((p,g)=>n[g]!==p)))return o;n=l;let f;if(e.key&&((c=e.debug)!=null&&c.call(e))&&(f=Date.now()),o=s(...l),e.key&&((h=e.debug)!=null&&h.call(e))){const p=Math.round((Date.now()-d)*100)/100,g=Math.round((Date.now()-f)*100)/100,m=g/16,y=(v,S)=>{for(v=String(v);v.length{n=a},r}function Ge(t,s){if(t===void 0)throw new Error("Unexpected undefined");return t}const lo=(t,s)=>Math.abs(t-s)<1.01,uo=(t,s,e)=>{let n;return function(...o){t.clearTimeout(n),n=t.setTimeout(()=>s.apply(this,o),e)}},Je=t=>{const{offsetWidth:s,offsetHeight:e}=t;return{width:s,height:e}},ho=t=>t,fo=t=>{const s=Math.max(t.startIndex-t.overscan,0),e=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let o=s;o<=e;o++)n.push(o);return n},po=(t,s)=>{const e=t.scrollElement;if(!e)return;const n=t.targetWindow;if(!n)return;const o=r=>{const{width:a,height:c}=r;s({width:Math.round(a),height:Math.round(c)})};if(o(Je(e)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(r=>{const a=()=>{const c=r[0];if(c?.borderBoxSize){const h=c.borderBoxSize[0];if(h){o({width:h.inlineSize,height:h.blockSize});return}}o(Je(e))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(e,{box:"border-box"}),()=>{i.unobserve(e)}},Ye={passive:!0},Xe=typeof window>"u"?!0:"onscrollend"in window,mo=(t,s)=>{const e=t.scrollElement;if(!e)return;const n=t.targetWindow;if(!n)return;let o=0;const i=t.options.useScrollendEvent&&Xe?()=>{}:uo(n,()=>{s(o,!1)},t.options.isScrollingResetDelay),r=d=>()=>{const{horizontal:l,isRtl:u}=t.options;o=l?e.scrollLeft*(u&&-1||1):e.scrollTop,i(),s(o,d)},a=r(!0),c=r(!1);c(),e.addEventListener("scroll",a,Ye);const h=t.options.useScrollendEvent&&Xe;return h&&e.addEventListener("scrollend",c,Ye),()=>{e.removeEventListener("scroll",a),h&&e.removeEventListener("scrollend",c)}},go=(t,s,e)=>{if(s?.borderBoxSize){const n=s.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return t[e.options.horizontal?"offsetWidth":"offsetHeight"]},yo=(t,{adjustments:s=0,behavior:e},n)=>{var o,i;const r=t+s;(i=(o=n.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[n.options.horizontal?"left":"top"]:r,behavior:e})};class vo{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const r=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var o;(o=n())==null||o.disconnect(),e=null},observe:o=>{var i;return(i=n())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=n())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,o])=>{typeof o>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ho,rangeExtractor:fo,onChange:()=>{},measureElement:go,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var n,o;(o=(n=this.options).onChange)==null||o.call(n,this,e)},this.maybeNotify=it(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,n)=>{const o=new Map,i=new Map;for(let r=n-1;r>=0;r--){const a=e[r];if(o.has(a.lane))continue;const c=i.get(a.lane);if(c==null||a.end>c.end?i.set(a.lane,a):a.endr.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=it(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,n,o,i,r,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:a}),{key:!1,skipInitialOnChange:!0,onChange:()=>{this.notify(this.isScrolling)}}),this.getMeasurements=it(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:a},c)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const u of this.laneAssignments.keys())u>=e&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const h=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,h),l=new Array(a).fill(void 0);for(let u=0;u1){g=p;const x=l[g],L=x!==void 0?d[x]:void 0;m=L?L.end+this.options.gap:n+o}else{const x=this.options.lanes===1?d[u-1]:this.getFurthestMeasurement(d,u);m=x?x.end+this.options.gap:n+o,g=x?x.lane:u%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(u,g)}const y=c.get(f),v=typeof y=="number"?y:this.options.estimateSize(u),S=m+v;d[u]={index:u,start:m,size:v,end:S,key:f,lane:g},l[g]=u}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=it(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,o,i)=>this.range=e.length>0&&n>0?So({measurements:e,outerSize:n,scrollOffset:o,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=it(()=>{let e=null,n=null;const o=this.calculateRange();return o&&(e=o.startIndex,n=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,o,i,r)=>i===null||r===null?[]:e({startIndex:i,endIndex:r,overscan:n,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const n=this.options.indexAttribute,o=e.getAttribute(n);return o?parseInt(o,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(e,n)=>{const o=this.indexFromElement(e),i=this.measurementsCache[o];if(!i)return;const r=i.key,a=this.elementsCache.get(r);a!==e&&(a&&this.observer.unobserve(a),this.observer.observe(e),this.elementsCache.set(r,e)),e.isConnected&&this.resizeItem(o,this.options.measureElement(e,n,this))},this.resizeItem=(e,n)=>{const o=this.measurementsCache[e];if(!o)return;const i=this.itemSizeCache.get(o.key)??o.size,r=n-i;r!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,r,this):o.start{if(!e){this.elementsCache.forEach((n,o)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(o))});return}this._measureElement(e,void 0)},this.getVirtualItems=it(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{const o=[];for(let i=0,r=e.length;ithis.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();if(n.length!==0)return Ge(n[vs(0,n.length-1,o=>Ge(n[o]).start,e)])},this.getOffsetForAlignment=(e,n,o=0)=>{const i=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=e>=r+i?"end":"start"),n==="center"?e+=(o-i)/2:n==="end"&&(e-=i);const a=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const o=this.measurementsCache[e];if(!o)return;const i=this.getSize(),r=this.getScrollOffset();if(n==="auto")if(o.end>=r+i-this.options.scrollPaddingEnd)n="end";else if(o.start<=r+this.options.scrollPaddingStart)n="start";else return[r,n];const a=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,o.size),n]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:n="start",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,n),{adjustments:void 0,behavior:o})},this.scrollToIndex=(e,{align:n="auto",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let i=0;const r=10,a=h=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(e,h);if(!d){console.warn("Failed to get offset for index:",e);return}const[l,u]=d;this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const f=this.getScrollOffset(),p=this.getOffsetForIndex(e,u);if(!p){console.warn("Failed to get offset for index:",e);return}lo(p[0],f)||c(u)})},c=h=>{this.targetWindow&&(i++,ia(h)):console.warn(`Failed to scroll to index ${e} after ${r} attempts.`))};a(n)},this.scrollBy=(e,{behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var e;const n=this.getMeasurements();let o;if(n.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((e=n[n.length-1])==null?void 0:e.end)??0;else{const i=Array(this.options.lanes).fill(null);let r=n.length-1;for(;r>=0&&i.some(a=>a===null);){const a=n[r];i[a.lane]===null&&(i[a.lane]=a.end),r--}o=Math.max(...i.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:o})=>{this.options.scrollToFn(e,{behavior:o,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(s)}}const vs=(t,s,e,n)=>{for(;t<=s;){const o=(t+s)/2|0,i=e(o);if(in)s=o-1;else return o}return t>0?t-1:0};function So({measurements:t,outerSize:s,scrollOffset:e,lanes:n}){const o=t.length-1,i=c=>t[c].start;if(t.length<=n)return{startIndex:0,endIndex:o};let r=vs(0,o,i,e),a=r;if(n===1)for(;a1){const c=Array(n).fill(0);for(;ad=0&&h.some(d=>d>=e);){const d=t[r];h[d.lane]=d.start,r--}r=Math.max(0,r-r%n),a=Math.min(o,a+(n-1-a%n))}return{startIndex:r,endIndex:a}}const Ze=typeof document<"u"?b.useLayoutEffect:b.useEffect;function _o(t){const s=b.useReducer(()=>({}),{})[1],e={...t,onChange:(o,i)=>{var r;i?we.flushSync(s):s(),(r=t.onChange)==null||r.call(t,o,i)}},[n]=b.useState(()=>new vo(e));return n.setOptions(e),Ze(()=>n._didMount(),[]),Ze(()=>n._willUpdate()),n}function Oo(t){return _o({observeElementRect:po,observeElementOffset:mo,scrollToFn:yo,...t})}export{ms as L,oo as O,at as R,Co as a,we as b,Mo as c,Fn as d,_e as e,Oo as f,Eo as g,Io as h,K as i,P as j,Yn as k,ko as l,pn as m,To as n,b as r,Lo as u,fs as w}; diff --git a/webui/dist/assets/router-CWhjJi2n.js b/webui/dist/assets/router-CWhjJi2n.js deleted file mode 100644 index 3159c04f..00000000 --- a/webui/dist/assets/router-CWhjJi2n.js +++ /dev/null @@ -1,5 +0,0 @@ -import{r as _s,a as se,g as oe,b as Rs}from"./react-vendor-Dtc2IqVY.js";function Ps(t,o){for(var e=0;es[n]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var v=_s(),_=se();const it=oe(_),En=Ps({__proto__:null,default:it},[_]),Xt=new WeakMap,ws=new WeakMap,Et={current:[]};let Nt=!1,gt=0;const mt=new Set,wt=new Map;function Ge(t){for(const o of t){if(Et.current.includes(o))continue;Et.current.push(o),o.recompute();const e=ws.get(o);if(e)for(const s of e){const n=Xt.get(s);n?.length&&Ge(n)}}}function xs(t){const o={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(o)}function bs(t){const o={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(o)}function Je(t){if(gt>0&&!wt.has(t)&&wt.set(t,t.prevState),mt.add(t),!(gt>0)&&!Nt)try{for(Nt=!0;mt.size>0;){const o=Array.from(mt);mt.clear();for(const e of o){const s=wt.get(e)??e.prevState;e.prevState=s,xs(e)}for(const e of o){const s=Xt.get(e);s&&(Et.current.push(e),Ge(s))}for(const e of o){const s=Xt.get(e);if(s)for(const n of s)bs(n)}}}finally{Nt=!1,Et.current=[],wt.clear()}}function vt(t){gt++;try{t()}finally{if(gt--,gt===0){const o=mt.values().next().value;o&&Je(o)}}}function Cs(t){return typeof t=="function"}class Ms{constructor(o,e){this.listeners=new Set,this.subscribe=s=>{var n,r;this.listeners.add(s);const i=(r=(n=this.options)==null?void 0:n.onSubscribe)==null?void 0:r.call(n,s,this);return()=>{this.listeners.delete(s),i?.()}},this.prevState=o,this.state=o,this.options=e}setState(o){var e,s,n;this.prevState=this.state,(e=this.options)!=null&&e.updateFn?this.state=this.options.updateFn(this.prevState)(o):Cs(o)?this.state=o(this.prevState):this.state=o,(n=(s=this.options)==null?void 0:s.onUpdate)==null||n.call(s),Je(this)}}const q="__TSR_index",Re="popstate",Pe="beforeunload";function Ls(t){let o=t.getLocation();const e=new Set,s=i=>{o=t.getLocation(),e.forEach(a=>a({location:o,action:i}))},n=i=>{t.notifyOnIndexChange??!0?s(i):o=t.getLocation()},r=async({task:i,navigateOpts:a,...c})=>{if(a?.ignoreBlocker??!1){i();return}const l=t.getBlockers?.()??[],h=c.type==="PUSH"||c.type==="REPLACE";if(typeof document<"u"&&l.length&&h)for(const d of l){const f=Tt(c.path,c.state);if(await d.blockerFn({currentLocation:o,nextLocation:f,action:c.type})){t.onBlocked?.();return}}i()};return{get location(){return o},get length(){return t.getLength()},subscribers:e,subscribe:i=>(e.add(i),()=>{e.delete(i)}),push:(i,a,c)=>{const u=o.state[q];a=we(u+1,a),r({task:()=>{t.pushState(i,a),s({type:"PUSH"})},navigateOpts:c,type:"PUSH",path:i,state:a})},replace:(i,a,c)=>{const u=o.state[q];a=we(u,a),r({task:()=>{t.replaceState(i,a),s({type:"REPLACE"})},navigateOpts:c,type:"REPLACE",path:i,state:a})},go:(i,a)=>{r({task:()=>{t.go(i),n({type:"GO",index:i})},navigateOpts:a,type:"GO"})},back:i=>{r({task:()=>{t.back(i?.ignoreBlocker??!1),n({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{r({task:()=>{t.forward(i?.ignoreBlocker??!1),n({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>o.state[q]!==0,createHref:i=>t.createHref(i),block:i=>{if(!t.setBlockers)return()=>{};const a=t.getBlockers?.()??[];return t.setBlockers([...a,i]),()=>{const c=t.getBlockers?.()??[];t.setBlockers?.(c.filter(u=>u!==i))}},flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:s}}function we(t,o){o||(o={});const e=ne();return{...o,key:e,__TSR_key:e,[q]:t}}function Es(t){const o=typeof document<"u"?window:void 0,e=o.history.pushState,s=o.history.replaceState;let n=[];const r=()=>n,i=S=>n=S,a=(S=>S),c=(()=>Tt(`${o.location.pathname}${o.location.search}${o.location.hash}`,o.history.state));if(!o.history.state?.__TSR_key&&!o.history.state?.key){const S=ne();o.history.replaceState({[q]:0,key:S,__TSR_key:S},"")}let u=c(),l,h=!1,d=!1,f=!1,p=!1;const m=()=>u;let g,y;const w=()=>{g&&(R._ignoreSubscribers=!0,(g.isPush?o.history.pushState:o.history.replaceState)(g.state,"",g.href),R._ignoreSubscribers=!1,g=void 0,y=void 0,l=void 0)},P=(S,C,M)=>{const T=a(C);y||(l=u),u=Tt(C,M),g={href:T,state:M,isPush:g?.isPush||S==="push"},y||(y=Promise.resolve().then(()=>w()))},b=S=>{u=c(),R.notify({type:S})},E=async()=>{if(d){d=!1;return}const S=c(),C=S.state[q]-u.state[q],M=C===1,T=C===-1,I=!M&&!T||h;h=!1;const Y=I?"GO":T?"BACK":"FORWARD",D=I?{type:"GO",index:C}:{type:T?"BACK":"FORWARD"};if(f)f=!1;else{const X=r();if(typeof document<"u"&&X.length){for(const pe of X)if(await pe.blockerFn({currentLocation:u,nextLocation:S,action:Y})){d=!0,o.history.go(1),R.notify(D);return}}}u=c(),R.notify(D)},x=S=>{if(p){p=!1;return}let C=!1;const M=r();if(typeof document<"u"&&M.length)for(const T of M){const I=T.enableBeforeUnload??!0;if(I===!0){C=!0;break}if(typeof I=="function"&&I()===!0){C=!0;break}}if(C)return S.preventDefault(),S.returnValue=""},R=Ls({getLocation:m,getLength:()=>o.history.length,pushState:(S,C)=>P("push",S,C),replaceState:(S,C)=>P("replace",S,C),back:S=>(S&&(f=!0),p=!0,o.history.back()),forward:S=>{S&&(f=!0),p=!0,o.history.forward()},go:S=>{h=!0,o.history.go(S)},createHref:S=>a(S),flush:w,destroy:()=>{o.history.pushState=e,o.history.replaceState=s,o.removeEventListener(Pe,x,{capture:!0}),o.removeEventListener(Re,E)},onBlocked:()=>{l&&u!==l&&(u=l)},getBlockers:r,setBlockers:i,notifyOnIndexChange:!1});return o.addEventListener(Pe,x,{capture:!0}),o.addEventListener(Re,E),o.history.pushState=function(...S){const C=e.apply(o.history,S);return R._ignoreSubscribers||b("PUSH"),C},o.history.replaceState=function(...S){const C=s.apply(o.history,S);return R._ignoreSubscribers||b("REPLACE"),C},R}function Tt(t,o){const e=t.indexOf("#"),s=t.indexOf("?"),n=ne();return{href:t,pathname:t.substring(0,e>0?s>0?Math.min(e,s):e:s>0?s:t.length),hash:e>-1?t.substring(e):"",search:s>-1?t.slice(s,e===-1?void 0:e):"",state:o||{[q]:0,key:n,__TSR_key:n}}}function ne(){return(Math.random()+1).toString(36).substring(7)}function Zt(t){return t[t.length-1]}function Ts(t){return typeof t=="function"}function Q(t,o){return Ts(t)?t(o):t}const Is=Object.prototype.hasOwnProperty;function B(t,o){if(t===o)return t;const e=o,s=Ce(t)&&Ce(e);if(!s&&!(It(t)&&It(e)))return e;const n=s?t:xe(t);if(!n)return e;const r=s?e:xe(e);if(!r)return e;const i=n.length,a=r.length,c=s?new Array(a):{};let u=0;for(let l=0;l"u")return!0;const e=o.prototype;return!(!be(e)||!e.hasOwnProperty("isPrototypeOf"))}function be(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ce(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function tt(t,o,e){if(t===o)return!0;if(typeof t!=typeof o)return!1;if(Array.isArray(t)&&Array.isArray(o)){if(t.length!==o.length)return!1;for(let s=0,n=t.length;sn||!tt(t[i],o[i],e)))return!1;return n===r}return!1}function at(t){let o,e;const s=new Promise((n,r)=>{o=n,e=r});return s.status="pending",s.resolve=n=>{s.status="resolved",s.value=n,o(n),t?.(n)},s.reject=n=>{s.status="rejected",e(n)},s}function G(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}const Os=Array.from(new Map([["%","%25"],["\\","%5C"]]).values());function Me(t,o=Os){function e(n,r,i=0){for(let a=i;a{try{return decodeURI(a)}catch{return a}})}}if(t===""||!/%[0-9A-Fa-f]{2}/g.test(t))return t;const s=t.replaceAll(/%[0-9a-f]{2}/g,n=>n.toUpperCase());return e(s,o)}var ks="Invariant failed";function K(t,o){if(!t)throw new Error(ks)}const N=0,st=1,ct=2,lt=3;function U(t){return re(t.filter(o=>o!==void 0).join("/"))}function re(t){return t.replace(/\/{2,}/g,"/")}function ie(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}function J(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}function Mt(t){return J(ie(t))}function Ot(t,o){return t?.endsWith("/")&&t!=="/"&&t!==`${o}/`?t.slice(0,-1):t}function Fs(t,o,e){return Ot(t,e)===Ot(o,e)}function As(t){const{type:o,value:e}=t;if(o===N)return e;const{prefixSegment:s,suffixSegment:n}=t;if(o===st){const r=e.substring(1);if(s&&n)return`${s}{$${r}}${n}`;if(s)return`${s}{$${r}}`;if(n)return`{$${r}}${n}`}if(o===lt){const r=e.substring(1);return s&&n?`${s}{-$${r}}${n}`:s?`${s}{-$${r}}`:n?`{-$${r}}${n}`:`{-$${r}}`}if(o===ct){if(s&&n)return`${s}{$}${n}`;if(s)return`${s}{$}`;if(n)return`{$}${n}`}return e}function Bs({base:t,to:o,trailingSlash:e="never",parseCache:s}){let n=ut(t,s).slice();const r=ut(o,s);n.length>1&&Zt(n)?.value==="/"&&n.pop();for(let c=0,u=r.length;c1&&(Zt(n).value==="/"?e==="never"&&n.pop():e==="always"&&n.push({type:N,value:"/"}));const i=n.map(As);return U(i)}const ut=(t,o)=>{if(!t)return[];const e=o?.get(t);if(e)return e;const s=Ws(t);return o?.set(t,s),s},Ds=/^\$.{1,}$/,zs=/^(.*?)\{(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,$s=/^(.*?)\{-(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,js=/^\$$/,Ns=/^(.*?)\{\$\}(.*)$/;function Ws(t){t=re(t);const o=[];if(t.slice(0,1)==="/"&&(t=t.substring(1),o.push({type:N,value:"/"})),!t)return o;const e=t.split("/").filter(Boolean);return o.push(...e.map(s=>{const n=s.match(Ns);if(n){const a=n[1],c=n[2];return{type:ct,value:"$",prefixSegment:a||void 0,suffixSegment:c||void 0}}const r=s.match($s);if(r){const a=r[1],c=r[2],u=r[3];return{type:lt,value:c,prefixSegment:a||void 0,suffixSegment:u||void 0}}const i=s.match(zs);if(i){const a=i[1],c=i[2],u=i[3];return{type:st,value:""+c,prefixSegment:a||void 0,suffixSegment:u||void 0}}if(Ds.test(s)){const a=s.substring(1);return{type:st,value:"$"+a,prefixSegment:void 0,suffixSegment:void 0}}return js.test(s)?{type:ct,value:"$",prefixSegment:void 0,suffixSegment:void 0}:{type:N,value:s}})),t.slice(-1)==="/"&&(t=t.substring(1),o.push({type:N,value:"/"})),o}function Wt({path:t,params:o,decodeCharMap:e,parseCache:s}){const n=ut(t,s);function r(u){const l=o[u],h=typeof l=="string";return u==="*"||u==="_splat"?h?encodeURI(l):l:h?Vs(l,e):l}let i=!1;const a={},c=U(n.map(u=>{if(u.type===N)return u.value;if(u.type===ct){a._splat=o._splat,a["*"]=o._splat;const l=u.prefixSegment||"",h=u.suffixSegment||"";if(!o._splat)return i=!0,l||h?`${l}${h}`:void 0;const d=r("_splat");return`${l}${d}${h}`}if(u.type===st){const l=u.value.substring(1);!i&&!(l in o)&&(i=!0),a[l]=o[l];const h=u.prefixSegment||"",d=u.suffixSegment||"";return`${h}${r(l)??"undefined"}${d}`}if(u.type===lt){const l=u.value.substring(1),h=u.prefixSegment||"",d=u.suffixSegment||"";return!(l in o)||o[l]==null?h||d?`${h}${d}`:void 0:(a[l]=o[l],`${h}${r(l)??""}${d}`)}return u.value}));return{usedParams:a,interpolatedPath:c,isMissingParams:i}}function Vs(t,o){let e=encodeURIComponent(t);if(o)for(const[s,n]of o)e=e.replaceAll(s,n);return e}function Qt(t,o,e){const s=Us(t,o,e);if(!(o.to&&!s))return s??{}}function Us(t,{to:o,fuzzy:e,caseSensitive:s},n){const r=o,i=ut(t.startsWith("/")?t:`/${t}`,n),a=ut(r.startsWith("/")?r:`/${r}`,n),c={};return Ks(i,a,c,e,s)?c:void 0}function Ks(t,o,e,s,n){let r=0,i=0;for(;rm.value)));h&&p.startsWith(h)&&(p=p.slice(h.length)),d&&p.endsWith(d)&&(p=p.slice(0,p.length-d.length)),l=p}else l=decodeURI(U(u.map(h=>h.value)));return e["*"]=l,e._splat=l,!0}if(c.type===N){if(c.value==="/"&&!a?.value){i++;continue}if(a){if(n){if(c.value!==a.value)return!1}else if(c.value.toLowerCase()!==a.value.toLowerCase())return!1;r++,i++;continue}else return!1}if(c.type===st){if(!a||a.value==="/")return!1;let u="",l=!1;if(c.prefixSegment||c.suffixSegment){const h=c.prefixSegment||"",d=c.suffixSegment||"",f=a.value;if(h&&!f.startsWith(h)||d&&!f.endsWith(d))return!1;let p=f;h&&p.startsWith(h)&&(p=p.slice(h.length)),d&&p.endsWith(d)&&(p=p.slice(0,p.length-d.length)),u=decodeURIComponent(p),l=!0}else u=decodeURIComponent(a.value),l=!0;l&&(e[c.value.substring(1)]=u,r++),i++;continue}if(c.type===lt){if(!a){i++;continue}if(a.value==="/"){i++;continue}let u="",l=!1;if(c.prefixSegment||c.suffixSegment){const h=c.prefixSegment||"",d=c.suffixSegment||"",f=a.value;if((!h||f.startsWith(h))&&(!d||f.endsWith(d))){let p=f;h&&p.startsWith(h)&&(p=p.slice(h.length)),d&&p.endsWith(d)&&(p=p.slice(0,p.length-d.length)),u=decodeURIComponent(p),l=!0}}else{let h=!0;for(let d=i+1;d=o.length)return e["**"]=U(t.slice(r).map(u=>u.value)),!!s&&o[o.length-1]?.value!=="/";if(i=t.length){for(let u=i;u{if(s.isRoot||!s.path)return;const r=ie(s.fullPath);let i=ut(r),a=0;for(;i.length>a+1&&i[a]?.value==="/";)a++;a>0&&(i=i.slice(a));let c=0,u=!1;const l=i.map((h,d)=>{if(h.value==="/")return Hs;if(h.type===N)return qs;let f;h.type===st?f=Gs:h.type===lt?(f=Js,c++):f=Ys;for(let p=d+1;p{const r=Math.min(s.scores.length,n.scores.length);for(let i=0;in.parsed[i].value?1:-1;return s.index-n.index}).map((s,n)=>(s.child.rank=n,s.child))}function so({routeTree:t,initRoute:o}){const e={},s={},n=i=>{i.forEach((a,c)=>{o?.(a,c);const u=e[a.id];if(K(!u,`Duplicate routes found with id: ${String(a.id)}`),e[a.id]=a,!a.isRoot&&a.path){const h=J(a.fullPath);(!s[h]||a.fullPath.endsWith("/"))&&(s[h]=a)}const l=a.children;l?.length&&n(l)})};n([t]);const r=eo(Object.values(e));return{routesById:e,routesByPath:s,flatRoutes:r}}function $(t){return!!t?.isNotFound}function oo(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const kt="tsr-scroll-restoration-v1_3",no=(t,o)=>{let e;return(...s)=>{e||(e=setTimeout(()=>{t(...s),e=null},o))}};function ro(){const t=oo();if(!t)return null;const o=t.getItem(kt);let e=o?JSON.parse(o):{};return{state:e,set:s=>(e=Q(s,e)||e,t.setItem(kt,JSON.stringify(e)))}}const xt=ro(),te=t=>t.state.__TSR_key||t.href;function io(t){const o=[];let e;for(;e=t.parentNode;)o.push(`${t.tagName}:nth-child(${Array.prototype.indexOf.call(e.children,t)+1})`),t=e;return`${o.reverse().join(" > ")}`.toLowerCase()}let Ft=!1;function Ye({storageKey:t,key:o,behavior:e,shouldScrollRestoration:s,scrollToTopSelectors:n,location:r}){let i;try{i=JSON.parse(sessionStorage.getItem(t)||"{}")}catch(u){console.error(u);return}const a=o||window.history.state?.__TSR_key,c=i[a];Ft=!0;t:{if(s&&c&&Object.keys(c).length>0){for(const h in c){const d=c[h];if(h==="window")window.scrollTo({top:d.scrollY,left:d.scrollX,behavior:e});else if(h){const f=document.querySelector(h);f&&(f.scrollLeft=d.scrollX,f.scrollTop=d.scrollY)}}break t}const u=(r??window.location).hash.split("#",2)[1];if(u){const h=window.history.state?.__hashScrollIntoViewOptions??!0;if(h){const d=document.getElementById(u);d&&d.scrollIntoView(h)}break t}const l={top:0,left:0,behavior:e};if(window.scrollTo(l),n)for(const h of n){if(h==="window")continue;const d=typeof h=="function"?h():document.querySelector(h);d&&d.scrollTo(l)}}Ft=!1}function ao(t,o){if(!xt&&!t.isServer||((t.options.scrollRestoration??!1)&&(t.isScrollRestoring=!0),t.isServer||t.isScrollRestorationSetup||!xt))return;t.isScrollRestorationSetup=!0,Ft=!1;const s=t.options.getScrollRestorationKey||te;window.history.scrollRestoration="manual";const n=r=>{if(Ft||!t.isScrollRestoring)return;let i="";if(r.target===document||r.target===window)i="window";else{const c=r.target.getAttribute("data-scroll-restoration-id");c?i=`[data-scroll-restoration-id="${c}"]`:i=io(r.target)}const a=s(t.state.location);xt.set(c=>{const u=c[a]||={},l=u[i]||={};if(i==="window")l.scrollX=window.scrollX||0,l.scrollY=window.scrollY||0;else if(i){const h=document.querySelector(i);h&&(l.scrollX=h.scrollLeft||0,l.scrollY=h.scrollTop||0)}return c})};typeof document<"u"&&document.addEventListener("scroll",no(n,100),!0),t.subscribe("onRendered",r=>{const i=s(r.toLocation);if(!t.resetNextScroll){t.resetNextScroll=!0;return}typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation})||(Ye({storageKey:kt,key:i,behavior:t.options.scrollRestorationBehavior,shouldScrollRestoration:t.isScrollRestoring,scrollToTopSelectors:t.options.scrollToTopSelectors,location:t.history.location}),t.isScrollRestoring&&xt.set(a=>(a[i]||={},a)))})}function co(t){if(typeof document<"u"&&document.querySelector){const o=t.state.location.state.__hashScrollIntoViewOptions??!0;if(o&&t.state.location.hash!==""){const e=document.getElementById(t.state.location.hash);e&&e.scrollIntoView(o)}}}function lo(t,o=String){const e=new URLSearchParams;for(const s in t){const n=t[s];n!==void 0&&e.set(s,o(n))}return e.toString()}function Vt(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}function uo(t){const o=new URLSearchParams(t),e={};for(const[s,n]of o.entries()){const r=e[s];r==null?e[s]=Vt(n):Array.isArray(r)?r.push(Vt(n)):e[s]=[r,Vt(n)]}return e}const ho=po(JSON.parse),fo=mo(JSON.stringify,JSON.parse);function po(t){return o=>{o[0]==="?"&&(o=o.substring(1));const e=uo(o);for(const s in e){const n=e[s];if(typeof n=="string")try{e[s]=t(n)}catch{}}return e}}function mo(t,o){const e=typeof o=="function";function s(n){if(typeof n=="object"&&n!==null)try{return t(n)}catch{}else if(e&&typeof n=="string")try{return o(n),t(n)}catch{}return n}return n=>{const r=lo(n,s);return r?`?${r}`:""}}const A="__root__";function go(t){if(t.statusCode=t.statusCode||t.code||307,!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}const o=new Headers(t.headers);t.href&&o.get("Location")===null&&o.set("Location",t.href);const e=new Response(null,{status:t.statusCode,headers:o});if(e.options=t,t.throw)throw e;return e}function j(t){return t instanceof Response&&!!t.options}function vo(t){const o=new Map;let e,s;const n=r=>{r.next&&(r.prev?(r.prev.next=r.next,r.next.prev=r.prev,r.next=void 0,s&&(s.next=r,r.prev=s)):(r.next.prev=void 0,e=r.next,r.next=void 0,s&&(r.prev=s,s.next=r)),s=r)};return{get(r){const i=o.get(r);if(i)return n(i),i.value},set(r,i){if(o.size>=t&&e){const c=e;o.delete(c.key),c.next&&(e=c.next,c.next.prev=void 0),c===s&&(s=void 0)}const a=o.get(r);if(a)a.value=i,n(a);else{const c={key:r,value:i,prev:s};s&&(s.next=c),s=c,e||(e=c),o.set(r,c)}}}}const Lt=t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},Bt=(t,o)=>!!(t.preload&&!t.router.state.matches.some(e=>e.id===o)),Xe=(t,o)=>{const e=t.router.routesById[o.routeId??""]??t.router.routeTree;!e.options.notFoundComponent&&t.router.options?.defaultNotFoundComponent&&(e.options.notFoundComponent=t.router.options.defaultNotFoundComponent),K(e.options.notFoundComponent);const s=t.matches.find(n=>n.routeId===e.id);K(s,"Could not find match for route: "+e.id),t.updateMatch(s.id,n=>({...n,status:"notFound",error:o,isFetching:!1})),o.routerCode==="BEFORE_LOAD"&&e.parentRoute&&(o.routeId=e.parentRoute.id,Xe(t,o))},H=(t,o,e)=>{if(!(!j(e)&&!$(e))){if(j(e)&&e.redirectHandled&&!e.options.reloadDocument)throw e;if(o){o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.loaderPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,o._nonReactive.loaderPromise=void 0;const s=j(e)?"redirected":"notFound";o._nonReactive.error=e,t.updateMatch(o.id,n=>({...n,status:s,isFetching:!1,error:e})),$(e)&&!e.routeId&&(e.routeId=o.routeId),o._nonReactive.loadPromise?.resolve()}throw j(e)?(t.rendered=!0,e.options._fromLocation=t.location,e.redirectHandled=!0,e=t.router.resolveRedirect(e),e):(Xe(t,e),e)}},Ze=(t,o)=>{const e=t.router.getMatch(o);return!!(!t.router.isServer&&e._nonReactive.dehydrated||t.router.isServer&&e.ssr===!1)},dt=(t,o,e,s)=>{const{id:n,routeId:r}=t.matches[o],i=t.router.looseRoutesById[r];if(e instanceof Promise)throw e;e.routerCode=s,t.firstBadMatchIndex??=o,H(t,t.router.getMatch(n),e);try{i.options.onError?.(e)}catch(a){e=a,H(t,t.router.getMatch(n),e)}t.updateMatch(n,a=>(a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,a._nonReactive.loadPromise?.resolve(),{...a,error:e,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},yo=(t,o,e,s)=>{const n=t.router.getMatch(o),r=t.matches[e-1]?.id,i=r?t.router.getMatch(r):void 0;if(t.router.isShell()){n.ssr=s.id===A;return}if(i?.ssr===!1){n.ssr=!1;return}const a=f=>f===!0&&i?.ssr==="data-only"?"data-only":f,c=t.router.options.defaultSsr??!0;if(s.options.ssr===void 0){n.ssr=a(c);return}if(typeof s.options.ssr!="function"){n.ssr=a(s.options.ssr);return}const{search:u,params:l}=n,h={search:bt(u,n.searchError),params:bt(l,n.paramsError),location:t.location,matches:t.matches.map(f=>({index:f.index,pathname:f.pathname,fullPath:f.fullPath,staticData:f.staticData,id:f.id,routeId:f.routeId,search:bt(f.search,f.searchError),params:bt(f.params,f.paramsError),ssr:f.ssr}))},d=s.options.ssr(h);if(G(d))return d.then(f=>{n.ssr=a(f??c)});n.ssr=a(d??c)},Qe=(t,o,e,s)=>{if(s._nonReactive.pendingTimeout!==void 0)return;const n=e.options.pendingMs??t.router.options.defaultPendingMs;if(!!(t.onReady&&!t.router.isServer&&!Bt(t,o)&&(e.options.loader||e.options.beforeLoad||ss(e))&&typeof n=="number"&&n!==1/0&&(e.options.pendingComponent??t.router.options?.defaultPendingComponent))){const i=setTimeout(()=>{Lt(t)},n);s._nonReactive.pendingTimeout=i}},So=(t,o,e)=>{const s=t.router.getMatch(o);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;Qe(t,o,e,s);const n=()=>{const r=t.router.getMatch(o);r.preload&&(r.status==="redirected"||r.status==="notFound")&&H(t,r,r.error)};return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(n):n()},_o=(t,o,e,s)=>{const n=t.router.getMatch(o),r=n._nonReactive.loadPromise;n._nonReactive.loadPromise=at(()=>{r?.resolve()});const{paramsError:i,searchError:a}=n;i&&dt(t,e,i,"PARSE_PARAMS"),a&&dt(t,e,a,"VALIDATE_SEARCH"),Qe(t,o,s,n);const c=new AbortController,u=t.matches[e-1]?.id,d={...(u?t.router.getMatch(u):void 0)?.context??t.router.options.context??void 0,...n.__routeContext};let f=!1;const p=()=>{f||(f=!0,t.updateMatch(o,R=>({...R,isFetching:"beforeLoad",fetchCount:R.fetchCount+1,abortController:c,context:d})))},m=()=>{n._nonReactive.beforeLoadPromise?.resolve(),n._nonReactive.beforeLoadPromise=void 0,t.updateMatch(o,R=>({...R,isFetching:!1}))};if(!s.options.beforeLoad){vt(()=>{p(),m()});return}n._nonReactive.beforeLoadPromise=at();const{search:g,params:y,cause:w}=n,P=Bt(t,o),b={search:g,abortController:c,params:y,preload:P,context:d,location:t.location,navigate:R=>t.router.navigate({...R,_fromLocation:t.location}),buildLocation:t.router.buildLocation,cause:P?"preload":w,matches:t.matches,...t.router.options.additionalContext},E=R=>{if(R===void 0){vt(()=>{p(),m()});return}(j(R)||$(R))&&(p(),dt(t,e,R,"BEFORE_LOAD")),vt(()=>{p(),t.updateMatch(o,S=>({...S,__beforeLoadContext:R,context:{...S.context,...R}})),m()})};let x;try{if(x=s.options.beforeLoad(b),G(x))return p(),x.catch(R=>{dt(t,e,R,"BEFORE_LOAD")}).then(E)}catch(R){p(),dt(t,e,R,"BEFORE_LOAD")}E(x)},Ro=(t,o)=>{const{id:e,routeId:s}=t.matches[o],n=t.router.looseRoutesById[s],r=()=>{if(t.router.isServer){const c=yo(t,e,o,n);if(G(c))return c.then(a)}return a()},i=()=>_o(t,e,o,n),a=()=>{if(Ze(t,e))return;const c=So(t,e,n);return G(c)?c.then(i):i()};return r()},yt=(t,o,e)=>{const s=t.router.getMatch(o);if(!s||!e.options.head&&!e.options.scripts&&!e.options.headers)return;const n={matches:t.matches,match:s,params:s.params,loaderData:s.loaderData};return Promise.all([e.options.head?.(n),e.options.scripts?.(n),e.options.headers?.(n)]).then(([r,i,a])=>{const c=r?.meta,u=r?.links,l=r?.scripts,h=r?.styles;return{meta:c,links:u,headScripts:l,headers:a,scripts:i,styles:h}})},ts=(t,o,e,s)=>{const n=t.matchPromises[e-1],{params:r,loaderDeps:i,abortController:a,cause:c}=t.router.getMatch(o);let u=t.router.options.context??{};for(let h=0;h<=e;h++){const d=t.matches[h];if(!d)continue;const f=t.router.getMatch(d.id);f&&(u={...u,...f.__routeContext??{},...f.__beforeLoadContext??{}})}const l=Bt(t,o);return{params:r,deps:i,preload:!!l,parentMatchPromise:n,abortController:a,context:u,location:t.location,navigate:h=>t.router.navigate({...h,_fromLocation:t.location}),cause:l?"preload":c,route:s,...t.router.options.additionalContext}},Ie=async(t,o,e,s)=>{try{const n=t.router.getMatch(o);try{(!t.router.isServer||n.ssr===!0)&&es(s);const r=s.options.loader?.(ts(t,o,e,s)),i=s.options.loader&&G(r);if(!!(i||s._lazyPromise||s._componentsPromise||s.options.head||s.options.scripts||s.options.headers||n._nonReactive.minPendingPromise)&&t.updateMatch(o,h=>({...h,isFetching:"loader"})),s.options.loader){const h=i?await r:r;H(t,t.router.getMatch(o),h),h!==void 0&&t.updateMatch(o,d=>({...d,loaderData:h}))}s._lazyPromise&&await s._lazyPromise;const c=yt(t,o,s),u=c?await c:void 0,l=n._nonReactive.minPendingPromise;l&&await l,s._componentsPromise&&await s._componentsPromise,t.updateMatch(o,h=>({...h,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),...u}))}catch(r){let i=r;const a=n._nonReactive.minPendingPromise;a&&await a,$(r)&&await s.options.notFoundComponent?.preload?.(),H(t,t.router.getMatch(o),r);try{s.options.onError?.(r)}catch(l){i=l,H(t,t.router.getMatch(o),l)}const c=yt(t,o,s),u=c?await c:void 0;t.updateMatch(o,l=>({...l,error:i,status:"error",isFetching:!1,...u}))}}catch(n){const r=t.router.getMatch(o);if(r){const i=yt(t,o,s);if(i){const a=await i;t.updateMatch(o,c=>({...c,...a}))}r._nonReactive.loaderPromise=void 0}H(t,r,n)}},Po=async(t,o)=>{const{id:e,routeId:s}=t.matches[o];let n=!1,r=!1;const i=t.router.looseRoutesById[s];if(Ze(t,e)){if(t.router.isServer){const u=yt(t,e,i);if(u){const l=await u;t.updateMatch(e,h=>({...h,...l}))}return t.router.getMatch(e)}}else{const u=t.router.getMatch(e);if(u._nonReactive.loaderPromise){if(u.status==="success"&&!t.sync&&!u.preload)return u;await u._nonReactive.loaderPromise;const l=t.router.getMatch(e),h=l._nonReactive.error||l.error;h&&H(t,l,h)}else{const l=Date.now()-u.updatedAt,h=Bt(t,e),d=h?i.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:i.options.staleTime??t.router.options.defaultStaleTime??0,f=i.options.shouldReload,p=typeof f=="function"?f(ts(t,e,o,i)):f,m=!!h&&!t.router.state.matches.some(P=>P.id===e),g=t.router.getMatch(e);g._nonReactive.loaderPromise=at(),m!==g.preload&&t.updateMatch(e,P=>({...P,preload:m}));const{status:y,invalid:w}=g;if(n=y==="success"&&(w||(p??l>d)),!(h&&i.options.preload===!1))if(n&&!t.sync)r=!0,(async()=>{try{await Ie(t,e,o,i);const P=t.router.getMatch(e);P._nonReactive.loaderPromise?.resolve(),P._nonReactive.loadPromise?.resolve(),P._nonReactive.loaderPromise=void 0}catch(P){j(P)&&await t.router.navigate(P.options)}})();else if(y!=="success"||n&&t.sync)await Ie(t,e,o,i);else{const P=yt(t,e,i);if(P){const b=await P;t.updateMatch(e,E=>({...E,...b}))}}}}const a=t.router.getMatch(e);r||(a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loadPromise?.resolve()),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0,r||(a._nonReactive.loaderPromise=void 0),a._nonReactive.dehydrated=void 0;const c=r?a.isFetching:!1;return c!==a.isFetching||a.invalid!==!1?(t.updateMatch(e,u=>({...u,isFetching:c,invalid:!1})),t.router.getMatch(e)):a};async function Oe(t){const o=Object.assign(t,{matchPromises:[]});!o.router.isServer&&o.router.state.matches.some(e=>e._forcePending)&&Lt(o);try{for(let n=0;n{const{id:e,...s}=o.options;Object.assign(t.options,s),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0),!t._componentsLoaded&&t._componentsPromise===void 0){const o=()=>{const e=[];for(const s of os){const n=t.options[s]?.preload;n&&e.push(n())}if(e.length)return Promise.all(e).then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0});t._componentsLoaded=!0,t._componentsPromise=void 0};t._componentsPromise=t._lazyPromise?t._lazyPromise.then(o):o()}return t._componentsPromise}function bt(t,o){return o?{status:"error",error:o}:{status:"success",value:t}}function ss(t){for(const o of os)if(t.options[o]?.preload)return!0;return!1}const os=["component","errorComponent","pendingComponent","notFoundComponent"];function wo(t){return{input:({url:o})=>{for(const e of t)o=ns(e,o);return o},output:({url:o})=>{for(let e=t.length-1;e>=0;e--)o=rs(t[e],o);return o}}}function xo(t){const o=Mt(t.basepath),e=`/${o}`,s=`${e}/`,n=t.caseSensitive?e:e.toLowerCase(),r=t.caseSensitive?s:s.toLowerCase();return{input:({url:i})=>{const a=t.caseSensitive?i.pathname:i.pathname.toLowerCase();return a===n?i.pathname="/":a.startsWith(r)&&(i.pathname=i.pathname.slice(e.length)),i},output:({url:i})=>(i.pathname=U(["/",o,i.pathname]),i)}}function ns(t,o){const e=t?.input?.({url:o});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return o}function rs(t,o){const e=t?.output?.({url:o});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return o}function et(t){const o=t.resolvedLocation,e=t.location,s=o?.pathname!==e.pathname,n=o?.href!==e.href,r=o?.hash!==e.hash;return{fromLocation:o,toLocation:e,pathChanged:s,hrefChanged:n,hashChanged:r}}class bo{constructor(o){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const s=this.options,n=this.basepath??s?.basepath??"/",r=this.basepath===void 0,i=s?.rewrite;this.options={...s,...e},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(d=>[encodeURIComponent(d),d])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=Es())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new Ms(Mo(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(d=>!["redirected"].includes(d.status))}}}),ao(this));let a=!1;const c=this.options.basepath??"/",u=this.options.rewrite;if(r||n!==c||i!==u){this.basepath=c;const d=[];Mt(c)!==""&&d.push(xo({basepath:c})),u&&d.push(u),this.rewrite=d.length===0?void 0:d.length===1?d[0]:wo(d),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:e,routesByPath:s,flatRoutes:n}=so({routeTree:this.routeTree,initRoute:(i,a)=>{i.init({originalIndex:a})}});this.routesById=e,this.routesByPath=s,this.flatRoutes=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)},this.subscribe=(e,s)=>{const n={eventType:e,fn:s};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(s=>{s.eventType===e.type&&s.fn(e)})},this.parseLocation=(e,s)=>{const n=({href:c,state:u})=>{const l=new URL(c,this.origin),h=ns(this.rewrite,l),d=this.options.parseSearch(h.search),f=this.options.stringifySearch(d);h.search=f;const p=h.href.replace(h.origin,""),{pathname:m,hash:g}=h;return{href:p,publicHref:c,url:h.href,pathname:Me(m),searchStr:f,search:B(s?.search,d),hash:g.split("#").reverse()[0]??"",state:B(s?.state,u)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){const c=n(i);return c.state.key=r.state.key,c.state.__TSR_key=r.state.__TSR_key,delete c.state.__tempLocation,{...c,maskedLocation:r}}return r},this.resolvePathWithBase=(e,s)=>Bs({base:e,to:re(s),trailingSlash:this.options.trailingSlash,parseCache:this.parsePathnameCache}),this.matchRoutes=(e,s,n)=>typeof e=="string"?this.matchRoutesInternal({pathname:e,search:s},n):this.matchRoutesInternal(e,s),this.parsePathnameCache=vo(1e3),this.getMatchedRoutes=(e,s)=>Lo({pathname:e,routePathname:s,caseSensitive:this.options.caseSensitive,routesByPath:this.routesByPath,routesById:this.routesById,flatRoutes:this.flatRoutes,parseCache:this.parsePathnameCache}),this.cancelMatch=e=>{const s=this.getMatch(e);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const e=this.state.matches.filter(r=>r.status==="pending"),s=this.state.matches.filter(r=>r.isFetching==="loader");new Set([...this.state.pendingMatches??[],...e,...s]).forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=e=>{const s=(r={})=>{const i=r._fromLocation||this.pendingBuiltLocation||this.latestLocation,a=this.matchRoutes(i,{_buildLocation:!0}),c=Zt(a);r.from;const u=r.unsafeRelative==="path"?i.pathname:r.from??c.fullPath,l=this.resolvePathWithBase(u,"."),h=c.search,d={...c.params},f=r.to?this.resolvePathWithBase(l,`${r.to}`):this.resolvePathWithBase(l,"."),p=r.params===!1||r.params===null?{}:(r.params??!0)===!0?d:Object.assign(d,Q(r.params,d)),m=Wt({path:f,params:p,parseCache:this.parsePathnameCache}).interpolatedPath,g=this.matchRoutes(m,void 0,{_buildLocation:!0}).map(M=>this.looseRoutesById[M.routeId]);if(Object.keys(p).length>0)for(const M of g){const T=M.options.params?.stringify??M.options.stringifyParams;T&&Object.assign(p,T(p))}const y=e.leaveParams?f:Me(Wt({path:f,params:p,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath);let w=h;if(e._includeValidateSearch&&this.options.search?.strict){const M={};g.forEach(T=>{if(T.options.validateSearch)try{Object.assign(M,ee(T.options.validateSearch,{...M,...w}))}catch{}}),w=M}w=Eo({search:w,dest:r,destRoutes:g,_includeValidateSearch:e._includeValidateSearch}),w=B(h,w);const P=this.options.stringifySearch(w),b=r.hash===!0?i.hash:r.hash?Q(r.hash,i.hash):void 0,E=b?`#${b}`:"";let x=r.state===!0?i.state:r.state?Q(r.state,i.state):{};x=B(i.state,x);const R=`${y}${P}${E}`,S=new URL(R,this.origin),C=rs(this.rewrite,S);return{publicHref:C.pathname+C.search+C.hash,href:R,url:C.href,pathname:y,search:w,searchStr:P,state:x,hash:b??"",unmaskOnReload:r.unmaskOnReload}},n=(r={},i)=>{const a=s(r);let c=i?s(i):void 0;if(!c){let u={};const l=this.options.routeMasks?.find(h=>{const d=Qt(a.pathname,{to:h.from,caseSensitive:!1,fuzzy:!1},this.parsePathnameCache);return d?(u=d,!0):!1});if(l){const{from:h,...d}=l;i={from:e.from,...d,params:u},c=s(i)}}return c&&(a.maskedLocation=c),a};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:s,...n})=>{const r=()=>{const c=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];c.forEach(l=>{n.state[l]=this.latestLocation.state[l]});const u=tt(n.state,this.latestLocation.state);return c.forEach(l=>{delete n.state[l]}),u},i=J(this.latestLocation.href)===J(n.href),a=this.commitLocationPromise;if(this.commitLocationPromise=at(()=>{a?.resolve()}),i&&r())this.load();else{let{maskedLocation:c,hashScrollIntoView:u,...l}=n;c&&(l={...c,state:{...c.state,__tempKey:void 0,__tempLocation:{...l,search:l.searchStr,state:{...l.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(l.unmaskOnReload??this.options.unmaskOnReload??!1)&&(l.state.__tempKey=this.tempLocationKey)),l.state.__hashScrollIntoViewOptions=u??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?"replace":"push"](l.publicHref,l.state,{ignoreBlocker:s})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:s,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...c}={})=>{if(a){const h=this.history.location.state.__TSR_index,d=Tt(a,{__TSR_index:e?h:h+1});c.to=d.pathname,c.search=this.options.parseSearch(d.search),c.hash=d.hash.slice(1)}const u=this.buildLocation({...c,_includeValidateSearch:!0});this.pendingBuiltLocation=u;const l=this.commitLocation({...u,viewTransition:r,replace:e,resetScroll:s,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===u&&(this.pendingBuiltLocation=void 0)}),l},this.navigate=({to:e,reloadDocument:s,href:n,...r})=>{if(!s&&n)try{new URL(`${n}`),s=!0}catch{}return s?(n||(n=this.buildLocation({to:e,...r}).url),r.replace?window.location.replace(n):window.location.href=n,Promise.resolve()):this.buildAndCommitLocation({...r,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const s=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),n=r=>{try{return encodeURI(decodeURI(r))}catch{return r}};if(Mt(n(this.latestLocation.href))!==Mt(n(s.href))){let r=s.url;throw this.origin&&r.startsWith(this.origin)&&(r=r.replace(this.origin,"")||"/"),go({href:r})}}const e=this.matchRoutes(this.latestLocation);this.__store.setState(s=>({...s,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:s.cachedMatches.filter(n=>!e.some(r=>r.id===n.id))}))},this.load=async e=>{let s,n,r;for(r=new Promise(a=>{this.startTransition(async()=>{try{this.beforeLoad();const c=this.latestLocation,u=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...et({resolvedLocation:u,location:c})}),this.emit({type:"onBeforeLoad",...et({resolvedLocation:u,location:c})}),await Oe({router:this,sync:e?.sync,matches:this.state.pendingMatches,location:c,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let l=[],h=[],d=[];vt(()=>{this.__store.setState(f=>{const p=f.matches,m=f.pendingMatches||f.matches;return l=p.filter(g=>!m.some(y=>y.id===g.id)),h=m.filter(g=>!p.some(y=>y.id===g.id)),d=m.filter(g=>p.some(y=>y.id===g.id)),{...f,isLoading:!1,loadedAt:Date.now(),matches:m,pendingMatches:void 0,cachedMatches:[...f.cachedMatches,...l.filter(g=>g.status!=="error")]}}),this.clearExpiredCache()}),[[l,"onLeave"],[h,"onEnter"],[d,"onStay"]].forEach(([f,p])=>{f.forEach(m=>{this.looseRoutesById[m.routeId].options[p]?.(m)})})})})}})}catch(c){j(c)?(s=c,this.isServer||this.navigate({...s.options,replace:!0,ignoreBlocker:!0})):$(c)&&(n=c),this.__store.setState(u=>({...u,statusCode:s?s.status:n?404:u.matches.some(l=>l.status==="error")?500:200,redirect:s}))}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;let i;this.hasNotFoundMatch()?i=404:this.__store.state.matches.some(a=>a.status==="error")&&(i=500),i!==void 0&&this.__store.setState(a=>({...a,statusCode:i}))},this.startViewTransition=e=>{const s=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let n;if(typeof s=="object"&&this.isViewTransitionTypesSupported){const r=this.latestLocation,i=this.state.resolvedLocation,a=typeof s.types=="function"?s.types(et({resolvedLocation:i,location:r})):s.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,s)=>{this.startTransition(()=>{const n=this.state.pendingMatches?.some(r=>r.id===e)?"pendingMatches":this.state.matches.some(r=>r.id===e)?"matches":this.state.cachedMatches.some(r=>r.id===e)?"cachedMatches":"";n&&this.__store.setState(r=>({...r,[n]:r[n]?.map(i=>i.id===e?s(i):i)}))})},this.getMatch=e=>{const s=n=>n.id===e;return this.state.cachedMatches.find(s)??this.state.pendingMatches?.find(s)??this.state.matches.find(s)},this.invalidate=e=>{const s=n=>e?.filter?.(n)??!0?{...n,invalid:!0,...e?.forcePending||n.status==="error"?{status:"pending",error:void 0}:void 0}:n;return this.__store.setState(n=>({...n,matches:n.matches.map(s),cachedMatches:n.cachedMatches.map(s),pendingMatches:n.pendingMatches?.map(s)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{if(!e.options.href){const s=this.buildLocation(e.options);let n=s.url;this.origin&&n.startsWith(this.origin)&&(n=n.replace(this.origin,"")||"/"),e.options.href=s.href,e.headers.set("Location",n)}return e.headers.get("Location")||e.headers.set("Location",e.options.href),e},this.clearCache=e=>{const s=e?.filter;s!==void 0?this.__store.setState(n=>({...n,cachedMatches:n.cachedMatches.filter(r=>!s(r))})):this.__store.setState(n=>({...n,cachedMatches:[]}))},this.clearExpiredCache=()=>{const e=s=>{const n=this.looseRoutesById[s.routeId];if(!n.options.loader)return!0;const r=(s.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return s.status==="error"?!0:Date.now()-s.updatedAt>=r};this.clearCache({filter:e})},this.loadRouteChunk=es,this.preloadRoute=async e=>{const s=this.buildLocation(e);let n=this.matchRoutes(s,{throwOnError:!0,preload:!0,dest:e});const r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(a=>a.id)),i=new Set([...r,...this.state.cachedMatches.map(a=>a.id)]);vt(()=>{n.forEach(a=>{i.has(a.id)||this.__store.setState(c=>({...c,cachedMatches:[...c.cachedMatches,a]}))})});try{return n=await Oe({router:this,matches:n,location:s,preload:!0,updateMatch:(a,c)=>{r.has(a)?n=n.map(u=>u.id===a?c(u):u):this.updateMatch(a,c)}}),n}catch(a){if(j(a))return a.options.reloadDocument?void 0:await this.preloadRoute({...a.options,_fromLocation:s});$(a)||console.error(a);return}},this.matchRoute=(e,s)=>{const n={...e,to:e.to?this.resolvePathWithBase(e.from||"",e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(s?.pending&&this.state.status!=="pending")return!1;const a=(s?.pending===void 0?!this.state.isLoading:s.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,c=Qt(a.pathname,{...s,to:r.pathname},this.parsePathnameCache);return!c||e.params&&!tt(c,e.params,{partial:!0})?!1:c&&(s?.includeSearch??!0)?tt(a.search,r.search,{partial:!0})?c:!1:c},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status==="notFound"||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...o,caseSensitive:o.caseSensitive??!1,notFoundMode:o.notFoundMode??"fuzzy",stringifySearch:o.stringifySearch??fo,parseSearch:o.parseSearch??ho}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(o,e){const{foundRoute:s,matchedRoutes:n,routeParams:r}=this.getMatchedRoutes(o.pathname,e?.dest?.to);let i=!1;(s?s.path!=="/"&&r["**"]:J(o.pathname))&&(this.options.notFoundRoute?n.push(this.options.notFoundRoute):i=!0);const a=(()=>{if(i){if(this.options.notFoundMode!=="root")for(let l=n.length-1;l>=0;l--){const h=n[l];if(h.children)return h.id}return A}})(),c=[],u=l=>l?.id?l.context??this.options.context??void 0:this.options.context??void 0;return n.forEach((l,h)=>{const d=c[h-1],[f,p,m]=(()=>{const I=d?.search??o.search,Y=d?._strictSearch??void 0;try{const D=ee(l.options.validateSearch,{...I})??void 0;return[{...I,...D},{...Y,...D},void 0]}catch(D){let X=D;if(D instanceof At||(X=new At(D.message,{cause:D})),e?.throwOnError)throw X;return[I,{},X]}})(),g=l.options.loaderDeps?.({search:f})??"",y=g?JSON.stringify(g):"",{interpolatedPath:w,usedParams:P}=Wt({path:l.fullPath,params:r,decodeCharMap:this.pathParamsDecodeCharMap}),b=l.id+w+y,E=this.getMatch(b),x=this.state.matches.find(I=>I.routeId===l.id),R=E?._strictParams??P;let S;if(!E){const I=l.options.params?.parse??l.options.parseParams;if(I)try{Object.assign(R,I(R))}catch(Y){if(S=new Co(Y.message,{cause:Y}),e?.throwOnError)throw S}}Object.assign(r,R);const C=x?"stay":"enter";let M;if(E)M={...E,cause:C,params:x?B(x.params,r):r,_strictParams:R,search:B(x?x.search:E.search,f),_strictSearch:p};else{const I=l.options.loader||l.options.beforeLoad||l.lazyFn||ss(l)?"pending":"success";M={id:b,index:h,routeId:l.id,params:x?B(x.params,r):r,_strictParams:R,pathname:w,updatedAt:Date.now(),search:x?B(x.search,f):f,_strictSearch:p,searchError:void 0,status:I,isFetching:!1,error:void 0,paramsError:S,__routeContext:void 0,_nonReactive:{loadPromise:at()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:C,loaderDeps:x?B(x.loaderDeps,g):g,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:l.options.staticData||{},fullPath:l.fullPath}}e?.preload||(M.globalNotFound=a===l.id),M.searchError=m;const T=u(d);M.context={...T,...M.__routeContext,...M.__beforeLoadContext},c.push(M)}),c.forEach((l,h)=>{const d=this.looseRoutesById[l.routeId];if(!this.getMatch(l.id)&&e?._buildLocation!==!0){const p=c[h-1],m=u(p);if(d.options.context){const g={deps:l.loaderDeps,params:l.params,context:m??{},location:o,navigate:y=>this.navigate({...y,_fromLocation:o}),buildLocation:this.buildLocation,cause:l.cause,abortController:l.abortController,preload:!!l.preload,matches:c};l.__routeContext=d.options.context(g)??void 0}l.context={...m,...l.__routeContext,...l.__beforeLoadContext}}}),c}}class At extends Error{}class Co extends Error{}function Mo(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function ee(t,o){if(t==null)return{};if("~standard"in t){const e=t["~standard"].validate(o);if(e instanceof Promise)throw new At("Async validation not supported");if(e.issues)throw new At(JSON.stringify(e.issues,void 0,2),{cause:e});return e.value}return"parse"in t?t.parse(o):typeof t=="function"?t(o):{}}function Lo({pathname:t,routePathname:o,caseSensitive:e,routesByPath:s,routesById:n,flatRoutes:r,parseCache:i}){let a={};const c=J(t),u=f=>Qt(c,{to:f.fullPath,caseSensitive:f.options?.caseSensitive??e,fuzzy:!0},i);let l=o!==void 0?s[o]:void 0;if(l)a=u(l);else{let f;for(const p of r){const m=u(p);if(m)if(p.path!=="/"&&m["**"])f||(f={foundRoute:p,routeParams:m});else{l=p,a=m;break}}!l&&f&&(l=f.foundRoute,a=f.routeParams)}let h=l||n[A];const d=[h];for(;h.parentRoute;)h=h.parentRoute,d.push(h);return d.reverse(),{matchedRoutes:d,routeParams:a,foundRoute:l}}function Eo({search:t,dest:o,destRoutes:e,_includeValidateSearch:s}){const n=e.reduce((a,c)=>{const u=[];if("search"in c.options)c.options.search?.middlewares&&u.push(...c.options.search.middlewares);else if(c.options.preSearchFilters||c.options.postSearchFilters){const l=({search:h,next:d})=>{let f=h;"preSearchFilters"in c.options&&c.options.preSearchFilters&&(f=c.options.preSearchFilters.reduce((m,g)=>g(m),h));const p=d(f);return"postSearchFilters"in c.options&&c.options.postSearchFilters?c.options.postSearchFilters.reduce((m,g)=>g(m),p):p};u.push(l)}if(s&&c.options.validateSearch){const l=({search:h,next:d})=>{const f=d(h);try{return{...f,...ee(c.options.validateSearch,f)??void 0}}catch{return f}};u.push(l)}return a.concat(u)},[])??[],r=({search:a})=>o.search?o.search===!0?a:Q(o.search,a):{};n.push(r);const i=(a,c)=>{if(a>=n.length)return c;const u=n[a];return u({search:c,next:h=>i(a+1,h)})};return i(0,t)}const To="Error preloading route! ☝️";class is{constructor(o){if(this.init=e=>{this.originalIndex=e.originalIndex;const s=this.options,n=!s?.path&&!s?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=A:this.parentRoute||K(!1);let r=n?A:s?.path;r&&r!=="/"&&(r=ie(r));const i=s?.id||r;let a=n?A:U([this.parentRoute.id===A?"":this.parentRoute.id,i]);r===A&&(r="/"),a!==A&&(a=U(["/",a]));const c=a===A?"/":U([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=c,this._to=c},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e=="object"&&e!==null&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.options=o||{},this.isRoot=!o?.getParentRoute,o?.id&&o?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class Io extends is{constructor(o){super(o)}}function ae(t){const o=t.errorComponent??Dt;return v.jsx(Oo,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:e,reset:s})=>e?_.createElement(o,{error:e,reset:s}):t.children})}class Oo extends _.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(o){return{resetKey:o.getResetKey()}}static getDerivedStateFromError(o){return{error:o}}reset(){this.setState({error:null})}componentDidUpdate(o,e){e.error&&e.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(o,e){this.props.onCatch&&this.props.onCatch(o,e)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Dt({error:t}){const[o,e]=_.useState(!1);return v.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[v.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),v.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>e(s=>!s),children:o?"Hide Error":"Show Error"})]}),v.jsx("div",{style:{height:".25rem"}}),o?v.jsx("div",{children:v.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?v.jsx("code",{children:t.message}):null})}):null]})}function ko({children:t,fallback:o=null}){return Fo()?v.jsx(it.Fragment,{children:t}):v.jsx(it.Fragment,{children:o})}function Fo(){return it.useSyncExternalStore(Ao,()=>!0,()=>!1)}function Ao(){return()=>{}}var Ut={exports:{}},Kt={},Ht={exports:{}},qt={};var ke;function Bo(){if(ke)return qt;ke=1;var t=se();function o(h,d){return h===d&&(h!==0||1/h===1/d)||h!==h&&d!==d}var e=typeof Object.is=="function"?Object.is:o,s=t.useState,n=t.useEffect,r=t.useLayoutEffect,i=t.useDebugValue;function a(h,d){var f=d(),p=s({inst:{value:f,getSnapshot:d}}),m=p[0].inst,g=p[1];return r(function(){m.value=f,m.getSnapshot=d,c(m)&&g({inst:m})},[h,f,d]),n(function(){return c(m)&&g({inst:m}),h(function(){c(m)&&g({inst:m})})},[h]),i(f),f}function c(h){var d=h.getSnapshot;h=h.value;try{var f=d();return!e(h,f)}catch{return!0}}function u(h,d){return d()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return qt.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:l,qt}var Fe;function Do(){return Fe||(Fe=1,Ht.exports=Bo()),Ht.exports}var Ae;function zo(){if(Ae)return Kt;Ae=1;var t=se(),o=Do();function e(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var s=typeof Object.is=="function"?Object.is:e,n=o.useSyncExternalStore,r=t.useRef,i=t.useEffect,a=t.useMemo,c=t.useDebugValue;return Kt.useSyncExternalStoreWithSelector=function(u,l,h,d,f){var p=r(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function y(x){if(!w){if(w=!0,P=x,x=d(x),f!==void 0&&m.hasValue){var R=m.value;if(f(R,x))return b=R}return b=x}if(R=b,s(P,x))return R;var S=d(x);return f!==void 0&&f(R,S)?(P=x,R):(P=x,b=S)}var w=!1,P,b,E=h===void 0?null:h;return[function(){return y(l())},E===null?void 0:function(){return y(E())}]},[l,h,d,f]);var g=n(u,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=g},[g]),c(g),g},Kt}var Be;function $o(){return Be||(Be=1,Ut.exports=zo()),Ut.exports}var as=$o();const Tn=oe(as);function jo(t,o=s=>s,e={}){const s=e.equal??No;return as.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,o,s)}function No(t,o){if(Object.is(t,o))return!0;if(typeof t!="object"||t===null||typeof o!="object"||o===null)return!1;if(t instanceof Map&&o instanceof Map){if(t.size!==o.size)return!1;for(const[s,n]of t)if(!o.has(s)||!Object.is(n,o.get(s)))return!1;return!0}if(t instanceof Set&&o instanceof Set){if(t.size!==o.size)return!1;for(const s of t)if(!o.has(s))return!1;return!0}if(t instanceof Date&&o instanceof Date)return t.getTime()===o.getTime();const e=De(t);if(e.length!==De(o).length)return!1;for(let s=0;s"u"?Gt:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=Gt,Gt)}function F(t){const o=_.useContext(cs());return t?.warn,o}function k(t){const o=F({warn:t?.router===void 0}),e=t?.router||o,s=_.useRef(void 0);return jo(e.__store,n=>{if(t?.select){if(t.structuralSharing??e.options.defaultStructuralSharing){const r=B(s.current,t.select(n));return s.current=r,r}return t.select(n)}return n})}const zt=_.createContext(void 0),Wo=_.createContext(void 0);function W(t){const o=_.useContext(t.from?Wo:zt);return k({select:s=>{const n=s.matches.find(r=>t.from?t.from===r.routeId:r.id===o);if(K(!((t.shouldThrow??!0)&&!n),`Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`),n!==void 0)return t.select?t.select(n):n},structuralSharing:t.structuralSharing})}function ce(t){return W({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:o=>t.select?t.select(o.loaderData):o.loaderData})}function le(t){const{select:o,...e}=t;return W({...e,select:s=>o?o(s.loaderDeps):s.loaderDeps})}function ue(t){return W({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:o=>{const e=t.strict===!1?o.params:o._strictParams;return t.select?t.select(e):e}})}function he(t){return W({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:o=>t.select?t.select(o.search):o.search})}function de(t){const o=F();return _.useCallback(e=>o.navigate({...e,from:e.from??t?.from}),[t?.from,o])}var fe=Rs();const In=oe(fe),Ct=typeof window<"u"?_.useLayoutEffect:_.useEffect;function Jt(t){const o=_.useRef({value:t,prev:null}),e=o.current.value;return t!==e&&(o.current={value:t,prev:e}),o.current.prev}function Vo(t,o,e={},s={}){_.useEffect(()=>{if(!t.current||s.disabled||typeof IntersectionObserver!="function")return;const n=new IntersectionObserver(([r])=>{o(r)},e);return n.observe(t.current),()=>{n.disconnect()}},[o,e,s.disabled,t])}function Uo(t){const o=_.useRef(null);return _.useImperativeHandle(t,()=>o.current,[]),o}function Ko(t,o){const e=F(),[s,n]=_.useState(!1),r=_.useRef(!1),i=Uo(o),{activeProps:a,inactiveProps:c,activeOptions:u,to:l,preload:h,preloadDelay:d,hashScrollIntoView:f,replace:p,startTransition:m,resetScroll:g,viewTransition:y,children:w,target:P,disabled:b,style:E,className:x,onClick:R,onFocus:S,onMouseEnter:C,onMouseLeave:M,onTouchStart:T,ignoreBlocker:I,params:Y,search:D,hash:X,state:pe,mask:fs,reloadDocument:xn,unsafeRelative:bn,from:Cn,_fromLocation:Mn,...me}=t,ps=k({select:L=>L.location.search,structuralSharing:!0}),ge=t.from,ht=_.useMemo(()=>({...t,from:ge}),[e,ps,ge,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),V=_.useMemo(()=>e.buildLocation({...ht}),[e,ht]),St=_.useMemo(()=>{if(b)return;let L=V.maskedLocation?V.maskedLocation.url:V.url,O=!1;return e.origin&&(L.startsWith(e.origin)?L=e.history.createHref(L.replace(e.origin,""))||"/":O=!0),{href:L,external:O}},[b,V.maskedLocation,V.url,e.origin,e.history]),_t=_.useMemo(()=>{if(St?.external)return St.href;try{return new URL(l),l}catch{}},[l,St]),ot=t.reloadDocument||_t?!1:h??e.options.defaultPreload,$t=d??e.options.defaultPreloadDelay??0,jt=k({select:L=>{if(_t)return!1;if(u?.exact){if(!Fs(L.location.pathname,V.pathname,e.basepath))return!1}else{const O=Ot(L.location.pathname,e.basepath),z=Ot(V.pathname,e.basepath);if(!(O.startsWith(z)&&(O.length===z.length||O[z.length]==="/")))return!1}return(u?.includeSearch??!0)&&!tt(L.location.search,V.search,{partial:!u?.exact,ignoreUndefined:!u?.explicitUndefined})?!1:u?.includeHash?L.location.hash===V.hash:!0}}),Z=_.useCallback(()=>{e.preloadRoute({...ht}).catch(L=>{console.warn(L),console.warn(To)})},[e,ht]),ms=_.useCallback(L=>{L?.isIntersecting&&Z()},[Z]);Vo(i,ms,Yo,{disabled:!!b||ot!=="viewport"}),_.useEffect(()=>{r.current||!b&&ot==="render"&&(Z(),r.current=!0)},[b,Z,ot]);const gs=L=>{const O=L.currentTarget.getAttribute("target"),z=P!==void 0?P:O;if(!b&&!Xo(L)&&!L.defaultPrevented&&(!z||z==="_self")&&L.button===0){L.preventDefault(),fe.flushSync(()=>{n(!0)});const _e=e.subscribe("onResolved",()=>{_e(),n(!1)});e.navigate({...ht,replace:p,resetScroll:g,hashScrollIntoView:f,startTransition:m,viewTransition:y,ignoreBlocker:I})}};if(_t)return{...me,ref:i,href:_t,...w&&{children:w},...P&&{target:P},...b&&{disabled:b},...E&&{style:E},...x&&{className:x},...R&&{onClick:R},...S&&{onFocus:S},...C&&{onMouseEnter:C},...M&&{onMouseLeave:M},...T&&{onTouchStart:T}};const ve=L=>{b||ot&&Z()},vs=ve,ys=L=>{if(!(b||!ot))if(!$t)Z();else{const O=L.target;if(ft.has(O))return;const z=setTimeout(()=>{ft.delete(O),Z()},$t);ft.set(O,z)}},Ss=L=>{if(b||!ot||!$t)return;const O=L.target,z=ft.get(O);z&&(clearTimeout(z),ft.delete(O))},Rt=jt?Q(a,{})??Ho:Yt,Pt=jt?Yt:Q(c,{})??Yt,ye=[x,Rt.className,Pt.className].filter(Boolean).join(" "),Se=(E||Rt.style||Pt.style)&&{...E,...Rt.style,...Pt.style};return{...me,...Rt,...Pt,href:St?.href,ref:i,onClick:pt([R,gs]),onFocus:pt([S,ve]),onMouseEnter:pt([C,ys]),onMouseLeave:pt([M,Ss]),onTouchStart:pt([T,vs]),disabled:!!b,target:P,...Se&&{style:Se},...ye&&{className:ye},...b&&qo,...jt&&Go,...s&&Jo}}const Yt={},Ho={className:"active"},qo={role:"link","aria-disabled":!0},Go={"data-status":"active","aria-current":"page"},Jo={"data-transitioning":"transitioning"},ft=new WeakMap,Yo={rootMargin:"100px"},pt=t=>o=>{for(const e of t)if(e){if(o.defaultPrevented)return;e(o)}},ls=_.forwardRef((t,o)=>{const{_asChild:e,...s}=t,{type:n,ref:r,...i}=Ko(s,o),a=typeof s.children=="function"?s.children({isActive:i["data-status"]==="active"}):s.children;return e===void 0&&delete i.disabled,_.createElement(e||"a",{...i,ref:r},a)});function Xo(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}class Zo extends is{constructor(o){super(o),this.useMatch=e=>W({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>W({...e,from:this.id,select:s=>e?.select?e.select(s.context):s.context}),this.useSearch=e=>he({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ue({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>le({...e,from:this.id}),this.useLoaderData=e=>ce({...e,from:this.id}),this.useNavigate=()=>de({from:this.fullPath}),this.Link=it.forwardRef((e,s)=>v.jsx(ls,{ref:s,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function Qo(t){return new Zo(t)}class tn extends Io{constructor(o){super(o),this.useMatch=e=>W({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>W({...e,from:this.id,select:s=>e?.select?e.select(s.context):s.context}),this.useSearch=e=>he({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ue({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>le({...e,from:this.id}),this.useLoaderData=e=>ce({...e,from:this.id}),this.useNavigate=()=>de({from:this.fullPath}),this.Link=it.forwardRef((e,s)=>v.jsx(ls,{ref:s,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function On(t){return new tn(t)}function ze(t){return typeof t=="object"?new $e(t,{silent:!0}).createRoute(t):new $e(t,{silent:!0}).createRoute}class $e{constructor(o,e){this.path=o,this.createRoute=s=>{this.silent;const n=Qo(s);return n.isRoot=!1,n},this.silent=e?.silent}}class je{constructor(o){this.useMatch=e=>W({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>W({from:this.options.id,select:s=>e?.select?e.select(s.context):s.context}),this.useSearch=e=>he({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>ue({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>le({...e,from:this.options.id}),this.useLoaderData=e=>ce({...e,from:this.options.id}),this.useNavigate=()=>{const e=F();return de({from:e.routesById[this.options.id].fullPath})},this.options=o,this.$$typeof=Symbol.for("react.memo")}}function Ne(t){return typeof t=="object"?new je(t):o=>new je({id:t,...o})}function en(){const t=F(),o=_.useRef({router:t,mounted:!1}),[e,s]=_.useState(!1),{hasPendingMatches:n,isLoading:r}=k({select:h=>({isLoading:h.isLoading,hasPendingMatches:h.matches.some(d=>d.status==="pending")}),structuralSharing:!0}),i=Jt(r),a=r||e||n,c=Jt(a),u=r||n,l=Jt(u);return t.startTransition=h=>{s(!0),_.startTransition(()=>{h(),s(!1)})},_.useEffect(()=>{const h=t.history.subscribe(t.load),d=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return J(t.latestLocation.href)!==J(d.href)&&t.commitLocation({...d,replace:!0}),()=>{h()}},[t,t.history]),Ct(()=>{if(typeof window<"u"&&t.ssr||o.current.router===t&&o.current.mounted)return;o.current={router:t,mounted:!0},(async()=>{try{await t.load()}catch(d){console.error(d)}})()},[t]),Ct(()=>{i&&!r&&t.emit({type:"onLoad",...et(t.state)})},[i,t,r]),Ct(()=>{l&&!u&&t.emit({type:"onBeforeRouteMount",...et(t.state)})},[u,l,t]),Ct(()=>{c&&!a&&(t.emit({type:"onResolved",...et(t.state)}),t.__store.setState(h=>({...h,status:"idle",resolvedLocation:h.location})),co(t))},[a,c,t]),null}function sn(t){const o=k({select:e=>`not-found-${e.location.pathname}-${e.status}`});return v.jsx(ae,{getResetKey:()=>o,onCatch:(e,s)=>{if($(e))t.onCatch?.(e,s);else throw e},errorComponent:({error:e})=>{if($(e))return t.fallback?.(e);throw e},children:t.children})}function on(){return v.jsx("p",{children:"Not Found"})}function rt(t){return v.jsx(v.Fragment,{children:t.children})}function us(t,o,e){return o.options.notFoundComponent?v.jsx(o.options.notFoundComponent,{data:e}):t.options.defaultNotFoundComponent?v.jsx(t.options.defaultNotFoundComponent,{data:e}):v.jsx(on,{})}function nn({children:t}){const o=F();return o.isServer?v.jsx("script",{nonce:o.options.ssr?.nonce,className:"$tsr",dangerouslySetInnerHTML:{__html:[t].filter(Boolean).join(` -`)+";$_TSR.c()"}}):null}function rn(){const t=F();if(!t.isScrollRestoring||!t.isServer||typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return null;const e=(t.options.getScrollRestorationKey||te)(t.latestLocation),s=e!==te(t.latestLocation)?e:void 0,n={storageKey:kt,shouldScrollRestoration:!0};return s&&(n.key=s),v.jsx(nn,{children:`(${Ye.toString()})(${JSON.stringify(n)})`})}const hs=_.memo(function({matchId:o}){const e=F(),s=k({select:y=>{const w=y.matches.find(P=>P.id===o);return K(w),{routeId:w.routeId,ssr:w.ssr,_displayPending:w._displayPending}},structuralSharing:!0}),n=e.routesById[s.routeId],r=n.options.pendingComponent??e.options.defaultPendingComponent,i=r?v.jsx(r,{}):null,a=n.options.errorComponent??e.options.defaultErrorComponent,c=n.options.onCatch??e.options.defaultOnCatch,u=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,l=s.ssr===!1||s.ssr==="data-only",h=(!n.isRoot||n.options.wrapInSuspense||l)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||l))?_.Suspense:rt,d=a?ae:rt,f=u?sn:rt,p=k({select:y=>y.loadedAt}),m=k({select:y=>{const w=y.matches.findIndex(P=>P.id===o);return y.matches[w-1]?.routeId}}),g=n.isRoot?n.options.shellComponent??rt:rt;return v.jsxs(g,{children:[v.jsx(zt.Provider,{value:o,children:v.jsx(h,{fallback:i,children:v.jsx(d,{getResetKey:()=>p,errorComponent:a||Dt,onCatch:(y,w)=>{if($(y))throw y;c?.(y,w)},children:v.jsx(f,{fallback:y=>{if(!u||y.routeId&&y.routeId!==s.routeId||!y.routeId&&!n.isRoot)throw y;return _.createElement(u,y)},children:l||s._displayPending?v.jsx(ko,{fallback:i,children:v.jsx(We,{matchId:o})}):v.jsx(We,{matchId:o})})})})}),m===A&&e.options.scrollRestoration?v.jsxs(v.Fragment,{children:[v.jsx(an,{}),v.jsx(rn,{})]}):null]})});function an(){const t=F(),o=_.useRef(void 0);return v.jsx("script",{suppressHydrationWarning:!0,ref:e=>{e&&(o.current===void 0||o.current.href!==t.latestLocation.href)&&(t.emit({type:"onRendered",...et(t.state)}),o.current=t.latestLocation)}},t.latestLocation.state.__TSR_key)}const We=_.memo(function({matchId:o}){const e=F(),{match:s,key:n,routeId:r}=k({select:c=>{const u=c.matches.find(p=>p.id===o),l=u.routeId,d=(e.routesById[l].options.remountDeps??e.options.defaultRemountDeps)?.({routeId:l,loaderDeps:u.loaderDeps,params:u._strictParams,search:u._strictSearch});return{key:d?JSON.stringify(d):void 0,routeId:l,match:{id:u.id,status:u.status,error:u.error,_forcePending:u._forcePending,_displayPending:u._displayPending}}},structuralSharing:!0}),i=e.routesById[r],a=_.useMemo(()=>{const c=i.options.component??e.options.defaultComponent;return c?v.jsx(c,{},n):v.jsx(cn,{})},[n,i.options.component,e.options.defaultComponent]);if(s._displayPending)throw e.getMatch(s.id)?._nonReactive.displayPendingPromise;if(s._forcePending)throw e.getMatch(s.id)?._nonReactive.minPendingPromise;if(s.status==="pending"){const c=i.options.pendingMinMs??e.options.defaultPendingMinMs;if(c){const u=e.getMatch(s.id);if(u&&!u._nonReactive.minPendingPromise&&!e.isServer){const l=at();u._nonReactive.minPendingPromise=l,setTimeout(()=>{l.resolve(),u._nonReactive.minPendingPromise=void 0},c)}}throw e.getMatch(s.id)?._nonReactive.loadPromise}if(s.status==="notFound")return K($(s.error)),us(e,i,s.error);if(s.status==="redirected")throw K(j(s.error)),e.getMatch(s.id)?._nonReactive.loadPromise;if(s.status==="error"){if(e.isServer){const c=(i.options.errorComponent??e.options.defaultErrorComponent)||Dt;return v.jsx(c,{error:s.error,reset:void 0,info:{componentStack:""}})}throw s.error}return a}),cn=_.memo(function(){const o=F(),e=_.useContext(zt),s=k({select:u=>u.matches.find(l=>l.id===e)?.routeId}),n=o.routesById[s],r=k({select:u=>{const h=u.matches.find(d=>d.id===e);return K(h),h.globalNotFound}}),i=k({select:u=>{const l=u.matches,h=l.findIndex(d=>d.id===e);return l[h+1]?.id}}),a=o.options.defaultPendingComponent?v.jsx(o.options.defaultPendingComponent,{}):null;if(r)return us(o,n,void 0);if(!i)return null;const c=v.jsx(hs,{matchId:i});return s===A?v.jsx(_.Suspense,{fallback:a,children:c}):c});function ln(){const t=F(),e=t.routesById[A].options.pendingComponent??t.options.defaultPendingComponent,s=e?v.jsx(e,{}):null,n=t.isServer||typeof document<"u"&&t.ssr?rt:_.Suspense,r=v.jsxs(n,{fallback:s,children:[!t.isServer&&v.jsx(en,{}),v.jsx(un,{})]});return t.options.InnerWrap?v.jsx(t.options.InnerWrap,{children:r}):r}function un(){const t=F(),o=k({select:n=>n.matches[0]?.id}),e=k({select:n=>n.loadedAt}),s=o?v.jsx(hs,{matchId:o}):null;return v.jsx(zt.Provider,{value:o,children:t.options.disableGlobalCatchBoundary?s:v.jsx(ae,{getResetKey:()=>e,errorComponent:Dt,onCatch:n=>{n.message||n.toString()},children:s})})}function kn(){const t=F();return k({select:o=>[o.location.href,o.resolvedLocation?.href,o.status],structuralSharing:!0}),_.useCallback(o=>{const{pending:e,caseSensitive:s,fuzzy:n,includeSearch:r,...i}=o;return t.matchRoute(i,{pending:e,caseSensitive:s,fuzzy:n,includeSearch:r})},[t])}const Fn=t=>new hn(t);class hn extends bo{constructor(o){super(o)}}typeof globalThis<"u"?(globalThis.createFileRoute=ze,globalThis.createLazyFileRoute=Ne):typeof window<"u"&&(window.createFileRoute=ze,window.createLazyFileRoute=Ne);function dn({router:t,children:o,...e}){Object.keys(e).length>0&&t.update({...t.options,...e,context:{...t.options.context,...e.context}});const s=cs(),n=v.jsx(s.Provider,{value:t,children:o});return t.options.Wrap?v.jsx(t.options.Wrap,{children:n}):n}function An({router:t,...o}){return v.jsx(dn,{router:t,...o,children:v.jsx(ln,{})})}function nt(t,o,e){let s=e.initialDeps??[],n;function r(){var i,a,c,u;let l;e.key&&((i=e.debug)!=null&&i.call(e))&&(l=Date.now());const h=t();if(!(h.length!==s.length||h.some((p,m)=>s[m]!==p)))return n;s=h;let f;if(e.key&&((a=e.debug)!=null&&a.call(e))&&(f=Date.now()),n=o(...h),e.key&&((c=e.debug)!=null&&c.call(e))){const p=Math.round((Date.now()-l)*100)/100,m=Math.round((Date.now()-f)*100)/100,g=m/16,y=(w,P)=>{for(w=String(w);w.length{s=i},r}function Ve(t,o){if(t===void 0)throw new Error("Unexpected undefined");return t}const fn=(t,o)=>Math.abs(t-o)<1.01,pn=(t,o,e)=>{let s;return function(...n){t.clearTimeout(s),s=t.setTimeout(()=>o.apply(this,n),e)}},Ue=t=>{const{offsetWidth:o,offsetHeight:e}=t;return{width:o,height:e}},mn=t=>t,gn=t=>{const o=Math.max(t.startIndex-t.overscan,0),e=Math.min(t.endIndex+t.overscan,t.count-1),s=[];for(let n=o;n<=e;n++)s.push(n);return s},vn=(t,o)=>{const e=t.scrollElement;if(!e)return;const s=t.targetWindow;if(!s)return;const n=i=>{const{width:a,height:c}=i;o({width:Math.round(a),height:Math.round(c)})};if(n(Ue(e)),!s.ResizeObserver)return()=>{};const r=new s.ResizeObserver(i=>{const a=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){n({width:u.inlineSize,height:u.blockSize});return}}n(Ue(e))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return r.observe(e,{box:"border-box"}),()=>{r.unobserve(e)}},Ke={passive:!0},He=typeof window>"u"?!0:"onscrollend"in window,yn=(t,o)=>{const e=t.scrollElement;if(!e)return;const s=t.targetWindow;if(!s)return;let n=0;const r=t.options.useScrollendEvent&&He?()=>{}:pn(s,()=>{o(n,!1)},t.options.isScrollingResetDelay),i=l=>()=>{const{horizontal:h,isRtl:d}=t.options;n=h?e.scrollLeft*(d&&-1||1):e.scrollTop,r(),o(n,l)},a=i(!0),c=i(!1);c(),e.addEventListener("scroll",a,Ke);const u=t.options.useScrollendEvent&&He;return u&&e.addEventListener("scrollend",c,Ke),()=>{e.removeEventListener("scroll",a),u&&e.removeEventListener("scrollend",c)}},Sn=(t,o,e)=>{if(o?.borderBoxSize){const s=o.borderBoxSize[0];if(s)return Math.round(s[e.options.horizontal?"inlineSize":"blockSize"])}return t[e.options.horizontal?"offsetWidth":"offsetHeight"]},_n=(t,{adjustments:o=0,behavior:e},s)=>{var n,r;const i=t+o;(r=(n=s.scrollElement)==null?void 0:n.scrollTo)==null||r.call(n,{[s.options.horizontal?"left":"top"]:i,behavior:e})};class Rn{constructor(o){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const s=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(n=>{n.forEach(r=>{const i=()=>{this._measureElement(r.target,r)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var n;(n=s())==null||n.disconnect(),e=null},observe:n=>{var r;return(r=s())==null?void 0:r.observe(n,{box:"border-box"})},unobserve:n=>{var r;return(r=s())==null?void 0:r.unobserve(n)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([s,n])=>{typeof n>"u"&&delete e[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:mn,rangeExtractor:gn,onChange:()=>{},measureElement:Sn,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var s,n;(n=(s=this.options).onChange)==null||n.call(s,this,e)},this.maybeNotify=nt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(n,r)=>{this.scrollAdjustments=0,this.scrollDirection=r?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,s)=>{const n=new Map,r=new Map;for(let i=s-1;i>=0;i--){const a=e[i];if(n.has(a.lane))continue;const c=r.get(a.lane);if(c==null||a.end>c.end?r.set(a.lane,a):a.endi.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=nt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(e,s,n,r,i)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:n,getItemKey:r,enabled:i}),{key:!1}),this.getMeasurements=nt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:n,getItemKey:r,enabled:i},a)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(l=>{this.itemSizeCache.set(l.key,l.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,c);for(let l=c;lthis.options.debug}),this.calculateRange=nt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,n,r)=>this.range=e.length>0&&s>0?Pn({measurements:e,outerSize:s,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=nt(()=>{let e=null,s=null;const n=this.calculateRange();return n&&(e=n.startIndex,s=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,s]},(e,s,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:s,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const s=this.options.indexAttribute,n=e.getAttribute(s);return n?parseInt(n,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(e,s)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const i=r.key,a=this.elementsCache.get(i);a!==e&&(a&&this.observer.unobserve(a),this.observer.observe(e),this.elementsCache.set(i,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,s,this))},this.resizeItem=(e,s)=>{const n=this.measurementsCache[e];if(!n)return;const r=this.itemSizeCache.get(n.key)??n.size,i=s-r;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,i,this):n.start{if(!e){this.elementsCache.forEach((s,n)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(n))});return}this._measureElement(e,void 0)},this.getVirtualItems=nt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const n=[];for(let r=0,i=e.length;rthis.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return Ve(s[ds(0,s.length-1,n=>Ve(s[n]).start,e)])},this.getOffsetForAlignment=(e,s,n=0)=>{const r=this.getSize(),i=this.getScrollOffset();s==="auto"&&(s=e>=i+r?"end":"start"),s==="center"?e+=(n-r)/2:s==="end"&&(e-=r);const a=this.getTotalSize()+this.options.scrollMargin-r;return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,s="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.measurementsCache[e];if(!n)return;const r=this.getSize(),i=this.getScrollOffset();if(s==="auto")if(n.end>=i+r-this.options.scrollPaddingEnd)s="end";else if(n.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];const a=s==="end"?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,n.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:s="start",behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,s),{adjustments:void 0,behavior:n})},this.scrollToIndex=(e,{align:s="auto",behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let r=0;const i=10,a=u=>{if(!this.targetWindow)return;const l=this.getOffsetForIndex(e,u);if(!l){console.warn("Failed to get offset for index:",e);return}const[h,d]=l;this._scrollToOffset(h,{adjustments:void 0,behavior:n}),this.targetWindow.requestAnimationFrame(()=>{const f=this.getScrollOffset(),p=this.getOffsetForIndex(e,d);if(!p){console.warn("Failed to get offset for index:",e);return}fn(p[0],f)||c(d)})},c=u=>{this.targetWindow&&(r++,ra(u)):console.warn(`Failed to scroll to index ${e} after ${i} attempts.`))};a(s)},this.scrollBy=(e,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var e;const s=this.getMeasurements();let n;if(s.length===0)n=this.options.paddingStart;else if(this.options.lanes===1)n=((e=s[s.length-1])==null?void 0:e.end)??0;else{const r=Array(this.options.lanes).fill(null);let i=s.length-1;for(;i>=0&&r.some(a=>a===null);){const a=s[i];r[a.lane]===null&&(r[a.lane]=a.end),i--}n=Math.max(...r.filter(a=>a!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:s,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(o)}}const ds=(t,o,e,s)=>{for(;t<=o;){const n=(t+o)/2|0,r=e(n);if(rs)o=n-1;else return n}return t>0?t-1:0};function Pn({measurements:t,outerSize:o,scrollOffset:e,lanes:s}){const n=t.length-1,r=c=>t[c].start;if(t.length<=s)return{startIndex:0,endIndex:n};let i=ds(0,n,r,e),a=i;if(s===1)for(;a1){const c=Array(s).fill(0);for(;al=0&&u.some(l=>l>=e);){const l=t[i];u[l.lane]=l.start,i--}i=Math.max(0,i-i%s),a=Math.min(n,a+(s-1-a%s))}return{startIndex:i,endIndex:a}}const qe=typeof document<"u"?_.useLayoutEffect:_.useEffect;function wn(t){const o=_.useReducer(()=>({}),{})[1],e={...t,onChange:(n,r)=>{var i;r?fe.flushSync(o):o(),(i=t.onChange)==null||i.call(t,n,r)}},[s]=_.useState(()=>new Rn(e));return s.setOptions(e),qe(()=>s._didMount(),[]),qe(()=>s._willUpdate()),s}function Bn(t){return wn({observeElementRect:vn,observeElementOffset:yn,scrollToFn:_n,...t})}export{ls as L,cn as O,it as R,En as a,fe as b,In as c,Do as d,de as e,Bn as f,kn as g,On as h,K as i,v as j,Qo as k,Fn as l,go as m,An as n,_ as r,Tn as u}; diff --git a/webui/dist/assets/uppy-BMZiFQyG.js b/webui/dist/assets/uppy-BMZiFQyG.js new file mode 100644 index 00000000..0743af8a --- /dev/null +++ b/webui/dist/assets/uppy-BMZiFQyG.js @@ -0,0 +1,11 @@ +import{g as re}from"./react-vendor-BmxF9s7Q.js";import{r as Ti,a as gs,b as ys}from"./reactflow-DLoXAt4c.js";import"./router-Bz250laD.js";import"./charts-DbiuC1q1.js";import"./radix-extra-DDK-u9dm.js";const bs=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function vs(i,e,t){const s=bs.exec(i),n=e.mimeType??s?.[1]??"plain/text";let r;if(s?.[2]!=null){const a=atob(decodeURIComponent(s[3])),o=new Uint8Array(a.length);for(let d=0;d(e+=`-${_s(t)}`,"/"))+e}function Fs(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${Nt(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${Nt(i.meta.relativePath.toLowerCase())}`),i.data?.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function Ss(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Ts(i,e){if(Ss(i))return i.id;const t=ki(i);return Fs({...i,type:t},e)}const ue=Array.from;function Ps(i){const e=ue(i.files);return Promise.resolve(e)}function Ai(i,e,t,{onSuccess:s}){i.readEntries(n=>{const r=[...e,...n];n.length?queueMicrotask(()=>{Ai(i,r,t,{onSuccess:s})}):s(r)},n=>{t(n),s(e)})}function Oi(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,s)=>i.file(t,s))},async*values(){const t=i.createReader();yield*await new Promise(n=>{Ai(t,[],e,{onSuccess:r=>n(r.map(a=>Oi(a,e)))})})},isSameEntry:void 0}}async function*Ui(i,e,t=void 0){const s=()=>`${e}/${i.name}`;if(i.kind==="file"){const n=await i.getFile();n!=null?(n.relativePath=e?s():null,yield n):t!=null&&(yield t)}else if(i.kind==="directory")for await(const n of i.values())yield*Ui(n,e?s():i.name);else t!=null&&(yield t)}async function*Cs(i,e){const t=await Promise.all(Array.from(i.items,async s=>{let n;return n??=Oi(typeof s.getAsEntry=="function"?s.getAsEntry():s.webkitGetAsEntry(),e),{fileSystemHandle:n,lastResortFile:s.getAsFile()}}));for(const{lastResortFile:s,fileSystemHandle:n}of t)if(n!=null)try{yield*Ui(n,"",s)}catch(r){s!=null?yield s:e(r)}else s!=null&&(yield s)}async function Es(i,e){const t=e?.logDropError??Function.prototype;try{const s=[];for await(const n of Cs(i,t))s.push(n);return s}catch{return Ps(i)}}function ks(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}function Me(i){return i<10?`0${i}`:i.toString()}function Oe(){const i=new Date,e=Me(i.getHours()),t=Me(i.getMinutes()),s=Me(i.getSeconds());return`${e}:${t}:${s}`}function As(){if(typeof window>"u")return!1;const i=document.body;return!(i==null||window==null||!("draggable"in i)||!("ondragstart"in i)||!("ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}function Dt(i){return i.startsWith("blob:")}function It(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function Os(i){const e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,s=Math.floor(i%60);return{hours:e,minutes:t,seconds:s}}function Us(i){const e=Os(i),t=e.hours===0?"":`${e.hours}h`,s=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,n=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${s}${n}`}function Ns(i,e,t){const s=[];return i.forEach(n=>typeof n!="string"?s.push(n):e[Symbol.split](n).forEach((r,a,o)=>{r!==""&&s.push(r),a{throw new Error(`missing string: ${i}`)};class Ni{locale;constructor(e,{onMissingKey:t=Ds}={}){this.locale={strings:{},pluralize(s){return s===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(e){if(!e?.strings)return;const t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let s=this.locale.strings[e];if(s==null&&(this.#e(e),s=e),typeof s=="object"){if(t&&typeof t.smart_count<"u"){const r=this.locale.pluralize(t.smart_count);return xt(s[r],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof s!="string")throw new Error("string was not a string");return xt(s,t)}}const Be="...";function Di(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=Be.length+1)return`${i.slice(0,e-1)}…`;const t=e-Be.length,s=Math.ceil(t/2),n=Math.floor(t/2);return i.slice(0,s)+Be+i.slice(-n)}var ye,T,Ii,Q,Mt,xi,Mi,Bi,ut,tt,it,ce={},Ri=[],Is=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,be=Array.isArray;function V(i,e){for(var t in e)i[t]=e[t];return i}function ht(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function ct(i,e,t){var s,n,r,a={};for(r in e)r=="key"?s=e[r]:r=="ref"?n=e[r]:a[r]=e[r];if(arguments.length>2&&(a.children=arguments.length>3?ye.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(r in i.defaultProps)a[r]===void 0&&(a[r]=i.defaultProps[r]);return he(i,a,s,n,null)}function he(i,e,t,s,n){var r={type:i,props:e,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++Ii,__i:-1,__u:0};return n==null&&T.vnode!=null&&T.vnode(r),r}function xs(){return{current:null}}function G(i){return i.children}function W(i,e){this.props=i,this.context=e}function se(i,e){if(e==null)return i.__?se(i.__,i.__i+1):null;for(var t;eo&&Q.sort(Mi),i=Q.shift(),o=Q.length,i.__d&&(t=void 0,s=void 0,n=(s=(e=i).__v).__e,r=[],a=[],e.__P&&((t=V({},s)).__v=s.__v+1,T.vnode&&T.vnode(t),pt(e.__P,t,s,e.__n,e.__P.namespaceURI,32&s.__u?[n]:null,r,n??se(s),!!(32&s.__u),a),t.__v=s.__v,t.__.__k[t.__i]=t,Hi(r,t,a),s.__e=s.__=null,t.__e!=n&&Li(t)));Ne.__r=0}function zi(i,e,t,s,n,r,a,o,d,u,c){var h,p,f,m,y,v,b,g=s&&s.__k||Ri,w=e.length;for(d=Ms(t,e,g,d,w),h=0;h0?he(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=i,a.__b=i.__b+1,o=null,(u=a.__i=Bs(a,t,d,h))!=-1&&(h--,(o=t[u])&&(o.__u|=2)),o==null||o.__v==null?(u==-1&&(n>c?p--:nd?p--:p++,a.__u|=4))):i.__k[r]=null;if(h)for(r=0;r(c?1:0)){for(n=t-1,r=t+1;n>=0||r=0?n--:r++])!=null&&(2&u.__u)==0&&o==u.key&&d==u.type)return a}return-1}function Rt(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||Is.test(e)?t:t+"px"}function we(i,e,t,s,n){var r,a;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof s=="string"&&(i.style.cssText=s=""),s)for(e in s)t&&e in t||Rt(i.style,e,"");if(t)for(e in t)s&&t[e]==s[e]||Rt(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(Bi,"$1")),a=e.toLowerCase(),e=a in i||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+r]=t,t?s?t.u=s.u:(t.u=ut,i.addEventListener(e,r?it:tt,r)):i.removeEventListener(e,r?it:tt,r);else{if(n=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Lt(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=ut++;else if(e.t0?i:be(i)?i.map(qi):V({},i)}function Rs(i,e,t,s,n,r,a,o,d){var u,c,h,p,f,m,y,v=t.props,b=e.props,g=e.type;if(g=="svg"?n="http://www.w3.org/2000/svg":g=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),r!=null){for(u=0;u2&&(o.children=arguments.length>3?ye.call(arguments,2):t),he(i.type,o,s||i.key,n||i.ref,null)}ye=Ri.slice,T={__e:function(i,e,t,s){for(var n,r,a;e=e.__;)if((n=e.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(i)),a=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(i,s||{}),a=n.__d),a)return n.__E=n}catch(o){i=o}throw i}},Ii=0,W.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=V({},this.state),typeof i=="function"&&(i=i(V({},t),this.props)),i&&V(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Bt(this))},W.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Bt(this))},W.prototype.render=G,Q=[],xi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mi=function(i,e){return i.__v.__b-e.__v.__b},Ne.__r=0,Bi=/(PointerCapture)$|Capture$/i,ut=0,tt=Lt(!1),it=Lt(!0);var zs=0;function l(i,e,t,s,n,r){e||(e={});var a,o,d=e;if("ref"in d)for(o in d={},e)o=="ref"?a=e[o]:d[o]=e[o];var u={type:i,props:d,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--zs,__i:-1,__u:0,__source:n,__self:r};if(typeof i=="function"&&(a=i.defaultProps))for(o in a)d[o]===void 0&&(d[o]=a[o]);return T.vnode&&T.vnode(u),u}var pe,k,Re,$t,fe=0,Wi=[],O=T,Ht=O.__b,qt=O.__r,jt=O.diffed,Vt=O.__c,Wt=O.unmount,Gt=O.__;function mt(i,e){O.__h&&O.__h(k,i,fe||e),fe=0;var t=k.__H||(k.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function ne(i){return fe=1,$s(Ki,i)}function $s(i,e,t){var s=mt(pe++,2);if(s.t=i,!s.__c&&(s.__=[Ki(void 0,e),function(o){var d=s.__N?s.__N[0]:s.__[0],u=s.t(d,o);d!==u&&(s.__N=[u,s.__[1]],s.__c.setState({}))}],s.__c=k,!k.__f)){var n=function(o,d,u){if(!s.__c.__H)return!0;var c=s.__c.__H.__.filter(function(p){return!!p.__c});if(c.every(function(p){return!p.__N}))return!r||r.call(this,o,d,u);var h=s.__c.props!==o;return c.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(h=!0)}}),r&&r.call(this,o,d,u)||h};k.__f=!0;var r=k.shouldComponentUpdate,a=k.componentWillUpdate;k.componentWillUpdate=function(o,d,u){if(this.__e){var c=r;r=void 0,n(o,d,u),r=c}a&&a.call(this,o,d,u)},k.shouldComponentUpdate=n}return s.__N||s.__}function De(i,e){var t=mt(pe++,3);!O.__s&&Gi(t.__H,e)&&(t.__=i,t.u=e,k.__H.__h.push(t))}function ie(i){return fe=5,gt(function(){return{current:i}},[])}function gt(i,e){var t=mt(pe++,7);return Gi(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function Ie(i,e){return fe=8,gt(function(){return i},e)}function Hs(){for(var i;i=Wi.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(Ue),i.__H.__h.forEach(nt),i.__H.__h=[]}catch(e){i.__H.__h=[],O.__e(e,i.__v)}}O.__b=function(i){k=null,Ht&&Ht(i)},O.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Gt&&Gt(i,e)},O.__r=function(i){qt&&qt(i),pe=0;var e=(k=i.__c).__H;e&&(Re===k?(e.__h=[],k.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Ue),e.__h.forEach(nt),e.__h=[],pe=0)),Re=k},O.diffed=function(i){jt&&jt(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Wi.push(e)!==1&&$t===O.requestAnimationFrame||(($t=O.requestAnimationFrame)||qs)(Hs)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Re=k=null},O.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Ue),t.__h=t.__h.filter(function(s){return!s.__||nt(s)})}catch(s){e.some(function(n){n.__h&&(n.__h=[])}),e=[],O.__e(s,t.__v)}}),Vt&&Vt(i,e)},O.unmount=function(i){Wt&&Wt(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(s){try{Ue(s)}catch(n){e=n}}),t.__H=void 0,e&&O.__e(e,t.__v))};var Kt=typeof requestAnimationFrame=="function";function qs(i){var e,t=function(){clearTimeout(s),Kt&&cancelAnimationFrame(e),setTimeout(i)},s=setTimeout(t,35);Kt&&(e=requestAnimationFrame(t))}function Ue(i){var e=k,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),k=e}function nt(i){var e=k;i.__c=i.__(),k=e}function Gi(i,e){return!i||i.length!==e.length||e.some(function(t,s){return t!==i[s]})}function Ki(i,e){return typeof e=="function"?e(i):e}const js={position:"relative",width:"100%",minHeight:"100%"},Vs={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function Ws({data:i,rowHeight:e,renderRow:t,overscanCount:s=10,padding:n=4,...r}){const a=ie(null),[o,d]=ne(0),[u,c]=ne(0);De(()=>{function g(){a.current!=null&&u!==a.current.offsetHeight&&c(a.current.offsetHeight)}return g(),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[u]);const h=Ie(()=>{a.current&&d(a.current.scrollTop)},[]);let p=Math.floor(o/e),f=Math.floor(u/e);s&&(p=Math.max(0,p-p%s),f+=s);const m=p+f+n,y=i.slice(p,m),v={...js,height:i.length*e},b={...Vs,top:p*e};return l("div",{onScroll:h,ref:a,...r,children:l("div",{role:"presentation",style:v,children:l("div",{role:"presentation",style:b,children:y.map(t)})})})}class Gs{uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){const{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const e=new Ni([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}}const Ks={debug:()=>{},warn:()=>{},error:(...i)=>console.error(`[Uppy] [${Oe()}]`,...i)},Xs={debug:(...i)=>console.debug(`[Uppy] [${Oe()}]`,...i),warn:(...i)=>console.warn(`[Uppy] [${Oe()}]`,...i),error:(...i)=>console.error(`[Uppy] [${Oe()}]`,...i)};var Le,Xt;function Ys(){return Xt||(Xt=1,Le=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);const t=e<0;let s=Math.abs(e);if(t&&(s=-s),s===0)return"0 B";const n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.min(Math.floor(Math.log(s)/Math.log(1024)),n.length-1),a=Number(s/1024**r),o=n[r];return`${a>=10||a%1===0?Math.round(a):a.toFixed(1)} ${o}`}),Le}var Qs=Ys();const J=re(Qs);var ze,Yt;function Js(){if(Yt)return ze;Yt=1;function i(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return i.prototype.match=function(e){var t=!0,s=this.parts,n,r=s.length,a;if(typeof e=="string"||e instanceof String)if(!this.hasWild&&this.text!=e)t=!1;else{for(a=(e||"").split(this.separator),n=0;t&&n=2}return s?n(s.split(";")[0]):n},$e}var en=Zs();const tn=re(en),sn={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class R extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0}class nn{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{const s=e();if(s.restrictions?.allowedFileTypes!=null&&!Array.isArray(s.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return s}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:s,maxNumberOfFiles:n}=this.getOpts().restrictions;if(n&&e.filter(a=>!a.isGhost).length+t.length>n)throw new R(`${this.getI18n()("youCanOnlyUploadX",{smart_count:n})}`);if(s){const r=[...e,...t].reduce((a,o)=>a+(o.size??0),0);if(r>s)throw new R(this.getI18n()("aggregateExceedsSize",{sizeAllowed:J(s),size:J(r)}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:s,allowedFileTypes:n}=this.getOpts().restrictions;if(n&&!n.some(a=>a.includes("/")?e.type?tn(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){const a=n.join(", ");throw new R(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new R(this.getI18n()("exceedsSize",{size:J(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(s&&e.size!=null&&e.size{this.validateSingleFile(s)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length(t=s,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}class me extends Gs{#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof me||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:me}}));else if(typeof e=="function"){const s=e;this.uppy.iteratePlugins(n=>{n instanceof s&&(t=n)})}return t}mount(e,t){const s=t.id,n=ws(e);if(n){this.isTargetDOMEl=!0;const o=document.createElement("div");return o.classList.add("uppy-Root"),this.#e=rn(d=>{this.uppy.getPlugin(this.id)&&(zt(this.render(d,o),o),this.afterUpdate())}),this.uppy.log(`Installing ${s} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(n.innerHTML=""),zt(this.render(this.uppy.getState(),o),o),this.el=o,n.appendChild(o),o.dir=this.opts.direction||ks(o)||"ltr",this.onMount(),this.el}const r=this.getTargetPlugin(e);if(r)return this.uppy.log(`Installing ${s} to ${r.id}`),this.parent=r,this.el=r.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${s}`);let a=`Invalid target option given to ${s}.`;throw typeof e=="function"?a+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":a+="If you meant to target an HTML element, please make sure that the element exists. Check that the - - - - - - - - - - - - - - + + + + + + + + + + + + + + +