@cuongtran001/kanna 1.76.1 → 1.76.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{BoardsPage-ClqCJi3S.js → BoardsPage-BvYUo0PD.js} +1 -1
- package/dist/client/assets/{BoardsRoutePage-tILf5ZVU.js → BoardsRoutePage-D5hLNJ2q.js} +1 -1
- package/dist/client/assets/{ChatPage-C8syKflw.js → ChatPage-zfy8nznW.js} +3 -3
- package/dist/client/assets/{CronJobRow-FbVVkka2.js → CronJobRow-VCv0jyI2.js} +1 -1
- package/dist/client/assets/{CronJobsPage-Cjtn8F5l.js → CronJobsPage-8FE4cO2q.js} +1 -1
- package/dist/client/assets/{FilePreviewSheet-D6Js0oz9.js → FilePreviewSheet-B5b8L-4e.js} +1 -1
- package/dist/client/assets/{FlowSurface-BD6Fv7KF.js → FlowSurface-DmNZQO7Z.js} +1 -1
- package/dist/client/assets/{GenUIBlock-CCn7-ePE.js → GenUIBlock-DX1nLbtf.js} +2 -2
- package/dist/client/assets/{KannaSocketProvider-m8QFHU_F.js → KannaSocketProvider-CiuKyRYE.js} +1 -1
- package/dist/client/assets/{LocalProjectsPage-CPKymu8m.js → LocalProjectsPage-DjCZmQ8c.js} +1 -1
- package/dist/client/assets/{SettingsPage-04gXMi4Y.js → SettingsPage-ELjbPQEw.js} +1 -1
- package/dist/client/assets/{StackBoardsRoutePage-CzojEmXE.js → StackBoardsRoutePage-i7WMqsk0.js} +1 -1
- package/dist/client/assets/{ToolCallMessage-BUbmvfUG.js → ToolCallMessage-BhxowUjs.js} +3 -3
- package/dist/client/assets/{VChartSurface-CeQqqBBu.js → VChartSurface-DQ6HIQXe.js} +1 -1
- package/dist/client/assets/{WorkflowsPage-nsRU1QEm.js → WorkflowsPage-BCIsFa6f.js} +1 -1
- package/dist/client/assets/{WorkflowsSection-D5tluUkJ.js → WorkflowsSection-B5TkVqRA.js} +1 -1
- package/dist/client/assets/{chart-renderer-6tEMKXRu.js → chart-renderer-DQLdORyQ.js} +1 -1
- package/dist/client/assets/{chatSounds-DHfUpC0L.js → chatSounds-CUN4vZG0.js} +1 -1
- package/dist/client/assets/chevron-left-DpI8tMxJ.js +1 -0
- package/dist/client/assets/{clipboard.adapter-CYn3H1oo.js → clipboard.adapter-BvW6oQa_.js} +1 -1
- package/dist/client/assets/{columnStyle-BOebgRHp.js → columnStyle-C0IvZxLY.js} +1 -1
- package/dist/client/assets/{contextWindow-D1RRC1b-.js → contextWindow-WJUHfP_d.js} +1 -1
- package/dist/client/assets/{copyFeedbackStore-DdNWcKCp.js → copyFeedbackStore-BsjXKW0-.js} +1 -1
- package/dist/client/assets/{createScopedStore-C0pJOwR9.js → createScopedStore-DW4wfjbM.js} +1 -1
- package/dist/client/assets/{dist-DRcJM7Lq.js → dist-Q8elClTa.js} +1 -1
- package/dist/client/assets/{ellipsis-BrvN3hX9.js → ellipsis-D_1qLZbX.js} +1 -1
- package/dist/client/assets/{flow-kinds-CkaWSYYm.js → flow-kinds-Df0GmP61.js} +1 -1
- package/dist/client/assets/{folder-BunWGsz1.js → folder-UHukK2MD.js} +1 -1
- package/dist/client/assets/{formatDuration-SKek8N5u.js → formatDuration-BA1K5CFs.js} +1 -1
- package/dist/client/assets/{genui-td2w9ZBU.js → genui-CZI72r1O.js} +1 -1
- package/dist/client/assets/{globe-BIvdtBFt.js → globe-CQI7GjsK.js} +1 -1
- package/dist/client/assets/{host-6jbynfZo.js → host-C0p_56Re.js} +1 -1
- package/dist/client/assets/{index-CVlOrRGa.js → index-3lHvRekg.js} +3 -3
- package/dist/client/assets/{info-DhG2cfVg.js → info-BXzVPePc.js} +1 -1
- package/dist/client/assets/{input-C3R4k6-W.js → input-BerPPEIs.js} +1 -1
- package/dist/client/assets/{lexicalToReact-CfHucecr.js → lexicalToReact-DdXqoi0d.js} +3 -3
- package/dist/client/assets/{log-CYjZ_PZ1.js → log-7fGlFSON.js} +1 -1
- package/dist/client/assets/{monitor-DwO0L7DX.js → monitor-BOFtyQiW.js} +1 -1
- package/dist/client/assets/{pendingActionsStore-By8_y_o0.js → pendingActionsStore-idc6m2Ya.js} +1 -1
- package/dist/client/assets/{play-B-vQkmFp.js → play-DltDjX9H.js} +1 -1
- package/dist/client/assets/{plus-BDLscSN_.js → plus-CwWMJ0a-.js} +1 -1
- package/dist/client/assets/{popover-104yTR95.js → popover-gn1uvc-1.js} +1 -1
- package/dist/client/assets/{pushClient-DiLvwOUU.js → pushClient-NeXrldi-.js} +1 -1
- package/dist/client/assets/runDetached-BWsF_7Xo.js +1 -0
- package/dist/client/assets/{segmented-control-CROY-CuD.js → segmented-control-3UDSwswP.js} +1 -1
- package/dist/client/assets/{select-BiDB8UlY.js → select-Df67vheJ.js} +1 -1
- package/dist/client/assets/{settings-header-button-DrzrbXmr.js → settings-header-button-CKZHCdXh.js} +1 -1
- package/dist/client/assets/{sidebarPendingActions-Db0_daIj.js → sidebarPendingActions-B8iNQJfE.js} +1 -1
- package/dist/client/assets/{square-pen-DXsycXBb.js → square-pen-DJjPW4f4.js} +1 -1
- package/dist/client/assets/{state-mark-C1zpvAww.js → state-mark-CU2hw5D9.js} +1 -1
- package/dist/client/assets/{terminal-BSJXFRP8.js → terminal-8Bxl5uZh.js} +1 -1
- package/dist/client/assets/{timer.adapter-DsZB_-cb.js → timer.adapter-BD7zwXEm.js} +1 -1
- package/dist/client/assets/{tools-MYv8-phR.js → tools-Lo2VrFmM.js} +1 -1
- package/dist/client/assets/{triangle-alert-Ck2DCXSO.js → triangle-alert-CQwDyl4K.js} +1 -1
- package/dist/client/assets/{useAppGlobalState-BwEVtuo2.js → useAppGlobalState-uP5C1BG8.js} +1 -1
- package/dist/client/assets/{useKannaState-DbEQQ6kC.js → useKannaState-B2eDC-Dw.js} +1 -1
- package/dist/client/assets/{useTheme-BHNSJGUC.js → useTheme-B_JDh31l.js} +1 -1
- package/dist/client/index.html +33 -33
- package/package.json +1 -1
- package/dist/client/assets/chevron-left-BO_O7rLs.js +0 -1
- package/dist/client/assets/runDetached-DtQs26wR.js +0 -1
package/dist/client/assets/{StackBoardsRoutePage-CzojEmXE.js → StackBoardsRoutePage-i7WMqsk0.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{l as n,u as r}from"./chunk-OB3PAWPO-CCBUsQEH.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{t as a}from"./BoardsPage-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{l as n,u as r}from"./chunk-OB3PAWPO-CCBUsQEH.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{t as a}from"./BoardsPage-BvYUo0PD.js";var o=e(t(),1),s=e(i(),1);function c({stackId:e}){let t=r(),i=n(),c=t.sidebarData.stacks.find(t=>t.id===e),l=c?c.title:`Stack`,u=(0,o.useCallback)(t=>{i(`/boards/stack/${e}/${t}`)},[i,e]);return(0,s.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,s.jsx)(a,{ownerKind:`stack`,ownerId:e,ownerName:l,socket:t.socket,onOpenBoard:u})})}export{c as StackBoardsRoutePage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{n}from"./chunk-OB3PAWPO-CCBUsQEH.js";import{t as r}from"./jsx-runtime-BdxMnOeJ.js";import{c as i,f as a,l as o,m as s,p as c,t as l,u}from"./log-
|
|
2
|
-
`),n=/^\s*(\d+)→(.*)$/;return t.map(e=>{let t=e.match(n);return t?{lineNumber:parseInt(t[1],10),content:t[2]}:{lineNumber:null,content:e}})}function
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{n}from"./chunk-OB3PAWPO-CCBUsQEH.js";import{t as r}from"./jsx-runtime-BdxMnOeJ.js";import{c as i,f as a,l as o,m as s,p as c,t as l,u}from"./log-7fGlFSON.js";import{a as d,c as f,d as p,f as m}from"./pendingActionsStore-idc6m2Ya.js";import{A as h,D as g,F as _,I as v,N as y,O as b,S as x,_ as S,b as C,c as w,h as T,l as E,m as D,o as ee,r as te,t as ne,v as re,w as ie,y as ae}from"./FilePreviewSheet-B5b8L-4e.js";import{r as oe}from"./terminal-8Bxl5uZh.js";import{t as se}from"./formatDuration-BA1K5CFs.js";import{g as ce}from"./timer.adapter-BD7zwXEm.js";import{t as O}from"./createScopedStore-DW4wfjbM.js";import{l as le}from"./useTheme-B_JDh31l.js";import{c as ue,l as de,o as fe,r as pe,s as me}from"./contextWindow-WJUHfP_d.js";import{n as he,o as k}from"./formatters-BGORekd-.js";import{n as ge,r as _e}from"./tools-Lo2VrFmM.js";var A={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};A.node;var j=m(A),M={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};M.node;var N=m(M),P={name:`image`,size:24,node:[[`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`}]]};P.node;var ve=m(P),F={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};F.node;var I=m(F),L={name:`workflow`,size:24,node:[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]};L.node;var ye=m(L);function be(e){return e.kind===`tool`}function R(e){return new Date(e).toISOString()}function z(e){return{id:e._id,messageId:e.messageId,timestamp:R(e.createdAt),hidden:e.hidden}}var xe=`/.claude/plans/`;function Se(e){return e.includes(xe)&&e.endsWith(`.md`)}function Ce(e,t){if(e.toolKind!==`exit_plan_mode`)return e.toolKind===`write_file`&&Se(e.input.filePath)?e.input.content:t}function we(e,t){return e.toolKind===`exit_plan_mode`&&!e.input.plan&&t?{...e.input,plan:t}:e.input}function Te(e,t){return{id:e._id,messageId:e.messageId,hidden:e.hidden,kind:`tool`,toolKind:e.tool.toolKind,toolName:e.tool.toolName,toolId:e.tool.toolId,input:we(e.tool,t),timestamp:R(e.createdAt)}}function Ee(e){if(!e.debugRaw)return;let t;try{t=JSON.parse(e.debugRaw).tool_use_result??void 0}catch{return}if(t!==void 0&&typeof t!=`number`&&typeof t!=`boolean`)return t}function B(e){return typeof e==`number`?e:void 0}function V(e){return typeof e==`string`?e:void 0}function De(e){if(e===void 0||!le(e))return;let t=e,n={readCount:B(t.readCount),searchCount:B(t.searchCount),bashCount:B(t.bashCount),editFileCount:B(t.editFileCount),linesAdded:B(t.linesAdded),linesRemoved:B(t.linesRemoved),otherToolCount:B(t.otherToolCount)};return Object.values(n).some(e=>e!==void 0)?n:void 0}function Oe(e){if(!e.debugRaw)return;let t;try{t=JSON.parse(e.debugRaw).toolUseResult}catch{return}if(t===void 0||!le(t))return;let n=t,r={agentId:V(n.agentId),agentType:V(n.agentType),status:V(n.status),totalTokens:B(n.totalTokens),totalDurationMs:B(n.totalDurationMs),totalToolUseCount:B(n.totalToolUseCount),toolStats:De(n.toolStats),content:V(n.content)};return r.agentId!==void 0||r.agentType!==void 0||r.totalTokens!==void 0||r.totalDurationMs!==void 0||r.status!==void 0?r:void 0}function H(e){let t=new Map,n=[],r;for(let i of e)switch(i.kind){case`user_prompt`:n.push({...z(i),kind:`user_prompt`,content:i.content,attachments:i.attachments??[],steered:i.steered,autoContinue:i.autoContinue,expandedCommand:i.expandedCommand});break;case`system_init`:n.push({...z(i),kind:`system_init`,provider:i.provider,model:i.model,tools:i.tools,agents:i.agents,slashCommands:i.slashCommands,mcpServers:i.mcpServers,debugRaw:i.debugRaw});break;case`account_info`:n.push({...z(i),kind:`account_info`,accountInfo:i.accountInfo});break;case`assistant_text`:n.push({...z(i),kind:`assistant_text`,text:i.text});break;case`assistant_thinking`:n.push({...z(i),kind:`assistant_thinking`,text:i.text,signature:i.signature});break;case`api_error`:n.push({...z(i),kind:`api_error`,status:i.status,text:i.text,requestId:i.requestId,apiErrorReason:i.apiErrorReason});break;case`policy_refusal`:n.push({...z(i),kind:`policy_refusal`,text:i.text,requestId:i.requestId});break;case`tool_call`:{let e=Te(i,r);r=Ce(i.tool,r),t.set(i.tool.toolId,{hydrated:e,normalized:i.tool}),be(e)&&n.push(e);break}case`tool_result`:{let e=t.get(i.toolId);if(e){let t=ge.has(e.normalized.toolKind)?Ee(i)??i.content:i.content;e.normalized.toolKind===`subagent_task`?e.hydrated.result=Oe(i):e.hydrated.result=_e(e.normalized,ue(t)),e.hydrated.rawResult=t,e.hydrated.isError=i.isError,i.persisted&&(e.hydrated.persisted=i.persisted)}break}case`result`:n.push({...z(i),kind:`result`,success:!i.isError,cancelled:i.subtype===`cancelled`,result:i.result,durationMs:i.durationMs,costUsd:i.costUsd,codexErrorInfo:i.codexErrorInfo});break;case`status`:n.push({...z(i),kind:`status`,status:i.status});break;case`context_window_updated`:n.push({...z(i),kind:`context_window_updated`,usage:i.usage});break;case`compact_boundary`:n.push({...z(i),kind:`compact_boundary`});break;case`compact_summary`:n.push({...z(i),kind:`compact_summary`,summary:i.summary});break;case`context_cleared`:n.push({...z(i),kind:`context_cleared`});break;case`interrupted`:n.push({...z(i),kind:`interrupted`});break;case`memory_loaded`:n.push({...z(i),kind:`memory_loaded`,path:i.path});break;case`auto_continue_prompt`:n.push({...z(i),kind:`auto_continue_prompt`,scheduleId:i.scheduleId});break;case`pending_tool_request`:n.push({...z(i),kind:`pending_tool_request`,toolRequestId:i.toolRequestId,toolName:i.toolName,arguments:i.arguments});break;case`tool_request_resolved`:break;case`cron_armed`:n.push({...z(i),kind:`cron_armed`,jobId:i.jobId,instruction:i.instruction,mode:i.mode,scheduleText:i.scheduleText,scheduleHuman:i.scheduleHuman,nextFireAt:i.nextFireAt,...i.model===void 0?{}:{model:i.model},...i.upcomingFires===void 0?{}:{upcomingFires:i.upcomingFires},...i.cwd===void 0?{}:{cwd:i.cwd}});break;case`cron_command_error`:n.push({...z(i),kind:`cron_command_error`,message:i.message,...i.input===void 0?{}:{input:i.input},...i.suggestion===void 0?{}:{suggestion:i.suggestion}});break;case`cron_run`:n.push({...z(i),kind:`cron_run`,jobId:i.jobId,runId:i.runId,instruction:i.instruction,...i.spawnedChatId===void 0?{}:{spawnedChatId:i.spawnedChatId},firedAt:i.firedAt});break;case`cron_run_skipped`:n.push({...z(i),kind:`cron_run_skipped`,jobId:i.jobId,reason:i.reason,...i.missedCount===void 0?{}:{missedCount:i.missedCount}});break;case`cron_list`:n.push({...z(i),kind:`cron_list`,...i.help===void 0?{}:{help:i.help}});break;case`cron_job_change`:n.push({...z(i),kind:`cron_job_change`,jobId:i.jobId,change:i.change});break;case`loop_disarmed`:n.push({...z(i),kind:`loop_disarmed`,reason:i.reason,resumable:i.resumable,...i.trackingFileRel===void 0?{}:{trackingFileRel:i.trackingFileRel},...i.workdirAbs===void 0?{}:{workdirAbs:i.workdirAbs}});break;default:n.push({...z(i),kind:`unknown`,json:JSON.stringify(i,null,2)})}return n}var U=e(t(),1),W=e(r(),1),G=(0,U.memo)(({message:e})=>(0,W.jsx)(`div`,{className:`text-pretty prose prose-sm dark:prose-invert px-0.5 w-full max-w-[70ch] space-y-4`,children:te(e.text)})),ke=(0,U.memo)(({message:e})=>(0,W.jsx)(`div`,{className:`px-0.5 w-full max-w-[70ch]`,children:(0,W.jsx)(D,{content:e.text})})),K=({children:e,className:t,animate:n=!0,shimmerWidth:r,...i})=>(0,W.jsx)(`span`,{className:f(`mx-auto max-w-md text-foreground/60`,n&&`animate-shiny-pulse`,t),...i,children:e});function Ae(e){let t=e.split(`
|
|
2
|
+
`),n=/^\s*(\d+)→(.*)$/;return t.map(e=>{let t=e.match(n);return t?{lineNumber:parseInt(t[1],10),content:t[2]}:{lineNumber:null,content:e}})}function je(e){return e.replace(/<[^>]+>/g,``)}function Me(e,t){let n=e.split(`
|
|
3
3
|
`),r=t.split(`
|
|
4
|
-
`);return je(Ae(n,r,ke(n,r)))}function ke(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++)i[a][n]=e[a-1]===t[n-1]?i[a-1][n-1]+1:Math.max(i[a-1][n],i[a][n-1]);return i}function Ae(e,t,n){let r=[],i=e.length,a=t.length;for(;i>0||a>0;)i>0&&a>0&&e[i-1]===t[a-1]?(r.push({type:`context`,text:e[i-1],oldIdx:i,newIdx:a}),i--,a--):a>0&&(i===0||n[i][a-1]>=n[i-1][a])?(r.push({type:`added`,text:t[a-1],oldIdx:i,newIdx:a}),a--):(r.push({type:`removed`,text:e[i-1],oldIdx:i,newIdx:a}),i--);return r.reverse()}function je(e){return e.map(e=>{let t;return t=e.type===`removed`?`-`:e.type===`added`?`+`:` `,{type:e.type,content:`${t}${e.text}`}})}function q({content:e,isDiff:t=!1,oldString:n,newString:r}){let i=(0,U.useMemo)(()=>t&&n!==void 0&&r!==void 0?Oe(n,r):[],[t,n,r]),a=(0,U.useMemo)(()=>t?[]:Ee(e),[e,t]),o=(0,U.useMemo)(()=>a.some(e=>e.lineNumber!==null),[a]);return t&&i.length>0?(0,W.jsx)(`div`,{className:`my-1 rounded-lg border border-border overflow-hidden`,children:(0,W.jsx)(`div`,{className:`overflow-auto max-h-64 md:max-h-[50vh]`,children:(0,W.jsx)(`table`,{className:`w-full border-collapse text-xs font-mono`,children:(0,W.jsx)(`tbody`,{children:i.map((e,t)=>{let n;n=e.type===`removed`?`bg-destructive/10 dark:bg-destructive/15`:e.type===`added`?`bg-success/10 dark:bg-success/15`:``;let r;r=e.type===`removed`?`text-destructive`:e.type===`added`?`text-success`:`text-foreground`;let i;i=e.type===`removed`?`text-destructive/50`:e.type===`added`?`text-success/50`:`text-muted-foreground/50`;let a;return a=e.type===`removed`?`-`:e.type===`added`?`+`:` `,(0,W.jsxs)(`tr`,{className:n,children:[(0,W.jsx)(`td`,{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${i}`,children:a}),(0,W.jsx)(`td`,{className:`px-2 py-0 whitespace-pre select-all ${r}`,children:e.content.slice(1)})]},t)})})})})}):(0,W.jsx)(`div`,{className:`my-1 rounded-lg border border-border overflow-hidden`,children:(0,W.jsx)(`div`,{className:`overflow-auto max-h-64 md:max-h-[50vh]`,children:(0,W.jsx)(`table`,{className:`w-full border-collapse text-xs font-mono`,children:(0,W.jsx)(`tbody`,{children:a.map((e,t)=>(0,W.jsxs)(`tr`,{children:[o&&(0,W.jsx)(`td`,{className:`px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right`,children:e.lineNumber===null?``:e.lineNumber}),(0,W.jsx)(`td`,{className:`px-2 py-0 whitespace-pre select-all text-foreground`,children:De(e.content)})]},t))})})})})}var Me=new Map;function J(e,t){if(!t)return;let n=Me.get(e);return n===void 0?void 0:t(n)}function Ne(e){return{state:e===void 0?`idle`:`ready`,data:e===void 0?null:e,error:null}}function Pe(e){let{cacheKey:t,enabled:n,ref:r,fetcher:i,rootMargin:a,fromCache:c}=e,l=J(t,c),d=(0,U.useMemo)(()=>u(()=>Ne(J(t,c))),[t,c]),f=o(d,e=>e.state),p=o(d,e=>e.data),m=o(d,e=>e.error),h=(0,U.useRef)(t),g=(0,U.useRef)(null),_=(0,U.useRef)(t);return(0,U.useEffect)(()=>{_.current=t},[t]),(0,U.useEffect)(()=>{h.current!==t&&(h.current=t,d.setState(Ne(J(t,c))))},[t,c,d]),(0,U.useEffect)(()=>{if(!n||l!==void 0)return;let e=r.current;if(!e||typeof IntersectionObserver>`u`)return;let o=!1,c=t,u=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;if(u.disconnect(),o)return;let e=new AbortController;g.current=e,d.setState({state:`loading`}),i(e.signal).then(e=>{o||_.current!==c||(Me.set(c,e),d.setState({data:e,state:`ready`}))}).catch(s(t=>{o||e.signal.aborted||_.current!==c||d.setState({error:t,state:`error`})}));break}},{rootMargin:a??`200px`});return u.observe(e),()=>{o=!0,u.disconnect(),g.current?.abort(),g.current=null}},[l,t,n,r,i,a,d]),(0,U.useMemo)(()=>({state:f,data:p,error:m}),[f,p,m])}function Fe(e){return typeof e==`string`?e:void 0}function Ie({source:e,onOpen:t,variant:n}){let r={id:e.id,kind:`file`,displayName:e.displayName,mimeType:e.mimeType,size:e.size??0,contentUrl:e.contentUrl,relativePath:e.relativePath??``,absolutePath:``},i=y(r),a=v(i,e.mimeType),o=e.size&&e.size>0?S(e.size):null;return i===`image`?(0,W.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Preview ${e.displayName}`,className:`touch-manipulation overflow-hidden rounded-xl border border-border bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,children:(0,W.jsx)(`img`,{src:e.contentUrl,alt:e.altText??e.displayName,loading:`lazy`,className:`max-h-64 w-auto max-w-full object-contain`})}):n===`expanded`&&(i===`text`||i===`code`||i===`markdown`||i===`json`||i===`table`)?(0,W.jsx)(Le,{source:e,onOpen:t,friendlyType:a,sizeLabel:o}):(0,W.jsx)(T,{attachment:r,onClick:t,meta:(0,W.jsxs)(W.Fragment,{children:[a,o?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(`span`,{className:`tabular-nums`,children:o})]}):null]}),ariaLabel:`Preview ${e.displayName}, ${a}${o?`, ${o}`:``}`})}var Le=function({source:e,onOpen:t,friendlyType:n,sizeLabel:r}){let i=(0,U.useRef)(null),a=e.contentUrl,o=(0,U.useCallback)(async e=>{let t=await _(a,4096);if(e.aborted)throw Error(`aborted`);return t.content.slice(0,200)},[a]),s=Pe({ref:i,enabled:!0,cacheKey:`snippet:${e.id}|${e.contentUrl}|${e.size??0}`,fetcher:o,fromCache:Fe}),c=s.state===`ready`&&typeof s.data==`string`?s.data:``;return(0,W.jsxs)(`button`,{ref:i,type:`button`,onClick:t,"aria-label":`Preview ${e.displayName}`,className:`flex w-full max-w-md flex-col items-start gap-1 rounded-xl border border-border bg-background p-3 text-left hover:bg-accent/40`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.displayName}),(0,W.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[n,r?` · ${r}`:``]}),c?(0,W.jsx)(`pre`,{className:`line-clamp-3 max-h-16 w-full whitespace-pre-wrap break-words text-xs text-muted-foreground`,children:c}):null]})},Y=O(`ImageViewMessage`,()=>e=>({open:!1,setOpen:t=>e({open:t})}));function Re({toolId:e,path:t,contentUrl:n,mimeType:r}){let i=Y.useScopedStore(e=>e.open),a=Y.useScopedStore(e=>e.setOpen),o=ee(t);if(!n)return(0,W.jsx)(`div`,{className:`rounded-lg border border-border bg-muted/20 px-3 py-2 text-sm text-muted-foreground`,children:t});let s={id:`image-view-${e}`,contentUrl:n,displayName:o,fileName:o,relativePath:t,mimeType:r,origin:`image_view`};return(0,W.jsxs)(`figure`,{className:`flex flex-col gap-2`,"data-testid":`image-view`,children:[(0,W.jsx)(Ie,{source:s,onOpen:()=>a(!0),variant:`expanded`}),(0,W.jsx)(ne,{source:i?s:null,open:i,onOpenChange:a})]})}function ze(e){return(0,W.jsx)(Y.Provider,{init:void 0,children:(0,W.jsx)(Re,{...e})})}function Be(){return(0,W.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide text-muted-foreground`,children:`started…`})}function Ve({name:e,description:t,run:n}){return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,W.jsx)(N,{className:`size-4 text-muted-icon shrink-0`}),(0,W.jsxs)(`div`,{className:`flex flex-1 items-center gap-2 min-w-0 overflow-hidden`,children:[(0,W.jsx)(`span`,{className:`font-medium text-foreground/80 text-sm truncate`,children:e??`Workflow`}),t&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:t}),n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(me,{status:n.status}),n.agentCount!=null&&n.agentCount>0&&(0,W.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[n.agentCount,` agents`]})]}):(0,W.jsx)(Be,{})]})]})}var He={serverOverloaded:`transient`,internalServerError:`transient`,httpConnectionFailed:`transient`,responseStreamConnectionFailed:`transient`,responseStreamDisconnected:`transient`,responseTooManyFailedAttempts:`transient`,usageLimitExceeded:`quota`,sessionBudgetExceeded:`quota`,unauthorized:`auth`,contextWindowExceeded:`fatal`,badRequest:`fatal`,cyberPolicy:`fatal`,sandboxError:`fatal`,threadRollbackFailed:`fatal`,activeTurnNotSteerable:`fatal`,other:`unknown`},Ue=new Set([`httpConnectionFailed`,`responseStreamConnectionFailed`,`responseStreamDisconnected`,`responseTooManyFailedAttempts`,`activeTurnNotSteerable`]);function X(e){return e in He}function We(e){if(e==null)return null;if(typeof e==`string`)return X(e)&&!Ue.has(e)?e:null;if(typeof e!=`object`)return null;let t=Object.keys(e);if(t.length!==1)return null;let[n]=t;return Ue.has(n)&&X(n)?n:null}function Ge(e){return typeof e==`string`?X(e)?e:null:We(e)}function Ke(e){let t=Ge(e);return t===null?`unknown`:He[t]}function qe(e){return Ke(e)===`transient`}var Je={serverOverloaded:e=>`${e} is temporarily at capacity. Retry, or switch to another model.`,internalServerError:e=>`${e} hit a server-side error. Retrying usually clears it.`,httpConnectionFailed:()=>`Could not reach the model provider. Check your connection, then retry.`,responseStreamConnectionFailed:()=>`The response stream failed to connect. Retry to start a new stream.`,responseStreamDisconnected:()=>`The response stream disconnected mid-turn. Retry to pick up from where it stopped.`,responseTooManyFailedAttempts:e=>`${e} failed repeatedly while streaming. Retry, or switch to another model.`,usageLimitExceeded:()=>`You have reached your Codex usage limit. Access returns when the limit window resets.`,sessionBudgetExceeded:()=>`This session reached its configured token budget.`,unauthorized:()=>"Codex rejected the credentials for this request. Re-authenticate with `codex login`.",contextWindowExceeded:e=>`The conversation no longer fits in ${e}'s context window. Start a new chat or compact this one.`,badRequest:()=>`Codex rejected the request as malformed.`,cyberPolicy:()=>`Codex declined this request under its usage policy.`,sandboxError:()=>`The Codex sandbox failed to run the requested command.`,threadRollbackFailed:()=>`Codex could not roll the conversation back to the requested point.`,activeTurnNotSteerable:()=>`The running turn cannot accept new input. Wait for it to finish, or stop it.`},Ye=`The selected model`;function Xe(e,t){let n=Ge(e);if(n===null)return null;let r=Je[n];return r===void 0?null:r(t??Ye)}var Z=O(`TranscriptActionCard`,()=>e=>({busyId:null,actionError:null,setBusyId:t=>e({busyId:t}),setActionError:t=>e({actionError:t})})),Ze={neutral:`border-border bg-card`,muted:`border-border/50 bg-card/50 opacity-75`,success:`border-emerald-500/30 bg-emerald-500/5`,error:`border-destructive/40 bg-destructive/5`},Qe={primary:`default`,secondary:`secondary`,ghost:`ghost`,destructive:`destructive`};function $e(e){return(0,W.jsx)(Z.Provider,{init:void 0,children:(0,W.jsx)(et,{...e})})}function et({title:e,description:t,body:n,errorMessage:r,tone:i=`neutral`,actions:o=[]}){let c=Z.useScopedStore(e=>e.busyId),u=Z.useScopedStore(e=>e.actionError),p=Z.useScopedStoreApi(),m=(0,U.useCallback)(e=>{let t=p.getState();if(t.busyId)return;t.setActionError(null);let n;try{n=e.onClick()}catch(e){l.error(`[transcript-action-card] sync click threw`,String(e)),p.getState().setActionError(a(e));return}n instanceof Promise&&(t.setBusyId(e.id),n.then(()=>p.getState().setBusyId(null),s(e=>{l.error(`[transcript-action-card] async click rejected`,e.message),p.getState().setActionError(e.message),p.getState().setBusyId(null)})))},[p]),h=c!==null;return(0,W.jsxs)(`div`,{"data-focus-fallback-ignore":!0,className:f(`rounded-lg border px-4 py-3 text-sm space-y-2 transition-colors`,Ze[i]),children:[(0,W.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,W.jsxs)(`div`,{className:`space-y-1 min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`font-medium leading-tight`,children:e}),t?(0,W.jsx)(`div`,{className:`text-muted-foreground text-xs leading-snug`,children:t}):null]})}),n?(0,W.jsx)(`div`,{className:`text-xs leading-snug`,children:n}):null,r?(0,W.jsx)(`div`,{className:`text-destructive text-xs leading-snug`,children:r}):null,u?(0,W.jsx)(`div`,{className:`text-destructive text-xs leading-snug`,role:`alert`,children:u}):null,o.length>0?(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:o.map(e=>{let t=c===e.id;return(0,W.jsxs)(d,{type:`button`,size:`sm`,variant:Qe[e.variant??`ghost`],disabled:e.disabled||h&&!t,pending:t,onClick:()=>m(e),className:`gap-1.5`,children:[e.icon,e.label]},e.id)})}):null]})}function tt(e){if(e<1e3)return`${e}ms`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h${r>0?` ${r}m`:``}`:r>0?`${r}m${i>0?` ${i}s`:``}`:`${i}s`}function nt({durationMs:e,prefix:t=`Worked for`}){return e<=0?null:(0,W.jsxs)(g,{children:[t,` `,tt(e)]})}var Q=/\[([^\]]+)\]\(\/chat\/([0-9a-fA-F][0-9a-fA-F-]{7,})\)/g;function rt(e,t){let r=[],i=0,a=0;Q.lastIndex=0;for(let o=Q.exec(e);o!==null;o=Q.exec(e))o.index>i&&r.push(e.slice(i,o.index)),r.push((0,W.jsx)(n,{to:`/chat/${o[2]}`,className:t??`underline decoration-destructive/40 hover:decoration-destructive`,children:o[1]},`chat-link-${a++}`)),i=o.index+o[0].length;return i<e.length&&r.push(e.slice(i)),r.length===0?e:r}function it({resultMessageId:e,body:t,onRetry:n}){let r=[{id:`retry`,label:`Retry`,variant:`primary`,onClick:(0,U.useCallback)(()=>n(e),[n,e])}];return(0,W.jsx)(`div`,{className:`mx-2 my-1`,children:(0,W.jsx)($e,{title:`Turn failed`,tone:`error`,body:t,actions:r})})}function at({message:e,onRetry:t}){if(!e.success){let n=e.codexErrorInfo,r=(n?Xe(n,null):null)??e.result??``,i=r.trim().length>0,a=n!==void 0&&qe(n),o=null;return a&&t?o=(0,W.jsx)(it,{resultMessageId:e.id,body:r,onRetry:t}):i&&(o=(0,W.jsx)(`div`,{className:`px-4 py-3 mx-2 my-1 rounded-lg bg-destructive/10 border border-destructive/20 text-destructive text-sm whitespace-pre-wrap`,children:rt(r)})),(0,W.jsxs)(W.Fragment,{children:[o,e.durationMs>0?(0,W.jsx)(nt,{durationMs:e.durationMs,prefix:`Failed after`}):null]})}return(0,W.jsx)(nt,{durationMs:e.durationMs})}function ot(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function st(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function ct(e){return e.replace(/<persisted-output>\n?/g,``).replace(/\n?<\/persisted-output>/g,``)}function lt({message:e,localPath:t,isRunning:n=!1}){if(e.kind===`tool`&&e.persisted){let t=ct(st(e.rawResult??``));return(0,W.jsxs)(`div`,{className:`animate-in fade-in-0 duration-200 rounded-md border border-border bg-muted/30 p-2 space-y-1 text-xs`,children:[(0,W.jsxs)(`div`,{className:`font-medium`,children:[e.toolName,`: output too large (`,ot(e.persisted.originalSize),`) — saved to disk`]}),(0,W.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap overflow-hidden max-h-48`,children:t}),(0,W.jsxs)(`a`,{href:E(e.persisted.filePath),className:`text-blue-500 hover:underline break-all`,target:`_blank`,rel:`noreferrer`,children:[`View full output (`,e.persisted.filePath,`)`]})]})}let r;switch(e.kind){case`assistant_text`:r=(0,W.jsx)(G,{message:e});break;case`assistant_thinking`:r=(0,W.jsx)(Te,{message:e});break;case`tool`:r=(0,W.jsx)(Ct,{message:e,isLoading:n,localPath:t});break;case`result`:r=(0,W.jsx)(at,{message:e});break;default:return null}return(0,W.jsx)(`div`,{className:`animate-in fade-in-0 duration-200`,children:r})}var ut=(0,U.createContext)(null);function dt({children:e,value:t}){return(0,W.jsx)(ut.Provider,{value:t,children:e})}function ft(){return(0,U.useContext)(ut)}var pt=[],$=O(`SubagentTaskMessage`,()=>e=>({expanded:!1,loading:!1,loaded:!1,children:pt,error:null,setExpanded:t=>e({expanded:t}),setLoading:t=>e({loading:t}),setLoaded:t=>e({loaded:t}),setChildren:t=>e({children:t}),setError:t=>e({error:t})}));function mt(e,t){return t||e===`failed`||e===`error`?`destructive`:e===`in_progress`||e===`running`?`active`:`muted`}function ht(e){if(!e)return``;let t=[],n=(e,n,r)=>{e&&e>0&&t.push(`${e} ${e===1?n:r}`)};return n(e.readCount,`read`,`reads`),n(e.editFileCount,`edit`,`edits`),n(e.bashCount,`cmd`,`cmds`),n(e.searchCount,`search`,`searches`),n(e.otherToolCount,`tool`,`tools`),t.join(` · `)}function gt({subagentType:e,result:t,isError:n,localPath:r}){let i=e||`Agent`,a=mt(t?.status,n),o=ht(t?.toolStats),c=ft(),l=t?.agentId,u=!!(c&&l),d=$.useScopedStore(e=>e.expanded),m=$.useScopedStore(e=>e.loading),h=$.useScopedStore(e=>e.loaded),g=$.useScopedStore(e=>e.children),_=$.useScopedStore(e=>e.error),v=$.useScopedStore(e=>e.setExpanded),y=$.useScopedStore(e=>e.setLoading),b=$.useScopedStore(e=>e.setLoaded),x=$.useScopedStore(e=>e.setChildren),S=$.useScopedStore(e=>e.setError),C=(0,U.useCallback)(()=>{if(!c||!l)return;let e=!d;v(e),e&&!h&&!m&&(y(!0),S(null),c(l).then(e=>{x(H(e)),b(!0)}).catch(s(e=>S(e.message))).finally(()=>y(!1)))},[c,l,d,h,m,v,y,S,x,b]),w=(0,W.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[u?(0,W.jsx)(oe,{className:f(`size-4 text-muted-icon shrink-0 transition-transform`,d&&`rotate-90`),"aria-hidden":!0}):(0,W.jsx)(I,{className:`size-4 text-muted-icon shrink-0`}),(0,W.jsxs)(`div`,{className:`flex flex-1 items-center gap-2 min-w-0 overflow-hidden`,children:[(0,W.jsx)(`span`,{className:`font-medium text-foreground/80 text-sm truncate`,children:i}),t?.status&&(0,W.jsx)(fe,{tone:a,label:t.status}),t?.totalTokens!=null&&t.totalTokens>0&&(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-xs text-muted-foreground tabular-nums`,children:[(0,W.jsx)(j,{className:`size-3`,"aria-hidden":!0}),pe(t.totalTokens),` tokens`]}),t?.totalDurationMs!=null&&t.totalDurationMs>0&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:se(t.totalDurationMs)}),o&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums truncate`,children:o}),m&&(0,W.jsx)(p,{className:`size-3 animate-spin text-muted-foreground`,"aria-label":`Loading`})]})]});return u?(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:C,"aria-expanded":d,className:`w-full text-left cursor-pointer`,children:w}),d&&(0,W.jsxs)(`div`,{className:`mt-2 ml-2 border-l-2 border-muted-foreground/20 pl-3 space-y-2`,children:[_&&(0,W.jsx)(`div`,{className:`text-xs text-destructive`,children:_}),!_&&h&&g.length===0&&(0,W.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No subagent activity recorded.`}),g.map(e=>(0,W.jsx)(lt,{message:e,localPath:r??``},e.id))]})]}):w}function _t({subagentType:e,result:t,isError:n,localPath:r}){return(0,W.jsx)($.Provider,{init:void 0,children:(0,W.jsx)(gt,{subagentType:e,result:t,isError:n,localPath:r})})}var vt=[],yt=i()(e=>({byChat:{},setRuns:(t,n)=>e(e=>({byChat:{...e.byChat,[t]:n}}))}));function bt(e){return t=>t.byChat[e]??vt}function xt(e){return((c(e)&&Array.isArray(e.content)?e.content:null)??(Array.isArray(e)?e:[])).flatMap(e=>!e||typeof e!=`object`||!(`type`in e)||e.type!==`image`?[]:`data`in e&&typeof e.data==`string`?[{type:`image`,data:e.data,mimeType:`mimeType`in e&&typeof e.mimeType==`string`?e.mimeType:void 0}]:`source`in e&&e.source&&typeof e.source==`object`&&`type`in e.source&&e.source.type===`base64`&&`data`in e.source&&typeof e.source.data==`string`?[{type:`image`,data:e.source.data,mimeType:`media_type`in e.source&&typeof e.source.media_type==`string`?e.source.media_type:void 0}]:[])}function St({images:e}){return(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map((e,t)=>{let n=e.mimeType||`image/png`;return(0,W.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-muted/20`,children:(0,W.jsx)(`img`,{src:`data:${n};base64,${e.data}`,alt:`Read result ${t+1}`,className:`max-h-[50vh] w-full object-contain bg-background`})},`${n}:${t}`)})})}function Ct({message:e,isLoading:t=!1,localPath:n,chatId:r=``}){let i=e.result!==void 0,a=!i&&t,o=yt(de(bt(r))),s=(0,U.useMemo)(()=>{if(e.toolKind===`skill`)return e.input.skill;if(e.toolKind===`glob`)return`Search files ${e.input.pattern===`**/*`?`in all directories`:`matching ${e.input.pattern}`}`;if(e.toolKind===`grep`){let t=e.input.pattern,n=e.input.outputMode;return n===`count`?`Count \`${t}\` occurrences`:n===`content`?`Find \`${t}\` in text`:`Find \`${t}\` in files`}return e.toolKind===`bash`?e.input.description||(e.input.command?he(e.input.command):`Bash`):e.toolKind===`web_search`?e.input.query||`Web Search`:e.toolKind===`read_file`?`Read ${w(e.input.filePath,n)}`:e.toolKind===`image_view`?`View ${w(e.input.path,n)||e.input.path}`:e.toolKind===`write_file`?`Write ${w(e.input.filePath,n)}`:e.toolKind===`edit_file`?`Edit ${w(e.input.filePath,n)}`:e.toolKind===`delete_file`?`Delete ${w(e.input.filePath,n)}`:e.toolKind===`mcp_generic`?`${k(e.input.tool)} from ${k(e.input.server)}`:e.toolKind===`beacon`?e.input.beaconId?`Beacon ${e.input.beaconId}: ${e.input.summary}`:e.input.summary:e.toolKind===`subagent_task`?e.input.subagentType||e.toolName:e.toolKind===`workflow`?e.input.name??`Workflow`:e.toolName},[e.input,e.toolKind,e.toolName,n]),l=(0,U.useMemo)(()=>e.toolKind===`subagent_task`,[e.toolKind]),u=(0,U.useMemo)(()=>{if(e.toolKind===`skill`)return e.input.skill},[e.input,e.toolKind]),d=e.toolKind===`bash`,f=e.toolKind===`write_file`,p=e.toolKind===`edit_file`,m=e.toolKind===`delete_file`,g=e.toolKind===`read_file`,_=e.toolKind===`image_view`,v=(0,U.useMemo)(()=>{if(typeof e.result==`string`)return e.result;if(!e.result)return``;if(c(e.result)){let t=e.result.content;if(typeof t==`string`)return t}return JSON.stringify(e.result,null,2)},[e.result]),y=(0,U.useMemo)(()=>{if(!g)return[];if(c(e.result)){let t=e.result.blocks;if(Array.isArray(t)){let e=xt(t);if(e.length>0)return e}}return xt(e.rawResult)},[g,e.rawResult,e.result]),S=(0,U.useMemo)(()=>{switch(e.toolKind){case`bash`:return e.input.command;case`write_file`:case`delete_file`:return e.input.content;default:return JSON.stringify(e.input,null,2)}},[e]),T;T=d?(0,W.jsxs)(`span`,{className:`flex items-center gap-2 w-full`,children:[(0,W.jsx)(`span`,{children:`Command`}),!!e.input.timeoutMs&&(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[`timeout: `,String(e.input.timeoutMs),`ms`]}),!!e.input.runInBackground&&(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`background`})]}):f?`Contents`:`Input`;let E;E=p?(0,W.jsx)(q,{content:``,isDiff:!0,oldString:e.input.oldString,newString:e.input.newString}):m?(0,W.jsx)(q,{content:e.input.content}):!g&&!f&&!_?(0,W.jsx)(C,{label:T,copyText:S,children:S}):null;let D;if(e.toolKind===`workflow`&&!e.isError){let t=(c(e.result)&&typeof e.result.text==`string`?{taskId:typeof e.result.taskId==`string`?e.result.taskId:void 0,text:e.result.text}:void 0)?.taskId,n=t?o.find(e=>e.taskId===t):void 0;D=(0,W.jsx)(Ve,{name:e.input.name,description:e.input.description,run:n})}else D=e.toolKind===`subagent_task`&&e.result?(0,W.jsx)(_t,{subagentType:e.input.subagentType,result:e.result,isError:e.isError,localPath:n}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`w-5 h-5 relative flex items-center justify-center`,children:e.isError?(0,W.jsx)(ce,{className:`size-4 text-destructive`}):l?(0,W.jsx)(I,{className:`size-4 text-muted-icon`}):e.toolKind===`image_view`?(0,W.jsx)(ve,{className:`size-4 text-muted-icon`}):e.toolKind===`workflow`?(0,W.jsx)(N,{className:`size-4 text-muted-icon`}):(0,W.jsx)(ae,{icon:h(e.toolName),className:`size-4 text-muted-icon`})}),(0,W.jsx)(x,{className:`text-left transition-opacity duration-200 truncate`,children:(0,W.jsx)(K,{animate:a,shimmerWidth:Math.max(20,((u||s)?.length??33)*3),children:u||s})})]});return(0,W.jsx)(ie,{className:`w-full`,children:(0,W.jsx)(re,{expandedContent:(0,W.jsx)(b,{className:`my-4 text-sm`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[E,i&&g&&!e.isError&&(y.length>0?(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Image`}),(0,W.jsx)(`div`,{className:`mt-1`,children:(0,W.jsx)(St,{images:y})})]}):(0,W.jsx)(q,{content:v})),_&&!e.isError&&(0,W.jsx)(ze,{toolId:e.toolId,path:e.input.path,contentUrl:e.input.contentUrl,mimeType:e.input.mimeType}),f&&!e.isError&&(0,W.jsx)(q,{content:e.input.content}),i&&!g&&!(_&&!e.isError)&&!(f&&!e.isError)&&!(p&&!e.isError)&&!(m&&!e.isError)&&(0,W.jsx)(C,{label:e.isError?`Error`:`Result`,copyText:v,children:v})]})}),children:D})})}export{j as _,lt as a,$e as c,Te as d,G as f,N as g,I as h,dt as i,Ie as l,ye as m,bt as n,at as o,H as p,yt as r,rt as s,Ct as t,K as u};
|
|
4
|
+
`);return Fe(Pe(n,r,Ne(n,r)))}function Ne(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++)i[a][n]=e[a-1]===t[n-1]?i[a-1][n-1]+1:Math.max(i[a-1][n],i[a][n-1]);return i}function Pe(e,t,n){let r=[],i=e.length,a=t.length;for(;i>0||a>0;)i>0&&a>0&&e[i-1]===t[a-1]?(r.push({type:`context`,text:e[i-1],oldIdx:i,newIdx:a}),i--,a--):a>0&&(i===0||n[i][a-1]>=n[i-1][a])?(r.push({type:`added`,text:t[a-1],oldIdx:i,newIdx:a}),a--):(r.push({type:`removed`,text:e[i-1],oldIdx:i,newIdx:a}),i--);return r.reverse()}function Fe(e){return e.map(e=>{let t;return t=e.type===`removed`?`-`:e.type===`added`?`+`:` `,{type:e.type,content:`${t}${e.text}`}})}function q({content:e,isDiff:t=!1,oldString:n,newString:r}){let i=(0,U.useMemo)(()=>t&&n!==void 0&&r!==void 0?Me(n,r):[],[t,n,r]),a=(0,U.useMemo)(()=>t?[]:Ae(e),[e,t]),o=(0,U.useMemo)(()=>a.some(e=>e.lineNumber!==null),[a]);return t&&i.length>0?(0,W.jsx)(`div`,{className:`my-1 rounded-lg border border-border overflow-hidden`,children:(0,W.jsx)(`div`,{className:`overflow-auto max-h-64 md:max-h-[50vh]`,children:(0,W.jsx)(`table`,{className:`w-full border-collapse text-xs font-mono`,children:(0,W.jsx)(`tbody`,{children:i.map((e,t)=>{let n;n=e.type===`removed`?`bg-destructive/10 dark:bg-destructive/15`:e.type===`added`?`bg-success/10 dark:bg-success/15`:``;let r;r=e.type===`removed`?`text-destructive`:e.type===`added`?`text-success`:`text-foreground`;let i;i=e.type===`removed`?`text-destructive/50`:e.type===`added`?`text-success/50`:`text-muted-foreground/50`;let a;return a=e.type===`removed`?`-`:e.type===`added`?`+`:` `,(0,W.jsxs)(`tr`,{className:n,children:[(0,W.jsx)(`td`,{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${i}`,children:a}),(0,W.jsx)(`td`,{className:`px-2 py-0 whitespace-pre select-all ${r}`,children:e.content.slice(1)})]},t)})})})})}):(0,W.jsx)(`div`,{className:`my-1 rounded-lg border border-border overflow-hidden`,children:(0,W.jsx)(`div`,{className:`overflow-auto max-h-64 md:max-h-[50vh]`,children:(0,W.jsx)(`table`,{className:`w-full border-collapse text-xs font-mono`,children:(0,W.jsx)(`tbody`,{children:a.map((e,t)=>(0,W.jsxs)(`tr`,{children:[o&&(0,W.jsx)(`td`,{className:`px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right`,children:e.lineNumber===null?``:e.lineNumber}),(0,W.jsx)(`td`,{className:`px-2 py-0 whitespace-pre select-all text-foreground`,children:je(e.content)})]},t))})})})})}var Ie=new Map;function J(e,t){if(!t)return;let n=Ie.get(e);return n===void 0?void 0:t(n)}function Le(e){return{state:e===void 0?`idle`:`ready`,data:e===void 0?null:e,error:null}}function Re(e){let{cacheKey:t,enabled:n,ref:r,fetcher:i,rootMargin:a,fromCache:c}=e,l=J(t,c),d=(0,U.useMemo)(()=>u(()=>Le(J(t,c))),[t,c]),f=o(d,e=>e.state),p=o(d,e=>e.data),m=o(d,e=>e.error),h=(0,U.useRef)(t),g=(0,U.useRef)(null),_=(0,U.useRef)(t);return(0,U.useEffect)(()=>{_.current=t},[t]),(0,U.useEffect)(()=>{h.current!==t&&(h.current=t,d.setState(Le(J(t,c))))},[t,c,d]),(0,U.useEffect)(()=>{if(!n||l!==void 0)return;let e=r.current;if(!e||typeof IntersectionObserver>`u`)return;let o=!1,c=t,u=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;if(u.disconnect(),o)return;let e=new AbortController;g.current=e,d.setState({state:`loading`}),i(e.signal).then(e=>{o||_.current!==c||(Ie.set(c,e),d.setState({data:e,state:`ready`}))}).catch(s(t=>{o||e.signal.aborted||_.current!==c||d.setState({error:t,state:`error`})}));break}},{rootMargin:a??`200px`});return u.observe(e),()=>{o=!0,u.disconnect(),g.current?.abort(),g.current=null}},[l,t,n,r,i,a,d]),(0,U.useMemo)(()=>({state:f,data:p,error:m}),[f,p,m])}function ze(e){return typeof e==`string`?e:void 0}function Be({source:e,onOpen:t,variant:n}){let r={id:e.id,kind:`file`,displayName:e.displayName,mimeType:e.mimeType,size:e.size??0,contentUrl:e.contentUrl,relativePath:e.relativePath??``,absolutePath:``},i=y(r),a=v(i,e.mimeType),o=e.size&&e.size>0?S(e.size):null;return i===`image`?(0,W.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Preview ${e.displayName}`,className:`touch-manipulation overflow-hidden rounded-xl border border-border bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,children:(0,W.jsx)(`img`,{src:e.contentUrl,alt:e.altText??e.displayName,loading:`lazy`,className:`max-h-64 w-auto max-w-full object-contain`})}):n===`expanded`&&(i===`text`||i===`code`||i===`markdown`||i===`json`||i===`table`)?(0,W.jsx)(Ve,{source:e,onOpen:t,friendlyType:a,sizeLabel:o}):(0,W.jsx)(T,{attachment:r,onClick:t,meta:(0,W.jsxs)(W.Fragment,{children:[a,o?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(`span`,{className:`tabular-nums`,children:o})]}):null]}),ariaLabel:`Preview ${e.displayName}, ${a}${o?`, ${o}`:``}`})}var Ve=function({source:e,onOpen:t,friendlyType:n,sizeLabel:r}){let i=(0,U.useRef)(null),a=e.contentUrl,o=(0,U.useCallback)(async e=>{let t=await _(a,4096);if(e.aborted)throw Error(`aborted`);return t.content.slice(0,200)},[a]),s=Re({ref:i,enabled:!0,cacheKey:`snippet:${e.id}|${e.contentUrl}|${e.size??0}`,fetcher:o,fromCache:ze}),c=s.state===`ready`&&typeof s.data==`string`?s.data:``;return(0,W.jsxs)(`button`,{ref:i,type:`button`,onClick:t,"aria-label":`Preview ${e.displayName}`,className:`flex w-full max-w-md flex-col items-start gap-1 rounded-xl border border-border bg-background p-3 text-left hover:bg-accent/40`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.displayName}),(0,W.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[n,r?` · ${r}`:``]}),c?(0,W.jsx)(`pre`,{className:`line-clamp-3 max-h-16 w-full whitespace-pre-wrap break-words text-xs text-muted-foreground`,children:c}):null]})},Y=O(`ImageViewMessage`,()=>e=>({open:!1,setOpen:t=>e({open:t})}));function He({toolId:e,path:t,contentUrl:n,mimeType:r}){let i=Y.useScopedStore(e=>e.open),a=Y.useScopedStore(e=>e.setOpen),o=ee(t);if(!n)return(0,W.jsx)(`div`,{className:`rounded-lg border border-border bg-muted/20 px-3 py-2 text-sm text-muted-foreground`,children:t});let s={id:`image-view-${e}`,contentUrl:n,displayName:o,fileName:o,relativePath:t,mimeType:r,origin:`image_view`};return(0,W.jsxs)(`figure`,{className:`flex flex-col gap-2`,"data-testid":`image-view`,children:[(0,W.jsx)(Be,{source:s,onOpen:()=>a(!0),variant:`expanded`}),(0,W.jsx)(ne,{source:i?s:null,open:i,onOpenChange:a})]})}function Ue(e){return(0,W.jsx)(Y.Provider,{init:void 0,children:(0,W.jsx)(He,{...e})})}function We(){return(0,W.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide text-muted-foreground`,children:`started…`})}function Ge({name:e,description:t,run:n}){return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,W.jsx)(N,{className:`size-4 text-muted-icon shrink-0`}),(0,W.jsxs)(`div`,{className:`flex flex-1 items-center gap-2 min-w-0 overflow-hidden`,children:[(0,W.jsx)(`span`,{className:`font-medium text-foreground/80 text-sm truncate`,children:e??`Workflow`}),t&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:t}),n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(me,{status:n.status}),n.agentCount!=null&&n.agentCount>0&&(0,W.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[n.agentCount,` agents`]})]}):(0,W.jsx)(We,{})]})]})}var Ke={serverOverloaded:`transient`,internalServerError:`transient`,httpConnectionFailed:`transient`,responseStreamConnectionFailed:`transient`,responseStreamDisconnected:`transient`,responseTooManyFailedAttempts:`transient`,usageLimitExceeded:`quota`,sessionBudgetExceeded:`quota`,unauthorized:`auth`,contextWindowExceeded:`fatal`,badRequest:`fatal`,cyberPolicy:`fatal`,sandboxError:`fatal`,threadRollbackFailed:`fatal`,activeTurnNotSteerable:`fatal`,other:`unknown`},qe=new Set([`httpConnectionFailed`,`responseStreamConnectionFailed`,`responseStreamDisconnected`,`responseTooManyFailedAttempts`,`activeTurnNotSteerable`]);function X(e){return e in Ke}function Je(e){if(e==null)return null;if(typeof e==`string`)return X(e)&&!qe.has(e)?e:null;if(typeof e!=`object`)return null;let t=Object.keys(e);if(t.length!==1)return null;let[n]=t;return qe.has(n)&&X(n)?n:null}function Ye(e){return typeof e==`string`?X(e)?e:null:Je(e)}function Xe(e){let t=Ye(e);return t===null?`unknown`:Ke[t]}function Ze(e){return Xe(e)===`transient`}var Qe={serverOverloaded:e=>`${e} is temporarily at capacity. Retry, or switch to another model.`,internalServerError:e=>`${e} hit a server-side error. Retrying usually clears it.`,httpConnectionFailed:()=>`Could not reach the model provider. Check your connection, then retry.`,responseStreamConnectionFailed:()=>`The response stream failed to connect. Retry to start a new stream.`,responseStreamDisconnected:()=>`The response stream disconnected mid-turn. Retry to pick up from where it stopped.`,responseTooManyFailedAttempts:e=>`${e} failed repeatedly while streaming. Retry, or switch to another model.`,usageLimitExceeded:()=>`You have reached your Codex usage limit. Access returns when the limit window resets.`,sessionBudgetExceeded:()=>`This session reached its configured token budget.`,unauthorized:()=>"Codex rejected the credentials for this request. Re-authenticate with `codex login`.",contextWindowExceeded:e=>`The conversation no longer fits in ${e}'s context window. Start a new chat or compact this one.`,badRequest:()=>`Codex rejected the request as malformed.`,cyberPolicy:()=>`Codex declined this request under its usage policy.`,sandboxError:()=>`The Codex sandbox failed to run the requested command.`,threadRollbackFailed:()=>`Codex could not roll the conversation back to the requested point.`,activeTurnNotSteerable:()=>`The running turn cannot accept new input. Wait for it to finish, or stop it.`},$e=`The selected model`;function et(e,t){let n=Ye(e);if(n===null)return null;let r=Qe[n];return r===void 0?null:r(t??$e)}var Z=O(`TranscriptActionCard`,()=>e=>({busyId:null,actionError:null,setBusyId:t=>e({busyId:t}),setActionError:t=>e({actionError:t})})),tt={neutral:`border-border bg-card`,muted:`border-border/50 bg-card/50 opacity-75`,success:`border-emerald-500/30 bg-emerald-500/5`,error:`border-destructive/40 bg-destructive/5`},nt={primary:`default`,secondary:`secondary`,ghost:`ghost`,destructive:`destructive`};function rt(e){return(0,W.jsx)(Z.Provider,{init:void 0,children:(0,W.jsx)(it,{...e})})}function it({title:e,description:t,body:n,errorMessage:r,tone:i=`neutral`,actions:o=[]}){let c=Z.useScopedStore(e=>e.busyId),u=Z.useScopedStore(e=>e.actionError),p=Z.useScopedStoreApi(),m=(0,U.useCallback)(e=>{let t=p.getState();if(t.busyId)return;t.setActionError(null);let n;try{n=e.onClick()}catch(e){l.error(`[transcript-action-card] sync click threw`,String(e)),p.getState().setActionError(a(e));return}n instanceof Promise&&(t.setBusyId(e.id),n.then(()=>p.getState().setBusyId(null),s(e=>{l.error(`[transcript-action-card] async click rejected`,e.message),p.getState().setActionError(e.message),p.getState().setBusyId(null)})))},[p]),h=c!==null;return(0,W.jsxs)(`div`,{"data-focus-fallback-ignore":!0,className:f(`rounded-lg border px-4 py-3 text-sm space-y-2 transition-colors`,tt[i]),children:[(0,W.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,W.jsxs)(`div`,{className:`space-y-1 min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`font-medium leading-tight`,children:e}),t?(0,W.jsx)(`div`,{className:`text-muted-foreground text-xs leading-snug`,children:t}):null]})}),n?(0,W.jsx)(`div`,{className:`text-xs leading-snug`,children:n}):null,r?(0,W.jsx)(`div`,{className:`text-destructive text-xs leading-snug`,children:r}):null,u?(0,W.jsx)(`div`,{className:`text-destructive text-xs leading-snug`,role:`alert`,children:u}):null,o.length>0?(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:o.map(e=>{let t=c===e.id;return(0,W.jsxs)(d,{type:`button`,size:`sm`,variant:nt[e.variant??`ghost`],disabled:e.disabled||h&&!t,pending:t,onClick:()=>m(e),className:`gap-1.5`,children:[e.icon,e.label]},e.id)})}):null]})}function at(e){if(e<1e3)return`${e}ms`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h${r>0?` ${r}m`:``}`:r>0?`${r}m${i>0?` ${i}s`:``}`:`${i}s`}function ot({durationMs:e,prefix:t=`Worked for`}){return e<=0?null:(0,W.jsxs)(g,{children:[t,` `,at(e)]})}var Q=/\[([^\]]+)\]\(\/chat\/([0-9a-fA-F][0-9a-fA-F-]{7,})\)/g;function st(e,t){let r=[],i=0,a=0;Q.lastIndex=0;for(let o=Q.exec(e);o!==null;o=Q.exec(e))o.index>i&&r.push(e.slice(i,o.index)),r.push((0,W.jsx)(n,{to:`/chat/${o[2]}`,className:t??`underline decoration-destructive/40 hover:decoration-destructive`,children:o[1]},`chat-link-${a++}`)),i=o.index+o[0].length;return i<e.length&&r.push(e.slice(i)),r.length===0?e:r}function ct({resultMessageId:e,body:t,onRetry:n}){let r=[{id:`retry`,label:`Retry`,variant:`primary`,onClick:(0,U.useCallback)(()=>n(e),[n,e])}];return(0,W.jsx)(`div`,{className:`mx-2 my-1`,children:(0,W.jsx)(rt,{title:`Turn failed`,tone:`error`,body:t,actions:r})})}function lt({message:e,onRetry:t}){if(!e.success){let n=e.codexErrorInfo,r=(n?et(n,null):null)??e.result??``,i=r.trim().length>0,a=n!==void 0&&Ze(n),o=null;return a&&t?o=(0,W.jsx)(ct,{resultMessageId:e.id,body:r,onRetry:t}):i&&(o=(0,W.jsx)(`div`,{className:`px-4 py-3 mx-2 my-1 rounded-lg bg-destructive/10 border border-destructive/20 text-destructive text-sm whitespace-pre-wrap`,children:st(r)})),(0,W.jsxs)(W.Fragment,{children:[o,e.durationMs>0?(0,W.jsx)(ot,{durationMs:e.durationMs,prefix:`Failed after`}):null]})}return(0,W.jsx)(ot,{durationMs:e.durationMs})}function ut(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function dt(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function ft(e){return e.replace(/<persisted-output>\n?/g,``).replace(/\n?<\/persisted-output>/g,``)}function pt({message:e,localPath:t,isRunning:n=!1}){if(e.kind===`tool`&&e.persisted){let t=ft(dt(e.rawResult??``));return(0,W.jsxs)(`div`,{className:`animate-in fade-in-0 duration-200 rounded-md border border-border bg-muted/30 p-2 space-y-1 text-xs`,children:[(0,W.jsxs)(`div`,{className:`font-medium`,children:[e.toolName,`: output too large (`,ut(e.persisted.originalSize),`) — saved to disk`]}),(0,W.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap overflow-hidden max-h-48`,children:t}),(0,W.jsxs)(`a`,{href:E(e.persisted.filePath),className:`text-blue-500 hover:underline break-all`,target:`_blank`,rel:`noreferrer`,children:[`View full output (`,e.persisted.filePath,`)`]})]})}let r;switch(e.kind){case`assistant_text`:r=(0,W.jsx)(G,{message:e});break;case`assistant_thinking`:r=(0,W.jsx)(ke,{message:e});break;case`tool`:r=(0,W.jsx)(Dt,{message:e,isLoading:n,localPath:t});break;case`result`:r=(0,W.jsx)(lt,{message:e});break;default:return null}return(0,W.jsx)(`div`,{className:`animate-in fade-in-0 duration-200`,children:r})}var mt=(0,U.createContext)(null);function ht({children:e,value:t}){return(0,W.jsx)(mt.Provider,{value:t,children:e})}function gt(){return(0,U.useContext)(mt)}var _t=[],$=O(`SubagentTaskMessage`,()=>e=>({expanded:!1,loading:!1,loaded:!1,children:_t,error:null,setExpanded:t=>e({expanded:t}),setLoading:t=>e({loading:t}),setLoaded:t=>e({loaded:t}),setChildren:t=>e({children:t}),setError:t=>e({error:t})}));function vt(e,t){return t||e===`failed`||e===`error`?`destructive`:e===`in_progress`||e===`running`?`active`:`muted`}function yt(e){if(!e)return``;let t=[],n=(e,n,r)=>{e&&e>0&&t.push(`${e} ${e===1?n:r}`)};return n(e.readCount,`read`,`reads`),n(e.editFileCount,`edit`,`edits`),n(e.bashCount,`cmd`,`cmds`),n(e.searchCount,`search`,`searches`),n(e.otherToolCount,`tool`,`tools`),t.join(` · `)}function bt({subagentType:e,result:t,isError:n,localPath:r}){let i=e||`Agent`,a=vt(t?.status,n),o=yt(t?.toolStats),c=gt(),l=t?.agentId,u=!!(c&&l),d=$.useScopedStore(e=>e.expanded),m=$.useScopedStore(e=>e.loading),h=$.useScopedStore(e=>e.loaded),g=$.useScopedStore(e=>e.children),_=$.useScopedStore(e=>e.error),v=$.useScopedStore(e=>e.setExpanded),y=$.useScopedStore(e=>e.setLoading),b=$.useScopedStore(e=>e.setLoaded),x=$.useScopedStore(e=>e.setChildren),S=$.useScopedStore(e=>e.setError),C=(0,U.useCallback)(()=>{if(!c||!l)return;let e=!d;v(e),e&&!h&&!m&&(y(!0),S(null),c(l).then(e=>{x(H(e)),b(!0)}).catch(s(e=>S(e.message))).finally(()=>y(!1)))},[c,l,d,h,m,v,y,S,x,b]),w=(0,W.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[u?(0,W.jsx)(oe,{className:f(`size-4 text-muted-icon shrink-0 transition-transform`,d&&`rotate-90`),"aria-hidden":!0}):(0,W.jsx)(I,{className:`size-4 text-muted-icon shrink-0`}),(0,W.jsxs)(`div`,{className:`flex flex-1 items-center gap-2 min-w-0 overflow-hidden`,children:[(0,W.jsx)(`span`,{className:`font-medium text-foreground/80 text-sm truncate`,children:i}),t?.status&&(0,W.jsx)(fe,{tone:a,label:t.status}),t?.totalTokens!=null&&t.totalTokens>0&&(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-xs text-muted-foreground tabular-nums`,children:[(0,W.jsx)(j,{className:`size-3`,"aria-hidden":!0}),pe(t.totalTokens),` tokens`]}),t?.totalDurationMs!=null&&t.totalDurationMs>0&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:se(t.totalDurationMs)}),o&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums truncate`,children:o}),m&&(0,W.jsx)(p,{className:`size-3 animate-spin text-muted-foreground`,"aria-label":`Loading`})]})]});return u?(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:C,"aria-expanded":d,className:`w-full text-left cursor-pointer`,children:w}),d&&(0,W.jsxs)(`div`,{className:`mt-2 ml-2 border-l-2 border-muted-foreground/20 pl-3 space-y-2`,children:[_&&(0,W.jsx)(`div`,{className:`text-xs text-destructive`,children:_}),!_&&h&&g.length===0&&(0,W.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No subagent activity recorded.`}),g.map(e=>(0,W.jsx)(pt,{message:e,localPath:r??``},e.id))]})]}):w}function xt({subagentType:e,result:t,isError:n,localPath:r}){return(0,W.jsx)($.Provider,{init:void 0,children:(0,W.jsx)(bt,{subagentType:e,result:t,isError:n,localPath:r})})}var St=[],Ct=i()(e=>({byChat:{},setRuns:(t,n)=>e(e=>({byChat:{...e.byChat,[t]:n}}))}));function wt(e){return t=>t.byChat[e]??St}function Tt(e){return((c(e)&&Array.isArray(e.content)?e.content:null)??(Array.isArray(e)?e:[])).flatMap(e=>!e||typeof e!=`object`||!(`type`in e)||e.type!==`image`?[]:`data`in e&&typeof e.data==`string`?[{type:`image`,data:e.data,mimeType:`mimeType`in e&&typeof e.mimeType==`string`?e.mimeType:void 0}]:`source`in e&&e.source&&typeof e.source==`object`&&`type`in e.source&&e.source.type===`base64`&&`data`in e.source&&typeof e.source.data==`string`?[{type:`image`,data:e.source.data,mimeType:`media_type`in e.source&&typeof e.source.media_type==`string`?e.source.media_type:void 0}]:[])}function Et({images:e}){return(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map((e,t)=>{let n=e.mimeType||`image/png`;return(0,W.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-muted/20`,children:(0,W.jsx)(`img`,{src:`data:${n};base64,${e.data}`,alt:`Read result ${t+1}`,className:`max-h-[50vh] w-full object-contain bg-background`})},`${n}:${t}`)})})}function Dt({message:e,isLoading:t=!1,localPath:n,chatId:r=``}){let i=e.result!==void 0,a=!i&&t,o=Ct(de(wt(r))),s=(0,U.useMemo)(()=>{if(e.toolKind===`skill`)return e.input.skill;if(e.toolKind===`glob`)return`Search files ${e.input.pattern===`**/*`?`in all directories`:`matching ${e.input.pattern}`}`;if(e.toolKind===`grep`){let t=e.input.pattern,n=e.input.outputMode;return n===`count`?`Count \`${t}\` occurrences`:n===`content`?`Find \`${t}\` in text`:`Find \`${t}\` in files`}return e.toolKind===`bash`?e.input.description||(e.input.command?he(e.input.command):`Bash`):e.toolKind===`web_search`?e.input.query||`Web Search`:e.toolKind===`read_file`?`Read ${w(e.input.filePath,n)}`:e.toolKind===`image_view`?`View ${w(e.input.path,n)||e.input.path}`:e.toolKind===`write_file`?`Write ${w(e.input.filePath,n)}`:e.toolKind===`edit_file`?`Edit ${w(e.input.filePath,n)}`:e.toolKind===`delete_file`?`Delete ${w(e.input.filePath,n)}`:e.toolKind===`mcp_generic`?`${k(e.input.tool)} from ${k(e.input.server)}`:e.toolKind===`beacon`?e.input.beaconId?`Beacon ${e.input.beaconId}: ${e.input.summary}`:e.input.summary:e.toolKind===`subagent_task`?e.input.subagentType||e.toolName:e.toolKind===`workflow`?e.input.name??`Workflow`:e.toolName},[e.input,e.toolKind,e.toolName,n]),l=(0,U.useMemo)(()=>e.toolKind===`subagent_task`,[e.toolKind]),u=(0,U.useMemo)(()=>{if(e.toolKind===`skill`)return e.input.skill},[e.input,e.toolKind]),d=e.toolKind===`bash`,f=e.toolKind===`write_file`,p=e.toolKind===`edit_file`,m=e.toolKind===`delete_file`,g=e.toolKind===`read_file`,_=e.toolKind===`image_view`,v=(0,U.useMemo)(()=>{if(typeof e.result==`string`)return e.result;if(!e.result)return``;if(c(e.result)){let t=e.result.content;if(typeof t==`string`)return t}return JSON.stringify(e.result,null,2)},[e.result]),y=(0,U.useMemo)(()=>{if(!g)return[];if(c(e.result)){let t=e.result.blocks;if(Array.isArray(t)){let e=Tt(t);if(e.length>0)return e}}return Tt(e.rawResult)},[g,e.rawResult,e.result]),S=(0,U.useMemo)(()=>{switch(e.toolKind){case`bash`:return e.input.command;case`write_file`:case`delete_file`:return e.input.content;default:return JSON.stringify(e.input,null,2)}},[e]),T;T=d?(0,W.jsxs)(`span`,{className:`flex items-center gap-2 w-full`,children:[(0,W.jsx)(`span`,{children:`Command`}),!!e.input.timeoutMs&&(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[`timeout: `,String(e.input.timeoutMs),`ms`]}),!!e.input.runInBackground&&(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`background`})]}):f?`Contents`:`Input`;let E;E=p?(0,W.jsx)(q,{content:``,isDiff:!0,oldString:e.input.oldString,newString:e.input.newString}):m?(0,W.jsx)(q,{content:e.input.content}):!g&&!f&&!_?(0,W.jsx)(C,{label:T,copyText:S,children:S}):null;let D;if(e.toolKind===`workflow`&&!e.isError){let t=(c(e.result)&&typeof e.result.text==`string`?{taskId:typeof e.result.taskId==`string`?e.result.taskId:void 0,text:e.result.text}:void 0)?.taskId,n=t?o.find(e=>e.taskId===t):void 0;D=(0,W.jsx)(Ge,{name:e.input.name,description:e.input.description,run:n})}else D=e.toolKind===`subagent_task`&&e.result?(0,W.jsx)(xt,{subagentType:e.input.subagentType,result:e.result,isError:e.isError,localPath:n}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`w-5 h-5 relative flex items-center justify-center`,children:e.isError?(0,W.jsx)(ce,{className:`size-4 text-destructive`}):l?(0,W.jsx)(I,{className:`size-4 text-muted-icon`}):e.toolKind===`image_view`?(0,W.jsx)(ve,{className:`size-4 text-muted-icon`}):e.toolKind===`workflow`?(0,W.jsx)(N,{className:`size-4 text-muted-icon`}):(0,W.jsx)(ae,{icon:h(e.toolName),className:`size-4 text-muted-icon`})}),(0,W.jsx)(x,{className:`text-left transition-opacity duration-200 truncate`,children:(0,W.jsx)(K,{animate:a,shimmerWidth:Math.max(20,((u||s)?.length??33)*3),children:u||s})})]});return(0,W.jsx)(ie,{className:`w-full`,children:(0,W.jsx)(re,{expandedContent:(0,W.jsx)(b,{className:`my-4 text-sm`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[E,i&&g&&!e.isError&&(y.length>0?(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Image`}),(0,W.jsx)(`div`,{className:`mt-1`,children:(0,W.jsx)(Et,{images:y})})]}):(0,W.jsx)(q,{content:v})),_&&!e.isError&&(0,W.jsx)(Ue,{toolId:e.toolId,path:e.input.path,contentUrl:e.input.contentUrl,mimeType:e.input.mimeType}),f&&!e.isError&&(0,W.jsx)(q,{content:e.input.content}),i&&!g&&!(_&&!e.isError)&&!(f&&!e.isError)&&!(p&&!e.isError)&&!(m&&!e.isError)&&(0,W.jsx)(C,{label:e.isError?`Error`:`Result`,copyText:v,children:v})]})}),children:D})})}export{j as _,pt as a,rt as c,ke as d,G as f,N as g,I as h,ht as i,Be as l,ye as m,wt as n,lt as o,H as p,Ct as r,st as s,Dt as t,K as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-C0FnF6B9.js";import{t as a}from"./react-DiVRNtpo.js";import{t as o}from"./jsx-runtime-BdxMnOeJ.js";import{d as s}from"./log-CYjZ_PZ1.js";import{n as c}from"./useTheme-BHNSJGUC.js";import{O as l}from"./genui-td2w9ZBU.js";import{t as u}from"./runDetached-DtQs26wR.js";import{t as d}from"./chart-renderer-6tEMKXRu.js";var f=n(a(),1);function p(e){let t=e.h*Math.PI/180,n=e.c*Math.cos(t),r=e.c*Math.sin(t),i=e.l+.3963377774*n+.2158037573*r,a=e.l-.1055613458*n-.0638541728*r,o=e.l-.0894841775*n-1.291485548*r,s=i**3,c=a**3,l=o**3;return[4.0767416621*s-3.3077115913*c+.2309699292*l,-1.2684380046*s+2.6097574011*c-.3413193965*l,-.0041960863*s-.7034186147*c+1.707614701*l]}var m=/^oklch\(\s*([0-9.]+)(%?)\s+([0-9.]+)\s+([0-9.]+)\s*(?:\/\s*([0-9.]+)(%?)\s*)?\)$/i;function h(e){let t=m.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=t[5]===void 0?1:Number(t[5])/(t[6]?100:1);return{l:t[2]?n/100:n,c:Number(t[3]),h:Number(t[4]),alpha:r}}function g(e){let t=Math.max(0,Math.min(1,e)),n=t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055;return Math.round(n*255)}function _(e,t=1){let[n,r,i]=p(e).map(g);return t>=1?`rgb(${n}, ${r}, ${i})`:`rgba(${n}, ${r}, ${i}, ${t})`}function v(e,t){let n=h(e);return n?_(n,n.alpha):e.trim()||t}function y(e){let t=(t,n)=>v(e(t,``),n),n=Array.from({length:8},(e,n)=>t(`--chart-${n+1}`,`rgb(42, 120, 214)`)),r=t(`--muted-foreground`,`rgb(115, 107, 108)`);return{series:n,compare:r,increase:n[0]??r,decrease:n[7]??r,total:r,grid:t(`--chart-grid`,`rgb(236, 232, 232)`),axis:t(`--chart-axis`,`rgb(204, 198, 198)`),text:t(`--foreground`,`rgb(30, 24, 25)`),mutedText:r,surface:t(`--card`,`rgb(255, 253, 253)`),fontFamily:e(`--kanna-font-body`,`ui-sans-serif, system-ui, sans-serif`)}}var b=.1,x=[4,3],S=11;function C(e,t){return{x:e.x,xLabel:e.xLabel,series:e.series,seriesLabel:t.get(e.series)??e.series,value:e.value,start:e.start??0,end:e.end??e.value}}function w(e,t){switch(e.role){case`compare`:return t.compare;case`increase`:return t.increase;case`decrease`:return t.decrease;case`total`:return t.total;default:return t.series[e.slot??0]??t.series[0]??t.text}}function T(e,t){return{type:`ordinal`,domain:e.series.map(e=>e.label),range:e.series.map(e=>w(e,t))}}function E(e,t){return e.series.some(e=>e.label===t&&e.role===`compare`)}var D=`seriesLabel`;function O(e,t){let n=e?.[t];return typeof n==`string`?n:``}function k(e){let t=e?.value;return typeof t==`number`?t:null}function A(e){let t=t=>l(k(t),e.format);return{mark:{title:{value:e=>O(e,`xLabel`)},content:[{key:e=>O(e,`seriesLabel`),value:t}]},dimension:{title:{value:e=>O(e,`xLabel`)},content:[{key:e=>O(e,`seriesLabel`),value:t}]}}}function ee(e){return e.kind!==`line`&&e.kind!==`area`}function te(e,t){let n={fill:t.mutedText,fontSize:S,fontFamily:t.fontFamily};return[{orient:`left`,type:`linear`,label:{style:n,formatMethod:t=>l(Number(t),e.format,{compact:!0})},grid:{visible:!0,style:{stroke:t.grid,lineWidth:1,lineDash:[]}},domainLine:{visible:!1},tick:{visible:!1}},{orient:`bottom`,type:`band`,sampling:!ee(e),label:{style:n,autoLimit:!0,formatMethod:t=>e.xLabels[String(t)]??String(t)},domainLine:{visible:!0,style:{stroke:t.axis,lineWidth:1}},tick:{visible:!1},grid:{visible:!1}}]}function ne(e,t){return{visible:e.series.length>=2,orient:`top`,position:`start`,item:{label:{style:{fill:t.text,fontSize:S,fontFamily:t.fontFamily}}}}}function re(e,t){let n=new Map(e.series.map(e=>[e.id,e.label]));return{data:[{id:`points`,values:e.points.map(e=>C(e,n))}],background:`transparent`,padding:{top:8,right:12,bottom:4,left:4},color:T(e,t),tooltip:A(e),legends:ne(e,t)}}function ie(e,t){switch(e.kind){case`line`:return oe(e,t);case`area`:return se(e,t);case`bar`:case`stacked-bar`:return ce(e,t);case`combo`:return le(e,t);case`waterfall`:return ue(e,t);case`composition`:return de(e,t)}}function ae(e){return{xField:{visible:!0,line:{type:`line`,style:{stroke:e.axis,lineWidth:1}}}}}function oe(e,t){return{type:`line`,...re(e,t),xField:`x`,yField:`value`,seriesField:D,axes:te(e,t),crosshair:ae(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`,lineDash:t=>E(e,O(t,`seriesLabel`))?x:[]}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}}function se(e,t){return{type:`area`,...re(e,t),xField:`x`,yField:`value`,seriesField:D,axes:te(e,t),crosshair:ae(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`}},area:{style:{fillOpacity:t=>E(e,O(t,`seriesLabel`))?0:b}},point:{visible:!1}}}function ce(e,t){let n=e.kind===`stacked-bar`,r=!n&&e.series.length>1;return{type:`bar`,...re(e,t),xField:r?[`x`,D]:`x`,yField:`value`,seriesField:D,stack:n,barMaxWidth:24,barGapInGroup:2,axes:te(e,t),bar:{style:{cornerRadius:n?0:[4,4,0,0],stroke:t.surface,lineWidth:n?2:0}}}}function le(e,t){let[n,r]=e.series,i=re(e,t),a=new Map(e.series.map(e=>[e.id,e.label])),o=t=>e.points.filter(e=>e.series===t).map(e=>C(e,a));return{type:`common`,background:i.background,padding:i.padding,color:i.color,tooltip:i.tooltip,legends:i.legends,data:[{id:`bars`,values:o(n?.id)},{id:`line`,values:o(r?.id)}],series:[{type:`bar`,dataIndex:0,xField:`x`,yField:`value`,seriesField:D,barMaxWidth:24,bar:{style:{cornerRadius:[4,4,0,0]}}},{type:`line`,dataIndex:1,xField:`x`,yField:`value`,seriesField:D,line:{style:{lineWidth:2}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}],axes:te(e,t).map(e=>e.orient===`left`?{...e,seriesIndex:[0,1]}:e)}}function ue(e,t){return{type:`rangeColumn`,...re(e,t),xField:`x`,minField:`start`,maxField:`end`,seriesField:D,barMaxWidth:24,axes:te(e,t),bar:{style:{cornerRadius:2}}}}function de(e,t){return{type:`pie`,...re(e,t),categoryField:D,valueField:`value`,innerRadius:.62,outerRadius:.9,pie:{style:{stroke:t.surface,lineWidth:2}}}}var fe=e=>e,pe;(function(e){e[`desktop-browser`]=`desktop-browser`,e[`mobile-browser`]=`mobile-browser`,e.node=`node`,e.worker=`worker`,e.miniApp=`miniApp`,e.wx=`wx`,e.tt=`tt`,e.harmony=`harmony`,e[`desktop-miniApp`]=`desktop-miniApp`,e.lynx=`lynx`})(pe||={});var j;(function(e){e.cartesianAxis=`cartesianAxis`,e.cartesianBandAxis=`cartesianAxis-band`,e.cartesianLinearAxis=`cartesianAxis-linear`,e.cartesianTimeAxis=`cartesianAxis-time`,e.cartesianLogAxis=`cartesianAxis-log`,e.cartesianSymlogAxis=`cartesianAxis-symlog`,e.polarAxis=`polarAxis`,e.polarBandAxis=`polarAxis-band`,e.polarLinearAxis=`polarAxis-linear`,e.crosshair=`crosshair`,e.cartesianCrosshair=`cartesianCrosshair`,e.polarCrosshair=`polarCrosshair`,e.dataZoom=`dataZoom`,e.geoCoordinate=`geoCoordinate`,e.indicator=`indicator`,e.discreteLegend=`discreteLegend`,e.continuousLegend=`continuousLegend`,e.colorLegend=`colorLegend`,e.sizeLegend=`sizeLegend`,e.markLine=`markLine`,e.markArea=`markArea`,e.markPoint=`markPoint`,e.polarMarkLine=`polarMarkLine`,e.polarMarkArea=`polarMarkArea`,e.polarMarkPoint=`polarMarkPoint`,e.geoMarkPoint=`geoMarkPoint`,e.tooltip=`tooltip`,e.title=`title`,e.player=`player`,e.scrollBar=`scrollBar`,e.label=`label`,e.totalLabel=`totalLabel`,e.brush=`brush`,e.poptip=`poptip`,e.customMark=`customMark`})(j||={});var me=i(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)})),he,ge=t((()=>{he=(e,t)=>Object.prototype.toString.call(e)===`[object ${t}]`})),_e,ve=t((()=>{ge(),_e=(e,t=!1)=>t?typeof e==`boolean`:!0===e||!1===e||he(e,`Boolean`)})),M,ye=t((()=>{M=e=>typeof e==`function`})),N,be=t((()=>{N=e=>e==null})),P,xe=t((()=>{P=e=>e!=null})),F,Se=t((()=>{F=e=>{let t=typeof e;return e!==null&&t===`object`||t===`function`}})),Ce,we=t((()=>{Ce=e=>typeof e==`object`&&!!e})),Te,Ee=t((()=>{we(),ge(),Te=function(e){if(!Ce(e)||!he(e,`Object`))return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}})),De,Oe=t((()=>{De=e=>e===void 0})),ke,Ae=t((()=>{ge(),ke=(e,t=!1)=>{let n=typeof e;return t?n===`string`:n===`string`||he(e,`String`)}})),I,je=t((()=>{ge(),I=e=>Array.isArray?Array.isArray(e):he(e,`Array`)})),Me,Ne=t((()=>{Me=function(e){return e!==null&&typeof e!=`function`&&Number.isFinite(e.length)}})),Pe,Fe=t((()=>{ge(),Pe=e=>he(e,`Date`)})),L,Ie=t((()=>{ge(),L=(e,t=!1)=>{let n=typeof e;return t?n===`number`:n===`number`||he(e,`Number`)}})),R,Le=t((()=>{Ie(),R=e=>L(e)&&Number.isFinite(e)})),Re,ze=t((()=>{Re=e=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(e)})),Be,Ve=t((()=>{Be=e=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(e)})),He,Ue=t((()=>{He=e=>({}).toString.call(e).replace(/^\[object /,``).replace(/]$/,``)})),We,Ge,Ke=t((()=>{We=Object.prototype,Ge=function(e){let t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||We)}}));function z(e){if(N(e))return!0;if(Me(e))return!e.length;let t=He(e);if(t===`Map`||t===`Set`)return!e.size;if(Ge(e))return!Object.keys(e).length;for(let t in e)if(qe.call(e,t))return!1;return!0}var qe,Je=t((()=>{be(),Ne(),Ue(),Ke(),qe=Object.prototype.hasOwnProperty})),Ye,Xe=t((()=>{Ae(),Ye=(e,t,n)=>{let r=ke(t)?t.split(`.`):t;for(let t=0;t<r.length;t++)e=e?e[r[t]]:void 0;return e===void 0?n:e}})),Ze,Qe,$e=t((()=>{Ze=Object.prototype.hasOwnProperty,Qe=(e,t)=>e!=null&&Ze.call(e,t)}));function et(e,t,n){let r;if(!P(e)||typeof e!=`object`||t&&t(e))return e;let i=I(e),a=e.length;r=i?Array(a):typeof e==`object`?{}:_e(e)||L(e)||ke(e)?e:Pe(e)?new Date(+e):void 0;let o=i?void 0:Object.keys(Object(e)),s=-1;if(r)for(;++s<(o||e).length;){let i=o?o[s]:s,a=e[i];n&&n.includes(i.toString())?r[i]=a:r[i]=et(a,t,n)}return r}var tt=t((()=>{je(),ve(),Fe(),Ie(),Ae(),xe()}));function nt(e,t,n=!1,r=!1){if(t){if(e===t)return;if(P(t)&&typeof t==`object`){let i=Object(t),a=[];for(let e in i)a.push(e);let{length:o}=a,s=-1;for(;o--;){let o=a[++s];!P(i[o])||typeof i[o]!=`object`||r&&I(e[o])?it(e,o,i[o]):rt(e,t,o,n,r)}}}}function rt(e,t,n,r=!1,i=!1){let a=e[n],o=t[n],s=t[n],c=!0;if(I(o)){if(r)s=[];else if(I(a))s=a;else if(Me(a)){s=Array(a.length);let e=-1,t=a.length;for(;++e<t;)s[e]=a[e]}}else Te(o)?(s=a??{},typeof a!=`function`&&typeof a==`object`||(s={})):c=!1;c&&nt(s,o,r,i),it(e,n,s)}function it(e,t,n){(n!==void 0&&!at(e[t],n)||n===void 0&&!(t in e))&&(e[t]=n)}function at(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function ot(e,...t){let n=-1,r=t.length;for(;++n<r;)nt(e,t[n],!0);return e}var st=t((()=>{je(),Ne(),Ee(),xe()}));function ct(e,t){if(!e||!Te(e))return e;let n={};return Object.keys(e).forEach((r=>{let i=e[r],a=!1;t.forEach((e=>{(ke(e)&&e===r||e instanceof RegExp&&r.match(e))&&(a=!0)})),a||(n[r]=i)})),n}var lt=t((()=>{Ee(),Ae()}));function ut(e){return Object.prototype.toString.call(e)}function dt(e){return Object.keys(e)}function ft(e,t,n){if(e===t)return!0;if(typeof e!=typeof t||e==null||t==null)return!1;if(Number.isNaN(e)&&Number.isNaN(t))return!0;if(ut(e)!==ut(t))return!1;if(M(e))return!!n?.skipFunction;if(typeof e!=`object`)return!1;if(I(e)){if(e.length!==t.length)return!1;for(let r=e.length-1;r>=0;r--)if(!ft(e[r],t[r],n))return!1;return!0}if(!Te(e))return!1;let r=dt(e),i=dt(t);if(r.length!==i.length)return!1;r.sort(),i.sort();for(let e=r.length-1;e>=0;e--)if(r[e]!=i[e])return!1;for(let i=r.length-1;i>=0;i--){let a=r[i];if(!ft(e[a],t[a],n))return!1}return!0}var pt=t((()=>{je(),ye(),Ee()}));function mt(e){if(!e)return[];if(Object.keys)return Object.keys(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(n);return t}function ht(e,t,n){let r=mt(t);for(let i=0;i<r.length;i++){let a=r[i];(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}return e}function gt(e,t,n=!0){if(e=`prototype`in e?e.prototype:e,t=`prototype`in t?t.prototype:t,Object.getOwnPropertyNames){let r=Object.getOwnPropertyNames(t);for(let i=0;i<r.length;i++){let a=r[i];a!==`constructor`&&(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}}else ht(e,t,n)}var _t=t((()=>{}));function B(e){return P(e)?I(e)?e:[e]:[]}function vt(e){if(Me(e))return e[e.length-1]}function yt(e,t){if(!I(e)||!I(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function bt(e){if(!I(e))return[e];let t=[];for(let n of e)t.push(...bt(n));return t}var xt,St,Ct=t((()=>{je(),Ne(),xe(),xt=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)>0&&(n=i)}return n},St=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)<0&&(n=i)}return n}}));function wt(e,t,n){P(t)||(t=e,e=0),P(n)||(n=1);let r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);for(;++r<i;)a[r]=e+r*n;return a}var Tt=t((()=>{xe()}));function Et(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}var Dt=t((()=>{}));function Ot(e){return Number(e)}var kt=t((()=>{})),At=t((()=>{}));function jt(e,t,n){let r=[t].concat([].slice.call(n));Mt&&console[e].apply(console,r)}var Mt,Nt,Pt,Ft=t((()=>{Ie(),Mt=typeof console<`u`,(function(e){e[e.None=0]=`None`,e[e.Error=1]=`Error`,e[e.Warn=2]=`Warn`,e[e.Info=3]=`Info`,e[e.Debug=4]=`Debug`})(Nt||={}),Pt=class e{static getInstance(t,n){return e._instance&&L(t)?e._instance.level(t):e._instance||=new e(t,n),e._instance}static setInstance(t){return e._instance=t}static setInstanceLevel(t){e._instance?e._instance.level(t):e._instance=new e(t)}static clearInstance(){e._instance=null}constructor(e=Nt.None,t){this._onErrorHandler=[],this._level=e,this._method=t}addErrorHandler(e){this._onErrorHandler.find((t=>t===e))||this._onErrorHandler.push(e)}removeErrorHandler(e){let t=this._onErrorHandler.findIndex((t=>t===e));t<0||this._onErrorHandler.splice(t,1)}callErrorHandler(...e){this._onErrorHandler.forEach((t=>t(...e)))}canLogInfo(){return this._level>=Nt.Info}canLogDebug(){return this._level>=Nt.Debug}canLogError(){return this._level>=Nt.Error}canLogWarn(){return this._level>=Nt.Warn}level(e){return arguments.length?(this._level=+e,this):this._level}error(...e){return this._level>=Nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):jt(this._method??`error`,`ERROR`,e)),this}warn(...e){return this._level>=Nt.Warn&&jt(this._method||`warn`,`WARN`,e),this}info(...e){return this._level>=Nt.Info&&jt(this._method||`log`,`INFO`,e),this}debug(...e){return this._level>=Nt.Debug&&jt(this._method||`log`,`DEBUG`,e),this}},Pt._instance=null}));function It(e,t,n=0,r){for(N(r)&&(r=e.length);n<r;){let i=n+r>>>1;Et(e[i],t)>0?r=i:n=i+1}return n}var Lt,Rt=t((()=>{Dt(),be(),Lt=(e,t,n)=>{let r=e,i=t;for(;r<i;){let e=Math.floor((r+i)/2);n(e)>=0?i=e:r=e+1}return r}}));function zt(e,t,n=Ut,r=Ht){let i=r,a=n*Math.max(e,t);return Math.abs(e-t)<=Math.max(i,a)}function Bt(e,t,n,r){return e>t&&!zt(e,t,n,r)}function Vt(e,t,n,r){return e<t&&!zt(e,t,n,r)}var Ht,Ut,Wt=t((()=>{Ht=1e-10,Ut=1e-10})),Gt,Kt=t((()=>{Gt=e=>{let t=null,n=null;return(...r)=>(t&&r.every(((e,n)=>e===t[n]))||(t=r,n=e(...r)),n)}})),qt,Jt=t((()=>{qt=function(e,t,n){return e<t?t:e>n?n:e}})),Yt,Xt=t((()=>{Yt=(e,t,n)=>{let[r,i]=e;i<r&&(r=e[1],i=e[0]);let a=i-r;return a>=n-t?[t,n]:(r=Math.min(Math.max(r,t),n-a),[r,r+a])}}));function Zt(e,t){let n;return e>t&&(n=e,e=t,t=n),n=>Math.max(e,Math.min(t,n))}var Qt=t((()=>{}));function $t(e,t,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&en;if(typeof e!=`function`)throw TypeError(`Expected a function`);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(cancelAnimationFrame(s),requestAnimationFrame(e)):setTimeout(e,t)}function g(e){let n=e-c;return c===void 0||n>=t||n<0||d&&e-l>=a}function _(){let e=Date.now();if(g(e))return v(e);s=h(_,function(e){let n=e-l,r=t-(e-c);return d?Math.min(r,a-n):r}(e))}function v(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function y(...e){let n=Date.now(),a=g(n);if(r=e,i=this,c=n,a){if(s===void 0)return function(e){return l=e,s=h(_,t),u?m(e):o}(c);if(d)return s=h(_,t),m(c)}return s===void 0&&(s=h(_,t)),o}return t=+t||0,F(n)&&(u=!!n.leading,d=`maxWait`in n,d&&(a=Math.max(R(n.maxWait)?n.maxWait:0,t)),f=`trailing`in n?!!n.trailing:f),y.cancel=function(){s!==void 0&&function(e){if(p)return cancelAnimationFrame(e);clearTimeout(e)}(s),l=0,r=c=i=s=void 0},y.flush=function(){return s===void 0?o:v(Date.now())},y.pending=function(){return s!==void 0},y}var en,tn=t((()=>{Se(),Le(),en=!1;try{en=typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`}catch{en=!1}en=!1}));function nn(e,t,n){let r=!0,i=!0;if(typeof e!=`function`)throw TypeError(`Expected a function`);return F(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),$t(e,t,{leading:r,trailing:i,maxWait:t})}var rn=t((()=>{tn(),Se()}));function an(e,t){return n=>e*(1-n)+t*n}function on(e,t){return function(n){return Math.round(e*(1-n)+t*n)}}function sn(e,t){let n=e.valueOf(),r=t.valueOf(),i=new Date;return e=>(i.setTime(n*(1-e)+r*e),i)}var cn,ln=t((()=>{cn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,new RegExp(cn.source,`g`)})),un=t((()=>{})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn=t((()=>{})),hn=t((()=>{})),gn=t((()=>{})),_n=t((()=>{})),vn=t((()=>{})),yn=t((()=>{})),bn=t((()=>{})),xn=t((()=>{ve(),ye(),be(),xe(),Se(),we(),Ee(),ge(),Oe(),Ae(),je(),Ne(),Fe(),Ie(),Le(),ze(),Ve(),Je(),Xe(),$e(),tt(),st(),lt(),pt(),_t(),Ct(),Tt(),At(),Rt(),At(),Wt(),Kt(),Jt(),Xt(),Qt(),tn(),rn(),ln(),kt(),un(),dn(),fn(),pn(),mn(),hn(),gn(),_n(),vn(),yn(),bn()})),Sn=t((()=>{}));function Cn(e){return e>1?0:e<-1?jn:Math.acos(e)}function wn(e){return e>=1?Mn:e<=-1?-Mn:Math.asin(e)}function Tn(e,t,n,r,i){let a=n,o=r;return typeof e==`number`&&typeof n==`number`&&(a=(1-i)*e+i*n),typeof t==`number`&&typeof r==`number`&&(o=(1-i)*t+i*r),{x:a,y:o}}function En(e,t){return e[0]*t[1]-e[1]*t[0]}function Dn(e,t){return Pn(e[0]-t[0])+Pn(e[1]-t[1])<1e-12}function On(e,t=10){return Math.round(e*t)/t}function kn(e){let t=e.toString().split(/[eE]/),n=(t[0].split(`.`)[1]||``).length-(+t[1]||0);return n>0?n:0}function An(e,t){return On(e-t,10**Math.max(kn(e),kn(t)))}var jn,Mn,Nn,V,Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn=t((()=>{jn=Math.PI,Mn=jn/2,Nn=2*jn,V=2*Math.PI,Pn=Math.abs,Fn=Math.atan2,In=Math.cos,Ln=Math.max,Rn=Math.min,zn=Math.sin,Bn=Math.sqrt,Vn=Math.pow})),Un,Wn,Gn=t((()=>{Ie(),Hn(),Un=class e{constructor(e=0,t=0,n,r){this.x=0,this.y=0,this.x=e,this.y=t,this.x1=n,this.y1=r}clone(){return new e(this.x,this.y)}copyFrom(e){return this.x=e.x,this.y=e.y,this.x1=e.x1,this.y1=e.y1,this.defined=e.defined,this.context=e.context,this}set(e,t){return this.x=e,this.y=t,this}add(e){return L(e)?(this.x+=e,void(this.y+=e)):(this.x+=e.x,this.y+=e.y,this)}sub(e){return L(e)?(this.x-=e,void(this.y-=e)):(this.x-=e.x,this.y-=e.y,this)}multi(e){throw Error(`暂不支持`)}div(e){throw Error(`暂不支持`)}},Wn=class{static distancePP(e,t){return Bn(Vn(e.x-t.x,2)+Vn(e.y-t.y,2))}static distanceNN(e,t,n,r){return Bn(Vn(e-n,2)+Vn(t-r,2))}static distancePN(e,t,n){return Bn(Vn(t-e.x,2)+Vn(n-e.y,2))}static pointAtPP(e,t,n){return new Un((t.x-e.x)*n+e.x,(t.y-e.y)*n+e.y)}}})),Kn=t((()=>{}));function qn(e){return Math.PI/180*e}function Jn(e){return 180*e/Math.PI}function Yn(e,t,n){return t?{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}:{x:e.x,y:e.y}}function Xn(e){for(;e<0;)e+=2*Math.PI;for(;e>=2*Math.PI;)e-=2*Math.PI;return e}function Zn(e,t){let n=Math.abs(t-e);if(n>=2*Math.PI||2*Math.PI-n<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];let r=Xn(Math.min(e,t)),i=r+n,a=[r,i],o=Math.floor(r/Math.PI)*Math.PI/2;for(;o<i;)o>r&&a.push(o),o+=Math.PI/2;return a}function Qn(e,t,n,r){let{x:i,y:a}=t,o=Zn(n,r),{width:s,height:c}=e,l=[];return o.forEach((e=>{let t=Math.sin(e),n=Math.cos(e);t===1?l.push(c-a):t===-1?l.push(a):n===1?l.push(s-i):n===-1?l.push(i):(t>0?l.push(Math.abs((c-a)/t)):l.push(Math.abs(a/t)),n>0?l.push(Math.abs((s-i)/n)):l.push(Math.abs(i/n)))})),Math.min.apply(null,l)}function $n(e){return(e=Xn(e))>0&&e<=Math.PI/2?2:e>Math.PI/2&&e<=Math.PI?3:e>Math.PI&&e<=3*Math.PI/2?4:1}var er,tr,nr=t((()=>{Hn(),er=(e=0)=>{if(e<0)for(;e<-Nn;)e+=Nn;else if(e>0)for(;e>Nn;)e-=Nn;return e},tr=er}));function rr(e,t,n){e[0]=t[0]-n[0],e[1]=t[1]-n[1]}function ir(e,t,n,r){let i=e[0],a=t[0],o=n[0],s=r[0];return a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i)&&(i=e[1],a=t[1],o=n[1],s=r[1],a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i))}function ar(e,t,n,r){if(!ir(e,t,n,r))return!1;let i=[0,0],a=[0,0],o=[0,0];if(rr(i,t,e),rr(a,r,n),Dn(i,a))return!0;rr(o,n,e);let s=En(o,a)/En(i,a);return s>=0&&s<=1&&[e[0]+i[0]*s,e[1]+i[1]*s]}function or(e,t,n){if(e===null)return t;if(t===null)return e;let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=hr(e,t,n);return r>=c||i<=s||a>=u||o<=l?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,s),y1:Math.max(a,l),x2:Math.min(i,c),y2:Math.min(o,u)}}function sr(e,t,n){if(e&&t){if(!n)return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1);let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=hr(e,t,!0);return!(r>c||i<s||a>u||o<l)}return!0}function cr(e,t,n){if(!t)return!0;if(!n)return e.x>=t.x1&&e.x<=t.x2&&e.y>=t.y1&&e.y<=t.y2;let r=t.x1,i=t.x2,a=t.y1,o=t.y2;return r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),e.x>=r&&e.x<=i&&e.y>=a&&e.y<=o}function lr(e,t){return Math.abs(t[0]*e[0]+t[1]*e[1])}function ur({x:e,y:t},n,r={x:0,y:0}){return{x:(e-r.x)*Math.cos(n)-(t-r.y)*Math.sin(n)+r.x,y:(e-r.x)*Math.sin(n)+(t-r.y)*Math.cos(n)+r.y}}function dr(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}}function fr(e,t){let n=t?qn(e.angle):e.angle,r=dr(e);return[ur({x:e.x1,y:e.y1},n,r),ur({x:e.x2,y:e.y1},n,r),ur({x:e.x2,y:e.y2},n,r),ur({x:e.x1,y:e.y2},n,r)]}function pr(e,t,n=!1){let r=fr(e,n),i=fr(t,n),a=(e,t)=>[t.x-e.x,t.y-e.y],o=a(dr(e),dr(t)),s=a(r[0],r[1]),c=a(r[1],r[2]),l=a(i[0],i[1]),u=a(i[1],i[2]),d=n?qn(e.angle):e.angle,f=n?qn(90-e.angle):e.angle+Mn,p=n?qn(t.angle):t.angle,m=n?qn(90-t.angle):t.angle+Mn;f>V&&(f-=V),m>V&&(m-=V);let h=(e,t,n,r)=>{let i=[Math.cos(t),Math.sin(t)];return e+(lr(i,n)+lr(i,r))/2>lr(i,o)};return h((e.x2-e.x1)/2,d,l,u)&&h((e.y2-e.y1)/2,f,l,u)&&h((t.x2-t.x1)/2,p,s,c)&&h((t.y2-t.y1)/2,m,s,c)}var mr,hr,gr=t((()=>{nr(),Hn(),(function(e){e[e.NONE=0]=`NONE`,e[e.BBOX1=1]=`BBOX1`,e[e.BBOX2=2]=`BBOX2`})(mr||={}),hr=(e,t,n)=>{let r=e.x1,i=e.x2,a=e.y1,o=e.y2,s=t.x1,c=t.x2,l=t.y1,u=t.y2;return n&&(r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),s>c&&([s,c]=[c,s]),l>u&&([l,u]=[u,l])),{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}}})),_r=t((()=>{})),vr=t((()=>{})),yr=t((()=>{gr(),_r(),vr()})),br=t((()=>{}));function xr(e,t,n,r,i,a){if(a>t&&a>r||a<t&&a<r||r===t)return 0;let o=(a-t)/(r-t),s=r<t?1:-1;o!==1&&o!==0||(s=r<t?.5:-.5);let c=o*(n-e)+e;return c===i?1/0:c>i?s:0}var Sr=t((()=>{})),Cr=t((()=>{})),wr,Tr=t((()=>{wr=e=>{let t=e.charCodeAt(0),n=e.length===2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r===12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r===8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r===172||r===175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r===161||r===164||167<=r&&r<=168||r===170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r===198||r===208||215<=r&&r<=216||222<=r&&r<=225||r===230||232<=r&&r<=234||236<=r&&r<=237||r===240||242<=r&&r<=243||247<=r&&r<=250||r===252||r===254||r===257||r===273||r===275||r===283||294<=r&&r<=295||r===299||305<=r&&r<=307||r===312||319<=r&&r<=322||r===324||328<=r&&r<=331||r===333||338<=r&&r<=339||358<=r&&r<=359||r===363||r===462||r===464||r===466||r===468||r===470||r===472||r===474||r===476||r===593||r===609||r===708||r===711||713<=r&&r<=715||r===717||r===720||728<=r&&r<=731||r===733||r===735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r===1025||1040<=r&&r<=1103||r===1105||r===8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r===8240||8242<=r&&r<=8243||r===8245||r===8251||r===8254||r===8308||r===8319||8321<=r&&r<=8324||r===8364||r===8451||r===8453||r===8457||r===8467||r===8470||8481<=r&&r<=8482||r===8486||r===8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r===8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r===8658||r===8660||r===8679||r===8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r===8715||r===8719||r===8721||r===8725||r===8730||8733<=r&&r<=8736||r===8739||r===8741||8743<=r&&r<=8748||r===8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r===8776||r===8780||r===8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r===8853||r===8857||r===8869||r===8895||r===8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r===9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r===9711||9733<=r&&r<=9734||r===9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r===9756||r===9758||r===9792||r===9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r===9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r===9955||9960<=r&&r<=9983||r===10045||r===10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r===65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`}}));function Er(e,t={},n){n||=1;let{fontStyle:r=t.fontStyle,fontVariant:i=t.fontVariant,fontWeight:a=t.fontWeight,fontSize:o=t.fontSize,fontFamily:s=t.fontFamily}=e;return(r?r+` `:``)+(i?i+` `:``)+(a?a+` `:``)+o*n+`px `+(s||`sans-serif`)}var Dr=t((()=>{})),Or,kr=t((()=>{xn(),Tr(),Dr(),Or=class e{constructor(e,t){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet=`-/: .,@%'"~`,this._option=e,this._userSpec=t??{},this.textSpec=this._initSpec(),P(e.specialCharSet)&&(this.specialCharSet=e.specialCharSet),this._standardMethod=P(e.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(N(this._canvas)&&(P(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),N(this._canvas)&&typeof window<`u`&&window.document!==void 0&&globalThis&&P(globalThis.document)&&(this._canvas=globalThis.document.createElement(`canvas`))),N(this._context)&&P(this._canvas)){let e=this._canvas.getContext(`2d`);P(e)&&(e.save(),e.font=Er(this.textSpec),this._contextSaved=!0,this._context=e)}return!N(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){let{defaultFontParams:e={}}=this._option,{fontStyle:t=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight??`normal`,fontSize:i=e.fontSize??12,fontFamily:a=e.fontFamily??`sans-serif`,align:o,textAlign:s=o??`center`,baseline:c,textBaseline:l=c??`middle`,ellipsis:u,limit:d}=this._userSpec,{lineHeight:f=i}=this._userSpec;return ke(f)&&f[f.length-1]===`%`&&(f=i*(Number.parseFloat(f.substring(0,f.length-1))/100)),{fontStyle:t,fontVariant:n,fontFamily:a,fontSize:i,fontWeight:r,textAlign:s,textBaseline:l,ellipsis:u,limit:d,lineHeight:f}}measure(e,t){switch(t){case`vrender`:case`canopus`:return this.fullMeasure(e);case`canvas`:return this.measureWithNaiveCanvas(e);case`simple`:return this.quickMeasureWithoutCanvas(e);default:return this.quickMeasure(e)}}fullMeasure(e){if(N(e))return{width:0,height:0};if(N(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(e);let{fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:o,limit:s,lineHeight:c}=this.textSpec,l;try{let u=this._option.getTextBounds({text:e,fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:!!o,maxLineWidth:s||1/0,lineHeight:c});l={width:u.width(),height:u.height()}}catch{this._notSupportVRender=!0,l=this.measureWithNaiveCanvas(e)}return l}measureWithNaiveCanvas(e){return this._measureReduce(e,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(e){if(!this.initContext())return this._quickMeasureWithoutCanvas(e);let t=this._context.measureText(e),{fontSize:n,lineHeight:r}=this.textSpec;return{width:t.width,height:r??n,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}quickMeasure(e){return this._measureReduce(e,this._quickMeasure.bind(this))}_quickMeasure(t){let n={width:0,height:0};for(let r=0;r<t.length;r++){let i=t[r],a=this._measureSpecialChar(i);N(a)&&e.NUMBERS_CHAR_SET.includes(i)&&(a=this._measureNumberChar()),N(a)&&[`F`,`W`].includes(wr(i))&&(a=this._measureFullSizeChar()),N(a)&&(a=this._measureLetterChar()),n.width+=a.width,n.height=Math.max(n.height,a.height),!N(a.fontBoundingBoxAscent)&&(n.fontBoundingBoxAscent=a.fontBoundingBoxAscent),!N(a.fontBoundingBoxDescent)&&(n.fontBoundingBoxDescent=a.fontBoundingBoxDescent)}return n}quickMeasureWithoutCanvas(e){return this._measureReduce(e,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(e){let t={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let r=0;r<e.length;r++){let i=e[r],a=[`F`,`W`].includes(wr(i))?1:.53;t.width+=a*n}return t.height=r??n,t}_measureReduce(e,t){let{fontSize:n,lineHeight:r}=this.textSpec,i={width:0,height:0};if(N(e))return i;if(I(e)){let a=e.filter(P).map((e=>e.toString()));return a.length===0?i:a.length===1?t(a[0]):{width:a.reduce(((e,n)=>Math.max(e,t(n).width)),0),height:a.length*((r??n)+1)+1}}return t(e.toString())}_measureNumberChar(){if(N(this._numberCharSize)){let t=this._standardMethod(e.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/e.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return N(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(e.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(N(this._letterCharSize)){let t=this._standardMethod(e.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/e.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(e){return P(this._specialCharSizeMap[e])?this._specialCharSizeMap[e]:this.specialCharSet.includes(e)?(this._specialCharSizeMap[e]=this._standardMethod(e),this._specialCharSizeMap[e]):null}release(){P(this._canvas)&&(this._canvas=null),P(this._context)&&(this._contextSaved&&=(this._context.restore(),!1),this._context=null)}},Or.ALPHABET_CHAR_SET=`abcdefghijklmnopqrstuvwxyz`,Or.NUMBERS_CHAR_SET=`0123456789`,Or.FULL_SIZE_CHAR=`字`})),Ar=t((()=>{})),jr=t((()=>{kr(),Ar(),Dr()})),Mr=t((()=>{Tr(),jr()})),Nr,Pr,Fr,Ir=t((()=>{Nr=(e,t)=>{let{x1:n,x2:r,y1:i,y2:a}=e,o=Math.abs(r-n),s=Math.abs(a-i),c=(n+r)/2,l=(i+a)/2,u=0,d=0;switch(t){case`top`:case`inside-top`:d=-.5;break;case`bottom`:case`inside-bottom`:d=.5;break;case`left`:case`inside-left`:u=-.5;break;case`right`:case`inside-right`:u=.5;break;case`top-right`:u=.5,d=-.5;break;case`top-left`:u=-.5,d=-.5;break;case`bottom-right`:u=.5,d=.5;break;case`bottom-left`:u=-.5,d=.5}return c+=u*o,l+=d*s,{x:c,y:l}},Pr=(e,t)=>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),Fr=(e,t)=>{let n=[{x:Math.cos(e.angle),y:Math.sin(e.angle)},{x:-Math.sin(e.angle),y:Math.cos(e.angle)},{x:Math.cos(t.angle),y:Math.sin(e.angle)},{x:-Math.sin(t.angle),y:Math.cos(e.angle)}];function r(e,t,n){let r=e.getRotatedCorners().map((e=>e.x*t+e.y*n));return{min:Math.min(...r),max:Math.max(...r)}}let i=0;for(let a of n){let n=r(e,a.x,a.y),o=r(t,a.x,a.y),s;s=n.max<o.min?o.min-n.max:o.max<n.min?n.min-o.max:0,i=Math.max(i,s)}return i}})),Lr=t((()=>{Kn(),yr(),br(),Sr(),Cr(),Mr(),Ir()}));function Rr(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=t;return n.onlyTranslate()?(e!==t&&e.setValue(t.x1,t.y1,t.x2,t.y2),e.translate(n.e,n.f),t):(e.clear(),e.add(n.a*r+n.c*i+n.e,n.b*r+n.d*i+n.f),e.add(n.a*a+n.c*i+n.e,n.b*a+n.d*i+n.f),e.add(n.a*a+n.c*o+n.e,n.b*a+n.d*o+n.f),e.add(n.a*r+n.c*o+n.e,n.b*r+n.d*o+n.f),t)}var zr,Br,Vr,Hr=t((()=>{xn(),Lr(),zr=class e{constructor(e){e?this.setValue(e.x1,e.y1,e.x2,e.y2):this.clear()}clone(){return new e(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}setValue(e=0,t=0,n=0,r=0){return this.x1=e,this.y1=t,this.x2=n,this.y2=r,this}set(e=0,t=0,n=0,r=0){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),r<t?(this.y2=t,this.y1=r):(this.y1=t,this.y2=r),this}add(e=0,t=0){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this}expand(e=0){return I(e)?(this.y1-=e[0],this.x2+=e[1],this.y2+=e[2],this.x1-=e[3]):(this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(e=0,t=0){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}rotate(e=0,t=0,n=0){let r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(e=0,t=0,n=0,r=0){let i=this.scalePoints(e,t,n,r);return this.clear().add(i[0],i[1]).add(i[2],i[3])}union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this}intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this}encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2}alignsWith(e){return e&&(this.x1===e.x1||this.x2===e.x2||this.y1===e.y1||this.y2===e.y2)}intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)}contains(e=0,t=0){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)}containsPoint(e){return!(e.x<this.x1||e.x>this.x2||e.y<this.y1||e.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(e=0){return this.x1*=e,this.x2*=e,this}scaleY(e=0){return this.y1*=e,this.y2*=e,this}transformWithMatrix(e){return Rr(this,this,e),this}copy(e){return this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2,this}rotatedPoints(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(e),c=Math.sin(e),l=t-t*s+n*c,u=n-t*c-n*s;return[s*r-c*i+l,c*r+s*i+u,s*r-c*o+l,c*r+s*o+u,s*a-c*i+l,c*a+s*i+u,s*a-c*o+l,c*a+s*o+u]}scalePoints(e,t,n,r){let{x1:i,y1:a,x2:o,y2:s}=this;return[e*i+(1-e)*n,t*a+(1-t)*r,e*o+(1-e)*n,t*s+(1-t)*r]}},Br=class extends zr{},Vr=class e extends zr{constructor(e,t=0){super(e),e&&(this.angle=e.angle??t)}intersects(e){return pr(this,e)}setValue(e=0,t=0,n=0,r=0,i=0){return super.setValue(e,t,n,r),this.angle=i,this}clone(){return new e(this)}getRotatedCorners(){let e={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ur({x:this.x1,y:this.y1},this.angle,e),ur({x:this.x2,y:this.y1},this.angle,e),ur({x:this.x1,y:this.y2},this.angle,e),ur({x:this.x2,y:this.y2},this.angle,e)]}}}));function Ur(e,t,n,r,i,a,o,s){let c=t.a,l=t.b,u=t.c,d=t.d,f=t.e,p=t.f,m=In(o),h=zn(o),g,_;s?(g=s[0],_=s[1]):(g=n,_=r);let v=g-n,y=_-r,b=c*m+u*h,x=l*m+d*h,S=u*m-c*h,C=d*m-l*h;e.a=i*b,e.b=i*x,e.c=a*S,e.d=a*C,e.e=f+c*g+u*_-b*v-S*y,e.f=p+l*g+d*_-x*v-C*y}var Wr,Gr=t((()=>{nr(),Hn(),Wr=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a}equalToMatrix(e){return this.e===e.e&&this.f===e.f&&this.a===e.a&&this.d===e.d&&this.b===e.b&&this.c===e.c}equalTo(e,t,n,r,i,a){return this.e===i&&this.f===a&&this.a===e&&this.d===r&&this.b===t&&this.c===n}setValue(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){let t=this.a,n=this.b,r=this.c,i=this.d,a=this.e,o=this.f,s=new e,c=t*i-n*r;return s.a=i/c,s.b=-n/c,s.c=-r/c,s.d=t/c,s.e=(r*o-i*a)/c,s.f=-(t*o-n*a)/c,s}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a*t+this.c*n,i=this.b*t+this.d*n,a=this.a*-n+this.c*t,o=this.b*-n+this.d*t;return this.a=r,this.b=i,this.c=a,this.d=o,this}rotateByCenter(e,t,n){let r=Math.cos(e),i=Math.sin(e),a=(1-r)*t+i*n,o=(1-r)*n-i*t,s=r*this.a-i*this.b,c=i*this.a+r*this.b,l=r*this.c-i*this.d,u=i*this.c+r*this.d,d=r*this.e-i*this.f+a,f=i*this.e+r*this.f+o;return this.a=s,this.b=c,this.c=l,this.d=u,this.e=d,this.f=f,this}scale(e,t){return this.a*=e,this.b*=e,this.c*=t,this.d*=t,this}setScale(e,t){return this.b=this.b/this.a*e,this.c=this.c/this.d*t,this.a=e,this.d=t,this}transform(e,t,n,r,i,a){return this.multiply(e,t,n,r,i,a),this}translate(e,t){return this.e+=this.a*e+this.c*t,this.f+=this.b*e+this.d*t,this}transpose(){let{a:e,b:t,c:n,d:r,e:i,f:a}=this;return this.a=t,this.b=e,this.c=r,this.d=n,this.e=a,this.f=i,this}multiply(e,t,n,r,i,a){let o=this.a,s=this.b,c=this.c,l=this.d,u=o*e+c*t,d=s*e+l*t,f=o*n+c*r,p=s*n+l*r,m=o*i+c*a+this.e,h=s*i+l*a+this.f;return this.a=u,this.b=d,this.c=f,this.d=p,this.e=m,this.f=h,this}interpolate(t,n){let r=new e;return r.a=this.a+(t.a-this.a)*n,r.b=this.b+(t.b-this.b)*n,r.c=this.c+(t.c-this.c)*n,r.d=this.d+(t.d-this.d)*n,r.e=this.e+(t.e-this.e)*n,r.f=this.f+(t.f-this.f)*n,r}transformPoint(e,t){let{a:n,b:r,c:i,d:a,e:o,f:s}=this,c=n*a-r*i,l=a/c,u=-r/c,d=-i/c,f=n/c,p=(i*s-a*o)/c,m=-(n*s-r*o)/c,{x:h,y:g}=e;t.x=h*l+g*d+p,t.y=h*u+g*f+m}onlyTranslate(e=1){return this.a===e&&this.b===0&&this.c===0&&this.d===e}clone(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){let e=this.a,t=this.b,n=this.c,r=this.d,i=e*r-t*n,a={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!==0||t!==0){let o=Math.sqrt(e*e+t*t);a.rotateDeg=t>0?Math.acos(e/o):-Math.acos(e/o),a.scaleX=o,a.scaleY=i/o,a.skewX=(e*n+t*r)/i,a.skewY=0}else if(n!==0||r!==0){let o=Math.sqrt(n*n+r*r);a.rotateDeg=Math.PI/2-(r>0?Math.acos(-n/o):-Math.acos(n/o)),a.scaleX=i/o,a.scaleY=o,a.skewX=0,a.skewY=(e*n+t*r)/i}return a.rotateDeg=Jn(a.rotateDeg),a}}})),Kr=t((()=>{Sn(),Gn(),Hr(),Gr()})),qr,Jr=t((()=>{qr=class{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(e,t){let{CLEAN_THRESHOLD:n=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:i=this.R_COUNT}=t;if(e.size<n)return 0;let a=0,o=t=>{a++,e.delete(t)},s=Date.now();return e.forEach(((e,t)=>{if(e.timestamp.length<i)return o(t);let n=0;for(;s-e.timestamp[e.timestamp.length-1-n]<r&&(n++,!(n>=i)););if(n<i)return o(t);for(;s-e.timestamp[0]>r;)e.timestamp.shift()})),a}addLimitedTimestamp(e,t,n){let{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=n;e.timestamp.length>r&&e.timestamp.shift(),e.timestamp.push(t)}clearTimeStamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();e.forEach((e=>{for(;r-e.timestamp[0]>n;)e.timestamp.shift()}))}clearItemTimestamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();for(;r-e.timestamp[0]>n;)e.timestamp.shift()}}}));function Yr(e,t,n){t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<60?(o=r,s=i,c=0):60<=e&&e<120?(o=i,s=r,c=0):120<=e&&e<180?(o=0,s=r,c=i):180<=e&&e<240?(o=0,s=i,c=r):240<=e&&e<300?(o=i,s=0,c=r):300<=e&&e<360&&(o=r,s=0,c=i),o=Math.round(255*(o+a)),s=Math.round(255*(s+a)),c=Math.round(255*(c+a)),{r:o,g:s,b:c}}var Xr=t((()=>{}));function Zr(e,t,n){e/=255,t/=255,n/=255;let r=Math.min(e,t,n),i=Math.max(e,t,n),a=i-r,o=0,s=0,c=0;return o=a===0?0:i===e?(t-n)/a%6:i===t?(n-e)/a+2:(e-t)/a+4,o=Math.round(60*o),o<0&&(o+=360),c=(i+r)/2,s=a===0?0:a/(1-Math.abs(2*c-1)),s=+(100*s).toFixed(1),c=+(100*c).toFixed(1),{h:o,s,l:c}}var Qr=t((()=>{}));function $r(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?`0`:``)+e.toString(16)}function ei(e){return L(e)?new li(e>>16,e>>8&255,255&e,1):I(e)?new li(e[0],e[1],e[2]):new li(255,255,255)}function ti(e){return L(e)?new li(e>>>24,e>>>16&255,e>>>8&255,255&e):I(e)?new li(e[0],e[1],e[2],e[3]):new li(255,255,255,1)}function ni(e){return e<.04045?.0773993808*e:(.9478672986*e+.0521327014)**2.4}function ri(e){return e<.0031308?12.92*e:1.055*e**.41666-.055}var ii,ai,oi,si,ci,li,ui=t((()=>{xn(),Xr(),Qr(),ii=/^#([0-9a-f]{3,8})$/,ai={transparent:4294967040},oi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},si=(e,t)=>{let n=ii.exec(e);if(t||n){let e=parseInt(n[1],16),t=n[1].length;return t===3?new li((e>>8&15)+((e>>8&15)<<4),(e>>4&15)+((e>>4&15)<<4),(15&e)+((15&e)<<4),1):t===6?ei(e):t===8?new li(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):null}},ci=class e{static Brighter(t,n=1){return n===1?t:new e(t).brighter(n).toRGBA()}static SetOpacity(t,n=1){return n===1?t:new e(t).setOpacity(n).toRGBA()}static getColorBrightness(t,n=`hsl`){let r=t instanceof e?t:new e(t);switch(n){case`hsv`:default:return r.getHSVBrightness();case`hsl`:return r.getHSLBrightness();case`lum`:return r.getLuminance();case`lum2`:return r.getLuminance2();case`lum3`:return r.getLuminance3();case`wcag`:return r.getLuminanceWCAG()}}static parseColorString(e){if(P(ai[e]))return ti(ai[e]);if(P(oi[e]))return ei(oi[e]);let t=`${e}`.trim().toLowerCase(),n=si(t);if(n!==void 0)return n;if(/^(rgb|RGB|rgba|RGBA)/.test(t)){let e=t.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,``).split(`,`);return new li(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(t)){let e=t.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,``).split(`,`),n=Yr(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10));return new li(n.r,n.g,n.b,parseFloat(e[3]))}}constructor(t){let n=e.parseColorString(t);n?this.color=n:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new li(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e))),this}add(e){let{r:t,g:n,b:r}=this.color;return this.color.r+=Math.min(255,t+e.color.r),this.color.g+=Math.min(255,n+e.color.g),this.color.b+=Math.min(255,r+e.color.b),this}sub(e){return this.color.r=Math.max(0,this.color.r-e.color.r),this.color.g=Math.max(0,this.color.g-e.color.g),this.color.b=Math.max(0,this.color.b-e.color.b),this}multiply(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(e,t,n){let r=this.color.opacity,i=Zr(this.color.r,this.color.g,this.color.b),a=Yr(N(e)?i.h:qt(e,0,360),N(t)?i.s:t>=0&&t<=1?100*t:t,N(n)?i.l:n<=1&&n>=0?100*n:n);return this.color=new li(a.r,a.g,a.b,r),this}setRGB(e,t,n){return!N(e)&&(this.color.r=e),!N(t)&&(this.color.g=t),!N(n)&&(this.color.b=n),this}setHex(e){let t=`${e}`.trim().toLowerCase();return si(t,!0)??this}setColorName(e){let t=oi[e.toLowerCase()];return t===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(t),this}setScalar(e){return this.color.r=e,this.color.g=e,this.color.b=e,this}setOpacity(e=1){return this.color.opacity=e,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){let e=this.color.r/255,t=this.color.g/255,n=this.color.b/255,r,i,a;return r=e<=.03928?e/12.92:((e+.055)/1.055)**2.4,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,.2126*r+.7152*i+.0722*a}clone(){return new e(this.color.toString())}copyGammaToLinear(e,t=2){return this.color.r=e.color.r**+t,this.color.g=e.color.g**+t,this.color.b=e.color.b**+t,this}copyLinearToGamma(e,t=2){let n=t>0?1/t:1;return this.color.r=e.color.r**+n,this.color.g=e.color.g**+n,this.color.b=e.color.b**+n,this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.color.r=ni(e.color.r),this.color.g=ni(e.color.g),this.color.b=ni(e.color.b),this}copyLinearToSRGB(e){return this.color.r=ri(e.color.r),this.color.g=ri(e.color.g),this.color.b=ri(e.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}},li=class{constructor(e,t,n,r){this.r=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.g=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.b=isNaN(+n)?255:Math.max(0,Math.min(255,+n)),this.opacity=P(r)?isNaN(+r)?1:Math.max(0,Math.min(1,+r)):1}formatHex(){return`#${$r(this.r)+$r(this.g)+$r(this.b)+(this.opacity===1?``:$r(255*this.opacity))}`}formatRgb(){let e=this.opacity;return`${e===1?`rgb(`:`rgba(`}${this.r},${this.g},${this.b}${e===1?`)`:`,${e})`}`}formatHsl(){let e=this.opacity,{h:t,s:n,l:r}=Zr(this.r,this.g,this.b);return`${e===1?`hsl(`:`hsla(`}${t},${n}%,${r}%${e===1?`)`:`,${e})`}`}toString(){return this.formatHex()}}}));function di(e){let t=``,n=``,r=``,i=+(e[0]===`#`);for(let a=i;a<e.length;a++)e[a]!==`#`&&(a<i+2?t+=e[a]:a<i+4?n+=e[a]:a<i+6&&(r+=e[a]));return[parseInt(t,16),parseInt(n,16),parseInt(r,16)]}var fi=t((()=>{}));function pi(e,t,n){return Number((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}var mi=t((()=>{}));function hi(e,t){let n=e.r,r=t.r,i=e.g,a=t.g,o=e.b,s=t.b,c=e.opacity,l=t.opacity;return e=>{let t=Math.round(n*(1-e)+r*e),u=Math.round(i*(1-e)+a*e),d=Math.round(o*(1-e)+s*e);return new li(t,u,d,c*(1-e)+l*e)}}var gi=t((()=>{ui()})),_i=r({Color:()=>ci,DEFAULT_COLORS:()=>oi,RGB:()=>li,hexToRgb:()=>di,hslToRgb:()=>Yr,interpolateRgb:()=>hi,rgbToHex:()=>pi,rgbToHsl:()=>Zr}),vi=t((()=>{ui(),fi(),Xr(),mi(),Qr(),gi()})),yi=t((()=>{}));function bi(e){if(R(e))return[e,e,e,e];if(I(e)){let t=e.length;if(t===1){let t=e[0];return[t,t,t,t]}if(t===2){let[t,n]=e;return[t,n,t,n]}if(t===3){let[t,n,r]=e;return[t,n,r,n]}if(t===4)return e}if(F(e)){let{top:t=0,right:n=0,bottom:r=0,left:i=0}=e;return[t,n,r,i]}return[0,0,0,0]}var xi=t((()=>{Le(),je(),Se()})),Si=t((()=>{})),Ci=t((()=>{})),wi=t((()=>{Si(),Ci()}));function Ti(e,t=0,n=0){if(!e)return{width:t,height:n};let r;try{r=window==null?void 0:window.getComputedStyle}catch{r=()=>({})}let i=r(e);if(/^(\d*\.?\d+)(px)$/.exec(i.width)){let r=parseFloat(i.width)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)||e.clientWidth-1,a=parseFloat(i.height)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)||e.clientHeight-1;return{width:r<=0?t:r,height:a<=0?n:a}}return{width:t,height:n}}function Ei(e){let{x:t,y:n}=e.getBoundingClientRect();return{x:t,y:n}}var Di,Oi,ki=t((()=>{Di=(e=``)=>{let t={};return e.split(`;`).forEach((e=>{if(e){let n=e.split(`:`);if(n.length===2){let e=n[0].trim(),r=n[1].trim();e&&r&&(t[e]=r)}}})),t},Oi=e=>e.replace(/([A-Z])/g,`-$1`).toLowerCase()})),Ai=t((()=>{})),ji=t((()=>{})),Mi=t((()=>{})),Ni=t((()=>{})),Pi=t((()=>{Ai(),ji(),Ni(),Mi()})),Fi,Ii=t((()=>{Fi=class e{static getInstance(){return e.instance||=new e,e.instance}constructor(){this.locale_shortWeekdays=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],this.locale_periods=[`AM`,`PM`],this.locale_weekdays=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],this.locale_shortMonths=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],this.numberRe=/^\s*\d+/,this.pads={"-":``,_:` `,0:`0`},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],this.formatShortWeekday=e=>this.locale_shortWeekdays[e.getDay()],this.formatWeekday=e=>this.locale_weekdays[e.getDay()],this.formatShortMonth=e=>this.locale_shortMonths[e.getMonth()],this.formatMonth=e=>this.locale_months[e.getMonth()],this.formatDayOfMonth=(e,t)=>this.pad(e.getDate(),t,2),this.formatHour24=(e,t)=>this.pad(e.getHours(),t,2),this.formatHour12=(e,t)=>this.pad(e.getHours()%12||12,t,2),this.formatMilliseconds=(e,t)=>this.pad(e.getMilliseconds(),t,3),this.formatMonthNumber=(e,t)=>this.pad(e.getMonth()+1,t,2),this.formatMinutes=(e,t)=>this.pad(e.getMinutes(),t,2),this.formatPeriod=e=>this.locale_periods[+(e.getHours()>=12)],this.formatSeconds=(e,t)=>this.pad(e.getSeconds(),t,2),this.formatFullYear=(e,t)=>this.pad(e.getFullYear()%1e4,t,4),this.formatUTCShortWeekday=e=>this.locale_shortWeekdays[e.getUTCDay()],this.formatUTCWeekday=e=>this.locale_weekdays[e.getUTCDay()],this.formatUTCShortMonth=e=>this.locale_shortMonths[e.getUTCMonth()],this.formatUTCMonth=e=>this.locale_months[e.getUTCMonth()],this.formatUTCDayOfMonth=(e,t)=>this.pad(e.getUTCDate(),t,2),this.formatUTCHour24=(e,t)=>this.pad(e.getUTCHours(),t,2),this.formatUTCHour12=(e,t)=>this.pad(e.getUTCHours()%12||12,t,2),this.formatUTCMilliseconds=(e,t)=>this.pad(e.getUTCMilliseconds(),t,3),this.formatUTCMonthNumber=(e,t)=>this.pad(e.getUTCMonth()+1,t,2),this.formatUTCMinutes=(e,t)=>this.pad(e.getUTCMinutes(),t,2),this.formatUTCPeriod=e=>this.locale_periods[+(e.getUTCHours()>=12)],this.formatUTCSeconds=(e,t)=>this.pad(e.getUTCSeconds(),t,2),this.formatUTCFullYear=(e,t)=>this.pad(e.getUTCFullYear()%1e4,t,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(e,t,n)=>{let r=this.shortWeekdayRe.exec(t.slice(n));return r?(e.w=this.shortWeekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseWeekday=(e,t,n)=>{let r=this.weekdayRe.exec(t.slice(n));return r?(e.w=this.weekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseShortMonth=(e,t,n)=>{let r=this.shortMonthRe.exec(t.slice(n));return r?(e.m=this.shortMonthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseMonth=(e,t,n)=>{let r=this.monthRe.exec(t.slice(n));return r?(e.m=this.monthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseDayOfMonth=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1},this.parseHour24=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1},this.parseMilliseconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1},this.parseMonthNumber=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.m=r-1,n+r[0].length):-1},this.parseMinutes=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1},this.parsePeriod=(e,t,n)=>{let r=this.periodRe.exec(t.slice(n));return r?(e.p=this.periodLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseSeconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1},this.parseFullYear=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(e,t)=>this.newFormat(e,this.formats)(new Date(this.getFullTimeStamp(t))),this.timeUTCFormat=(e,t)=>this.newFormat(e,this.utcFormats)(new Date(this.getFullTimeStamp(t))),this.timeParse=(e,t)=>this.newParse(e,!1)(t+``),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(e){return e.replace(this.requoteRe,`\\$&`)}localDate(e){if(0<=e.y&&e.y<100){let t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}utcDate(e){if(0<=e.y&&e.y<100){let t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}newDate(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}formatRe(e){return RegExp(`^(?:`+e.map(this.requoteF).join(`|`)+`)`,`i`)}formatLookup(e){return new Map(e.map(((e,t)=>[e.toLowerCase(),t])))}pad(e,t,n){let r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}parseSpecifier(e,t,n,r){let i=0,a=t.length,o=n.length,s,c;for(;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=this.parses[s in this.pads?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!==n.charCodeAt(r++))return-1}return r}newParse(e,t){let n=this;return function(r){let i=n.newDate(1900,void 0,1);return n.parseSpecifier(i,e,r+=``,0)===r.length?`Q`in i?new Date(i.Q):`s`in i?new Date(1e3*i.s+(`L`in i?i.L:0)):(t&&!(`Z`in i)&&(i.Z=0),`p`in i&&(i.H=i.H%12+12*i.p),i.m===void 0&&(i.m=`q`in i?i.q:0),`Z`in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,n.utcDate(i)):n.localDate(i)):null}}newFormat(e,t){let n=this;return function(r){let i=[],a=-1,o=0,s=e.length,c,l,u;for(r instanceof Date||(r=new Date(+r));++a<s;)e.charCodeAt(a)===37&&(i.push(e.slice(o,a)),(l=n.pads[c=e.charAt(++a)])?c=e.charAt(++a):l=c===`e`?` `:`0`,u=t[c],c=u(r,l),i.push(c),o=a+1);return i.push(e.slice(o,a)),i.join(``)}}getFullTimeStamp(e){let t=parseInt(e+``,10);return String(t).length===10?1e3*t:t}}})),Li=t((()=>{})),Ri=t((()=>{})),zi=t((()=>{Ri(),Li()})),Bi=t((()=>{})),Vi=t((()=>{})),Hi=t((()=>{})),Ui=t((()=>{Bi(),Vi(),Hi()})),Wi,H=t((()=>{Wi=n(me()),xn(),Kr(),Jr(),Hn(),nr(),vi(),Lr(),yi(),Ft(),xi(),wi(),ki(),Pi(),vi(),Ii(),zi(),Ui()})),Gi=(e,t)=>{let{callback:n}=t;return n&&(e=e.filter(n)),e};H();var Ki=function(e,...t){return Yi(et(e),...t)};function qi(e,t,n){let r=t[n];if(r===void 0)e[n]=null;else if(F(r)){F(e[n])||(e[n]={});for(let t in r)qi(e[n],r,t)}else e[n]=r}function Ji(e,t){if(F(t)&&e!==t)for(let n in t)qi(e,t,n)}function Yi(e,...t){e||={};let n=-1,r=t.length;for(;++n<r;)Ji(e,t[n]);return e}var Xi;(function(e){e.DSV=`dsv`,e.TREE=`tree`,e.GEO=`geo`,e.BYTE=`bytejson`,e.HEX=`hex`,e.GRAPH=`graph`,e.TABLE=`table`,e.GEO_GRATICULE=`geo-graticule`})(Xi||={});var Zi=(e,t)=>{let{fields:n,key:r,value:i,retains:a}=t,o=[];for(let t=0;t<e.length;t++)n.forEach((s=>{let c={};if(c[r]=s,c[i]=e[t][s],a)a.forEach((n=>{c[n]=e[t][n]}));else for(let r in e[t])n.indexOf(r)===-1&&(c[r]=e[t][r]);o.push(c)}));return o};H();var Qi=(e,t)=>{if(!t?.fields||e.length===0)return e;let n=t.fields,r=e[0],i={},a=[];for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t)){let o=n[t];if(o.sort&&(R(o.sortIndex)||(o.sortIndex=0),P(o.sortReverse)||(o.sortReverse=o.sort===`desc`)),!o.type){let n=r;t in r||(n=e.find((e=>t in e))??r),o.type=typeof n[t]==`number`?`linear`:`ordinal`}let s;if(typeof o.sortIndex==`number`&&(s={key:t,type:o.type,index:o.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===o.sortReverse},a.push(s)),o.domain?.length>0){if(o.type===`ordinal`){o._domainCache={},i[t]=o;let e={};o.domain.forEach(((t,n)=>{e[t]=n,o._domainCache[t]=n})),s&&(s.sortIndex=e,s.sortIndexCount=o.domain.length)}else o.domain.length>=2&&(i[t]=o)}}return Object.keys(i).length>0&&(e=e.filter((e=>{for(let t in i){let n=i[t];if(n.type===`ordinal`){if(!(e[t]in n._domainCache))return!1}else if(n.domain[0]>e[t]||n.domain[1]<e[t])return!1}return!0}))),a.sort(((e,t)=>e.index-t.index)),e.sort(((e,t)=>$i(e,t,a))),e};function $i(e,t,n){for(let r=0;r<n.length;r++){let i=n[r],a=0;if(i.type===`ordinal`?(i.sortIndex[t[i.key]]===void 0&&(i.sortIndex[t[i.key]]=i.sortIndexCount++),i.sortIndex[e[i.key]]===void 0&&(i.sortIndex[e[i.key]]=i.sortIndexCount++),a=i.sortIndex[e[i.key]]-i.sortIndex[t[i.key]]):i.type===`linear`&&(a=e[i.key]-t[i.key]),i.sortReverse&&(a=-a),a!==0)return a}return 0}var ea={},ta={},na=34,ra=10,ia=13;function aa(e){return Function(`d`,`return {`+e.map(function(e,t){return JSON.stringify(e)+`: d[`+t+`] || ""`}).join(`,`)+`}`)}function oa(e,t){var n=aa(e);return function(r,i){return t(n(r),i,e)}}function sa(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}function ca(e,t){var n=e+``,r=n.length;return r<t?Array(t-r+1).join(0)+n:n}function la(e){return e<0?`-`+ca(-e,6):e>9999?`+`+ca(e,6):ca(e,4)}function ua(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?`Invalid Date`:la(e.getUTCFullYear(),4)+`-`+ca(e.getUTCMonth()+1,2)+`-`+ca(e.getUTCDate(),2)+(i?`T`+ca(t,2)+`:`+ca(n,2)+`:`+ca(r,2)+`.`+ca(i,3)+`Z`:r?`T`+ca(t,2)+`:`+ca(n,2)+`:`+ca(r,2)+`Z`:n||t?`T`+ca(t,2)+`:`+ca(n,2)+`Z`:``)}function da(e){var t=RegExp(`["`+e+`
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-C0FnF6B9.js";import{t as a}from"./react-DiVRNtpo.js";import{t as o}from"./jsx-runtime-BdxMnOeJ.js";import{d as s}from"./log-7fGlFSON.js";import{n as c}from"./useTheme-B_JDh31l.js";import{O as l}from"./genui-CZI72r1O.js";import{t as u}from"./runDetached-BWsF_7Xo.js";import{t as d}from"./chart-renderer-DQLdORyQ.js";var f=n(a(),1);function p(e){let t=e.h*Math.PI/180,n=e.c*Math.cos(t),r=e.c*Math.sin(t),i=e.l+.3963377774*n+.2158037573*r,a=e.l-.1055613458*n-.0638541728*r,o=e.l-.0894841775*n-1.291485548*r,s=i**3,c=a**3,l=o**3;return[4.0767416621*s-3.3077115913*c+.2309699292*l,-1.2684380046*s+2.6097574011*c-.3413193965*l,-.0041960863*s-.7034186147*c+1.707614701*l]}var m=/^oklch\(\s*([0-9.]+)(%?)\s+([0-9.]+)\s+([0-9.]+)\s*(?:\/\s*([0-9.]+)(%?)\s*)?\)$/i;function h(e){let t=m.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=t[5]===void 0?1:Number(t[5])/(t[6]?100:1);return{l:t[2]?n/100:n,c:Number(t[3]),h:Number(t[4]),alpha:r}}function g(e){let t=Math.max(0,Math.min(1,e)),n=t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055;return Math.round(n*255)}function _(e,t=1){let[n,r,i]=p(e).map(g);return t>=1?`rgb(${n}, ${r}, ${i})`:`rgba(${n}, ${r}, ${i}, ${t})`}function v(e,t){let n=h(e);return n?_(n,n.alpha):e.trim()||t}function y(e){let t=(t,n)=>v(e(t,``),n),n=Array.from({length:8},(e,n)=>t(`--chart-${n+1}`,`rgb(42, 120, 214)`)),r=t(`--muted-foreground`,`rgb(115, 107, 108)`);return{series:n,compare:r,increase:n[0]??r,decrease:n[7]??r,total:r,grid:t(`--chart-grid`,`rgb(236, 232, 232)`),axis:t(`--chart-axis`,`rgb(204, 198, 198)`),text:t(`--foreground`,`rgb(30, 24, 25)`),mutedText:r,surface:t(`--card`,`rgb(255, 253, 253)`),fontFamily:e(`--kanna-font-body`,`ui-sans-serif, system-ui, sans-serif`)}}var b=.1,x=[4,3],S=11;function C(e,t){return{x:e.x,xLabel:e.xLabel,series:e.series,seriesLabel:t.get(e.series)??e.series,value:e.value,start:e.start??0,end:e.end??e.value}}function w(e,t){switch(e.role){case`compare`:return t.compare;case`increase`:return t.increase;case`decrease`:return t.decrease;case`total`:return t.total;default:return t.series[e.slot??0]??t.series[0]??t.text}}function T(e,t){return{type:`ordinal`,domain:e.series.map(e=>e.label),range:e.series.map(e=>w(e,t))}}function E(e,t){return e.series.some(e=>e.label===t&&e.role===`compare`)}var D=`seriesLabel`;function O(e,t){let n=e?.[t];return typeof n==`string`?n:``}function k(e){let t=e?.value;return typeof t==`number`?t:null}function A(e){let t=t=>l(k(t),e.format);return{mark:{title:{value:e=>O(e,`xLabel`)},content:[{key:e=>O(e,`seriesLabel`),value:t}]},dimension:{title:{value:e=>O(e,`xLabel`)},content:[{key:e=>O(e,`seriesLabel`),value:t}]}}}function ee(e){return e.kind!==`line`&&e.kind!==`area`}function te(e,t){let n={fill:t.mutedText,fontSize:S,fontFamily:t.fontFamily};return[{orient:`left`,type:`linear`,label:{style:n,formatMethod:t=>l(Number(t),e.format,{compact:!0})},grid:{visible:!0,style:{stroke:t.grid,lineWidth:1,lineDash:[]}},domainLine:{visible:!1},tick:{visible:!1}},{orient:`bottom`,type:`band`,sampling:!ee(e),label:{style:n,autoLimit:!0,formatMethod:t=>e.xLabels[String(t)]??String(t)},domainLine:{visible:!0,style:{stroke:t.axis,lineWidth:1}},tick:{visible:!1},grid:{visible:!1}}]}function ne(e,t){return{visible:e.series.length>=2,orient:`top`,position:`start`,item:{label:{style:{fill:t.text,fontSize:S,fontFamily:t.fontFamily}}}}}function re(e,t){let n=new Map(e.series.map(e=>[e.id,e.label]));return{data:[{id:`points`,values:e.points.map(e=>C(e,n))}],background:`transparent`,padding:{top:8,right:12,bottom:4,left:4},color:T(e,t),tooltip:A(e),legends:ne(e,t)}}function ie(e,t){switch(e.kind){case`line`:return oe(e,t);case`area`:return se(e,t);case`bar`:case`stacked-bar`:return ce(e,t);case`combo`:return le(e,t);case`waterfall`:return ue(e,t);case`composition`:return de(e,t)}}function ae(e){return{xField:{visible:!0,line:{type:`line`,style:{stroke:e.axis,lineWidth:1}}}}}function oe(e,t){return{type:`line`,...re(e,t),xField:`x`,yField:`value`,seriesField:D,axes:te(e,t),crosshair:ae(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`,lineDash:t=>E(e,O(t,`seriesLabel`))?x:[]}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}}function se(e,t){return{type:`area`,...re(e,t),xField:`x`,yField:`value`,seriesField:D,axes:te(e,t),crosshair:ae(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`}},area:{style:{fillOpacity:t=>E(e,O(t,`seriesLabel`))?0:b}},point:{visible:!1}}}function ce(e,t){let n=e.kind===`stacked-bar`,r=!n&&e.series.length>1;return{type:`bar`,...re(e,t),xField:r?[`x`,D]:`x`,yField:`value`,seriesField:D,stack:n,barMaxWidth:24,barGapInGroup:2,axes:te(e,t),bar:{style:{cornerRadius:n?0:[4,4,0,0],stroke:t.surface,lineWidth:n?2:0}}}}function le(e,t){let[n,r]=e.series,i=re(e,t),a=new Map(e.series.map(e=>[e.id,e.label])),o=t=>e.points.filter(e=>e.series===t).map(e=>C(e,a));return{type:`common`,background:i.background,padding:i.padding,color:i.color,tooltip:i.tooltip,legends:i.legends,data:[{id:`bars`,values:o(n?.id)},{id:`line`,values:o(r?.id)}],series:[{type:`bar`,dataIndex:0,xField:`x`,yField:`value`,seriesField:D,barMaxWidth:24,bar:{style:{cornerRadius:[4,4,0,0]}}},{type:`line`,dataIndex:1,xField:`x`,yField:`value`,seriesField:D,line:{style:{lineWidth:2}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}],axes:te(e,t).map(e=>e.orient===`left`?{...e,seriesIndex:[0,1]}:e)}}function ue(e,t){return{type:`rangeColumn`,...re(e,t),xField:`x`,minField:`start`,maxField:`end`,seriesField:D,barMaxWidth:24,axes:te(e,t),bar:{style:{cornerRadius:2}}}}function de(e,t){return{type:`pie`,...re(e,t),categoryField:D,valueField:`value`,innerRadius:.62,outerRadius:.9,pie:{style:{stroke:t.surface,lineWidth:2}}}}var fe=e=>e,pe;(function(e){e[`desktop-browser`]=`desktop-browser`,e[`mobile-browser`]=`mobile-browser`,e.node=`node`,e.worker=`worker`,e.miniApp=`miniApp`,e.wx=`wx`,e.tt=`tt`,e.harmony=`harmony`,e[`desktop-miniApp`]=`desktop-miniApp`,e.lynx=`lynx`})(pe||={});var j;(function(e){e.cartesianAxis=`cartesianAxis`,e.cartesianBandAxis=`cartesianAxis-band`,e.cartesianLinearAxis=`cartesianAxis-linear`,e.cartesianTimeAxis=`cartesianAxis-time`,e.cartesianLogAxis=`cartesianAxis-log`,e.cartesianSymlogAxis=`cartesianAxis-symlog`,e.polarAxis=`polarAxis`,e.polarBandAxis=`polarAxis-band`,e.polarLinearAxis=`polarAxis-linear`,e.crosshair=`crosshair`,e.cartesianCrosshair=`cartesianCrosshair`,e.polarCrosshair=`polarCrosshair`,e.dataZoom=`dataZoom`,e.geoCoordinate=`geoCoordinate`,e.indicator=`indicator`,e.discreteLegend=`discreteLegend`,e.continuousLegend=`continuousLegend`,e.colorLegend=`colorLegend`,e.sizeLegend=`sizeLegend`,e.markLine=`markLine`,e.markArea=`markArea`,e.markPoint=`markPoint`,e.polarMarkLine=`polarMarkLine`,e.polarMarkArea=`polarMarkArea`,e.polarMarkPoint=`polarMarkPoint`,e.geoMarkPoint=`geoMarkPoint`,e.tooltip=`tooltip`,e.title=`title`,e.player=`player`,e.scrollBar=`scrollBar`,e.label=`label`,e.totalLabel=`totalLabel`,e.brush=`brush`,e.poptip=`poptip`,e.customMark=`customMark`})(j||={});var me=i(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)})),he,ge=t((()=>{he=(e,t)=>Object.prototype.toString.call(e)===`[object ${t}]`})),_e,ve=t((()=>{ge(),_e=(e,t=!1)=>t?typeof e==`boolean`:!0===e||!1===e||he(e,`Boolean`)})),M,ye=t((()=>{M=e=>typeof e==`function`})),N,be=t((()=>{N=e=>e==null})),P,xe=t((()=>{P=e=>e!=null})),F,Se=t((()=>{F=e=>{let t=typeof e;return e!==null&&t===`object`||t===`function`}})),Ce,we=t((()=>{Ce=e=>typeof e==`object`&&!!e})),Te,Ee=t((()=>{we(),ge(),Te=function(e){if(!Ce(e)||!he(e,`Object`))return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}})),De,Oe=t((()=>{De=e=>e===void 0})),ke,Ae=t((()=>{ge(),ke=(e,t=!1)=>{let n=typeof e;return t?n===`string`:n===`string`||he(e,`String`)}})),I,je=t((()=>{ge(),I=e=>Array.isArray?Array.isArray(e):he(e,`Array`)})),Me,Ne=t((()=>{Me=function(e){return e!==null&&typeof e!=`function`&&Number.isFinite(e.length)}})),Pe,Fe=t((()=>{ge(),Pe=e=>he(e,`Date`)})),L,Ie=t((()=>{ge(),L=(e,t=!1)=>{let n=typeof e;return t?n===`number`:n===`number`||he(e,`Number`)}})),R,Le=t((()=>{Ie(),R=e=>L(e)&&Number.isFinite(e)})),Re,ze=t((()=>{Re=e=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(e)})),Be,Ve=t((()=>{Be=e=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(e)})),He,Ue=t((()=>{He=e=>({}).toString.call(e).replace(/^\[object /,``).replace(/]$/,``)})),We,Ge,Ke=t((()=>{We=Object.prototype,Ge=function(e){let t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||We)}}));function z(e){if(N(e))return!0;if(Me(e))return!e.length;let t=He(e);if(t===`Map`||t===`Set`)return!e.size;if(Ge(e))return!Object.keys(e).length;for(let t in e)if(qe.call(e,t))return!1;return!0}var qe,Je=t((()=>{be(),Ne(),Ue(),Ke(),qe=Object.prototype.hasOwnProperty})),Ye,Xe=t((()=>{Ae(),Ye=(e,t,n)=>{let r=ke(t)?t.split(`.`):t;for(let t=0;t<r.length;t++)e=e?e[r[t]]:void 0;return e===void 0?n:e}})),Ze,Qe,$e=t((()=>{Ze=Object.prototype.hasOwnProperty,Qe=(e,t)=>e!=null&&Ze.call(e,t)}));function et(e,t,n){let r;if(!P(e)||typeof e!=`object`||t&&t(e))return e;let i=I(e),a=e.length;r=i?Array(a):typeof e==`object`?{}:_e(e)||L(e)||ke(e)?e:Pe(e)?new Date(+e):void 0;let o=i?void 0:Object.keys(Object(e)),s=-1;if(r)for(;++s<(o||e).length;){let i=o?o[s]:s,a=e[i];n&&n.includes(i.toString())?r[i]=a:r[i]=et(a,t,n)}return r}var tt=t((()=>{je(),ve(),Fe(),Ie(),Ae(),xe()}));function nt(e,t,n=!1,r=!1){if(t){if(e===t)return;if(P(t)&&typeof t==`object`){let i=Object(t),a=[];for(let e in i)a.push(e);let{length:o}=a,s=-1;for(;o--;){let o=a[++s];!P(i[o])||typeof i[o]!=`object`||r&&I(e[o])?it(e,o,i[o]):rt(e,t,o,n,r)}}}}function rt(e,t,n,r=!1,i=!1){let a=e[n],o=t[n],s=t[n],c=!0;if(I(o)){if(r)s=[];else if(I(a))s=a;else if(Me(a)){s=Array(a.length);let e=-1,t=a.length;for(;++e<t;)s[e]=a[e]}}else Te(o)?(s=a??{},typeof a!=`function`&&typeof a==`object`||(s={})):c=!1;c&&nt(s,o,r,i),it(e,n,s)}function it(e,t,n){(n!==void 0&&!at(e[t],n)||n===void 0&&!(t in e))&&(e[t]=n)}function at(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function ot(e,...t){let n=-1,r=t.length;for(;++n<r;)nt(e,t[n],!0);return e}var st=t((()=>{je(),Ne(),Ee(),xe()}));function ct(e,t){if(!e||!Te(e))return e;let n={};return Object.keys(e).forEach((r=>{let i=e[r],a=!1;t.forEach((e=>{(ke(e)&&e===r||e instanceof RegExp&&r.match(e))&&(a=!0)})),a||(n[r]=i)})),n}var lt=t((()=>{Ee(),Ae()}));function ut(e){return Object.prototype.toString.call(e)}function dt(e){return Object.keys(e)}function ft(e,t,n){if(e===t)return!0;if(typeof e!=typeof t||e==null||t==null)return!1;if(Number.isNaN(e)&&Number.isNaN(t))return!0;if(ut(e)!==ut(t))return!1;if(M(e))return!!n?.skipFunction;if(typeof e!=`object`)return!1;if(I(e)){if(e.length!==t.length)return!1;for(let r=e.length-1;r>=0;r--)if(!ft(e[r],t[r],n))return!1;return!0}if(!Te(e))return!1;let r=dt(e),i=dt(t);if(r.length!==i.length)return!1;r.sort(),i.sort();for(let e=r.length-1;e>=0;e--)if(r[e]!=i[e])return!1;for(let i=r.length-1;i>=0;i--){let a=r[i];if(!ft(e[a],t[a],n))return!1}return!0}var pt=t((()=>{je(),ye(),Ee()}));function mt(e){if(!e)return[];if(Object.keys)return Object.keys(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(n);return t}function ht(e,t,n){let r=mt(t);for(let i=0;i<r.length;i++){let a=r[i];(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}return e}function gt(e,t,n=!0){if(e=`prototype`in e?e.prototype:e,t=`prototype`in t?t.prototype:t,Object.getOwnPropertyNames){let r=Object.getOwnPropertyNames(t);for(let i=0;i<r.length;i++){let a=r[i];a!==`constructor`&&(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}}else ht(e,t,n)}var _t=t((()=>{}));function B(e){return P(e)?I(e)?e:[e]:[]}function vt(e){if(Me(e))return e[e.length-1]}function yt(e,t){if(!I(e)||!I(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function bt(e){if(!I(e))return[e];let t=[];for(let n of e)t.push(...bt(n));return t}var xt,St,Ct=t((()=>{je(),Ne(),xe(),xt=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)>0&&(n=i)}return n},St=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)<0&&(n=i)}return n}}));function wt(e,t,n){P(t)||(t=e,e=0),P(n)||(n=1);let r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);for(;++r<i;)a[r]=e+r*n;return a}var Tt=t((()=>{xe()}));function Et(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}var Dt=t((()=>{}));function Ot(e){return Number(e)}var kt=t((()=>{})),At=t((()=>{}));function jt(e,t,n){let r=[t].concat([].slice.call(n));Mt&&console[e].apply(console,r)}var Mt,Nt,Pt,Ft=t((()=>{Ie(),Mt=typeof console<`u`,(function(e){e[e.None=0]=`None`,e[e.Error=1]=`Error`,e[e.Warn=2]=`Warn`,e[e.Info=3]=`Info`,e[e.Debug=4]=`Debug`})(Nt||={}),Pt=class e{static getInstance(t,n){return e._instance&&L(t)?e._instance.level(t):e._instance||=new e(t,n),e._instance}static setInstance(t){return e._instance=t}static setInstanceLevel(t){e._instance?e._instance.level(t):e._instance=new e(t)}static clearInstance(){e._instance=null}constructor(e=Nt.None,t){this._onErrorHandler=[],this._level=e,this._method=t}addErrorHandler(e){this._onErrorHandler.find((t=>t===e))||this._onErrorHandler.push(e)}removeErrorHandler(e){let t=this._onErrorHandler.findIndex((t=>t===e));t<0||this._onErrorHandler.splice(t,1)}callErrorHandler(...e){this._onErrorHandler.forEach((t=>t(...e)))}canLogInfo(){return this._level>=Nt.Info}canLogDebug(){return this._level>=Nt.Debug}canLogError(){return this._level>=Nt.Error}canLogWarn(){return this._level>=Nt.Warn}level(e){return arguments.length?(this._level=+e,this):this._level}error(...e){return this._level>=Nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):jt(this._method??`error`,`ERROR`,e)),this}warn(...e){return this._level>=Nt.Warn&&jt(this._method||`warn`,`WARN`,e),this}info(...e){return this._level>=Nt.Info&&jt(this._method||`log`,`INFO`,e),this}debug(...e){return this._level>=Nt.Debug&&jt(this._method||`log`,`DEBUG`,e),this}},Pt._instance=null}));function It(e,t,n=0,r){for(N(r)&&(r=e.length);n<r;){let i=n+r>>>1;Et(e[i],t)>0?r=i:n=i+1}return n}var Lt,Rt=t((()=>{Dt(),be(),Lt=(e,t,n)=>{let r=e,i=t;for(;r<i;){let e=Math.floor((r+i)/2);n(e)>=0?i=e:r=e+1}return r}}));function zt(e,t,n=Ut,r=Ht){let i=r,a=n*Math.max(e,t);return Math.abs(e-t)<=Math.max(i,a)}function Bt(e,t,n,r){return e>t&&!zt(e,t,n,r)}function Vt(e,t,n,r){return e<t&&!zt(e,t,n,r)}var Ht,Ut,Wt=t((()=>{Ht=1e-10,Ut=1e-10})),Gt,Kt=t((()=>{Gt=e=>{let t=null,n=null;return(...r)=>(t&&r.every(((e,n)=>e===t[n]))||(t=r,n=e(...r)),n)}})),qt,Jt=t((()=>{qt=function(e,t,n){return e<t?t:e>n?n:e}})),Yt,Xt=t((()=>{Yt=(e,t,n)=>{let[r,i]=e;i<r&&(r=e[1],i=e[0]);let a=i-r;return a>=n-t?[t,n]:(r=Math.min(Math.max(r,t),n-a),[r,r+a])}}));function Zt(e,t){let n;return e>t&&(n=e,e=t,t=n),n=>Math.max(e,Math.min(t,n))}var Qt=t((()=>{}));function $t(e,t,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&en;if(typeof e!=`function`)throw TypeError(`Expected a function`);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(cancelAnimationFrame(s),requestAnimationFrame(e)):setTimeout(e,t)}function g(e){let n=e-c;return c===void 0||n>=t||n<0||d&&e-l>=a}function _(){let e=Date.now();if(g(e))return v(e);s=h(_,function(e){let n=e-l,r=t-(e-c);return d?Math.min(r,a-n):r}(e))}function v(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function y(...e){let n=Date.now(),a=g(n);if(r=e,i=this,c=n,a){if(s===void 0)return function(e){return l=e,s=h(_,t),u?m(e):o}(c);if(d)return s=h(_,t),m(c)}return s===void 0&&(s=h(_,t)),o}return t=+t||0,F(n)&&(u=!!n.leading,d=`maxWait`in n,d&&(a=Math.max(R(n.maxWait)?n.maxWait:0,t)),f=`trailing`in n?!!n.trailing:f),y.cancel=function(){s!==void 0&&function(e){if(p)return cancelAnimationFrame(e);clearTimeout(e)}(s),l=0,r=c=i=s=void 0},y.flush=function(){return s===void 0?o:v(Date.now())},y.pending=function(){return s!==void 0},y}var en,tn=t((()=>{Se(),Le(),en=!1;try{en=typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`}catch{en=!1}en=!1}));function nn(e,t,n){let r=!0,i=!0;if(typeof e!=`function`)throw TypeError(`Expected a function`);return F(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),$t(e,t,{leading:r,trailing:i,maxWait:t})}var rn=t((()=>{tn(),Se()}));function an(e,t){return n=>e*(1-n)+t*n}function on(e,t){return function(n){return Math.round(e*(1-n)+t*n)}}function sn(e,t){let n=e.valueOf(),r=t.valueOf(),i=new Date;return e=>(i.setTime(n*(1-e)+r*e),i)}var cn,ln=t((()=>{cn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,new RegExp(cn.source,`g`)})),un=t((()=>{})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn=t((()=>{})),hn=t((()=>{})),gn=t((()=>{})),_n=t((()=>{})),vn=t((()=>{})),yn=t((()=>{})),bn=t((()=>{})),xn=t((()=>{ve(),ye(),be(),xe(),Se(),we(),Ee(),ge(),Oe(),Ae(),je(),Ne(),Fe(),Ie(),Le(),ze(),Ve(),Je(),Xe(),$e(),tt(),st(),lt(),pt(),_t(),Ct(),Tt(),At(),Rt(),At(),Wt(),Kt(),Jt(),Xt(),Qt(),tn(),rn(),ln(),kt(),un(),dn(),fn(),pn(),mn(),hn(),gn(),_n(),vn(),yn(),bn()})),Sn=t((()=>{}));function Cn(e){return e>1?0:e<-1?jn:Math.acos(e)}function wn(e){return e>=1?Mn:e<=-1?-Mn:Math.asin(e)}function Tn(e,t,n,r,i){let a=n,o=r;return typeof e==`number`&&typeof n==`number`&&(a=(1-i)*e+i*n),typeof t==`number`&&typeof r==`number`&&(o=(1-i)*t+i*r),{x:a,y:o}}function En(e,t){return e[0]*t[1]-e[1]*t[0]}function Dn(e,t){return Pn(e[0]-t[0])+Pn(e[1]-t[1])<1e-12}function On(e,t=10){return Math.round(e*t)/t}function kn(e){let t=e.toString().split(/[eE]/),n=(t[0].split(`.`)[1]||``).length-(+t[1]||0);return n>0?n:0}function An(e,t){return On(e-t,10**Math.max(kn(e),kn(t)))}var jn,Mn,Nn,V,Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn=t((()=>{jn=Math.PI,Mn=jn/2,Nn=2*jn,V=2*Math.PI,Pn=Math.abs,Fn=Math.atan2,In=Math.cos,Ln=Math.max,Rn=Math.min,zn=Math.sin,Bn=Math.sqrt,Vn=Math.pow})),Un,Wn,Gn=t((()=>{Ie(),Hn(),Un=class e{constructor(e=0,t=0,n,r){this.x=0,this.y=0,this.x=e,this.y=t,this.x1=n,this.y1=r}clone(){return new e(this.x,this.y)}copyFrom(e){return this.x=e.x,this.y=e.y,this.x1=e.x1,this.y1=e.y1,this.defined=e.defined,this.context=e.context,this}set(e,t){return this.x=e,this.y=t,this}add(e){return L(e)?(this.x+=e,void(this.y+=e)):(this.x+=e.x,this.y+=e.y,this)}sub(e){return L(e)?(this.x-=e,void(this.y-=e)):(this.x-=e.x,this.y-=e.y,this)}multi(e){throw Error(`暂不支持`)}div(e){throw Error(`暂不支持`)}},Wn=class{static distancePP(e,t){return Bn(Vn(e.x-t.x,2)+Vn(e.y-t.y,2))}static distanceNN(e,t,n,r){return Bn(Vn(e-n,2)+Vn(t-r,2))}static distancePN(e,t,n){return Bn(Vn(t-e.x,2)+Vn(n-e.y,2))}static pointAtPP(e,t,n){return new Un((t.x-e.x)*n+e.x,(t.y-e.y)*n+e.y)}}})),Kn=t((()=>{}));function qn(e){return Math.PI/180*e}function Jn(e){return 180*e/Math.PI}function Yn(e,t,n){return t?{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}:{x:e.x,y:e.y}}function Xn(e){for(;e<0;)e+=2*Math.PI;for(;e>=2*Math.PI;)e-=2*Math.PI;return e}function Zn(e,t){let n=Math.abs(t-e);if(n>=2*Math.PI||2*Math.PI-n<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];let r=Xn(Math.min(e,t)),i=r+n,a=[r,i],o=Math.floor(r/Math.PI)*Math.PI/2;for(;o<i;)o>r&&a.push(o),o+=Math.PI/2;return a}function Qn(e,t,n,r){let{x:i,y:a}=t,o=Zn(n,r),{width:s,height:c}=e,l=[];return o.forEach((e=>{let t=Math.sin(e),n=Math.cos(e);t===1?l.push(c-a):t===-1?l.push(a):n===1?l.push(s-i):n===-1?l.push(i):(t>0?l.push(Math.abs((c-a)/t)):l.push(Math.abs(a/t)),n>0?l.push(Math.abs((s-i)/n)):l.push(Math.abs(i/n)))})),Math.min.apply(null,l)}function $n(e){return(e=Xn(e))>0&&e<=Math.PI/2?2:e>Math.PI/2&&e<=Math.PI?3:e>Math.PI&&e<=3*Math.PI/2?4:1}var er,tr,nr=t((()=>{Hn(),er=(e=0)=>{if(e<0)for(;e<-Nn;)e+=Nn;else if(e>0)for(;e>Nn;)e-=Nn;return e},tr=er}));function rr(e,t,n){e[0]=t[0]-n[0],e[1]=t[1]-n[1]}function ir(e,t,n,r){let i=e[0],a=t[0],o=n[0],s=r[0];return a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i)&&(i=e[1],a=t[1],o=n[1],s=r[1],a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i))}function ar(e,t,n,r){if(!ir(e,t,n,r))return!1;let i=[0,0],a=[0,0],o=[0,0];if(rr(i,t,e),rr(a,r,n),Dn(i,a))return!0;rr(o,n,e);let s=En(o,a)/En(i,a);return s>=0&&s<=1&&[e[0]+i[0]*s,e[1]+i[1]*s]}function or(e,t,n){if(e===null)return t;if(t===null)return e;let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=hr(e,t,n);return r>=c||i<=s||a>=u||o<=l?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,s),y1:Math.max(a,l),x2:Math.min(i,c),y2:Math.min(o,u)}}function sr(e,t,n){if(e&&t){if(!n)return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1);let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=hr(e,t,!0);return!(r>c||i<s||a>u||o<l)}return!0}function cr(e,t,n){if(!t)return!0;if(!n)return e.x>=t.x1&&e.x<=t.x2&&e.y>=t.y1&&e.y<=t.y2;let r=t.x1,i=t.x2,a=t.y1,o=t.y2;return r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),e.x>=r&&e.x<=i&&e.y>=a&&e.y<=o}function lr(e,t){return Math.abs(t[0]*e[0]+t[1]*e[1])}function ur({x:e,y:t},n,r={x:0,y:0}){return{x:(e-r.x)*Math.cos(n)-(t-r.y)*Math.sin(n)+r.x,y:(e-r.x)*Math.sin(n)+(t-r.y)*Math.cos(n)+r.y}}function dr(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}}function fr(e,t){let n=t?qn(e.angle):e.angle,r=dr(e);return[ur({x:e.x1,y:e.y1},n,r),ur({x:e.x2,y:e.y1},n,r),ur({x:e.x2,y:e.y2},n,r),ur({x:e.x1,y:e.y2},n,r)]}function pr(e,t,n=!1){let r=fr(e,n),i=fr(t,n),a=(e,t)=>[t.x-e.x,t.y-e.y],o=a(dr(e),dr(t)),s=a(r[0],r[1]),c=a(r[1],r[2]),l=a(i[0],i[1]),u=a(i[1],i[2]),d=n?qn(e.angle):e.angle,f=n?qn(90-e.angle):e.angle+Mn,p=n?qn(t.angle):t.angle,m=n?qn(90-t.angle):t.angle+Mn;f>V&&(f-=V),m>V&&(m-=V);let h=(e,t,n,r)=>{let i=[Math.cos(t),Math.sin(t)];return e+(lr(i,n)+lr(i,r))/2>lr(i,o)};return h((e.x2-e.x1)/2,d,l,u)&&h((e.y2-e.y1)/2,f,l,u)&&h((t.x2-t.x1)/2,p,s,c)&&h((t.y2-t.y1)/2,m,s,c)}var mr,hr,gr=t((()=>{nr(),Hn(),(function(e){e[e.NONE=0]=`NONE`,e[e.BBOX1=1]=`BBOX1`,e[e.BBOX2=2]=`BBOX2`})(mr||={}),hr=(e,t,n)=>{let r=e.x1,i=e.x2,a=e.y1,o=e.y2,s=t.x1,c=t.x2,l=t.y1,u=t.y2;return n&&(r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),s>c&&([s,c]=[c,s]),l>u&&([l,u]=[u,l])),{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}}})),_r=t((()=>{})),vr=t((()=>{})),yr=t((()=>{gr(),_r(),vr()})),br=t((()=>{}));function xr(e,t,n,r,i,a){if(a>t&&a>r||a<t&&a<r||r===t)return 0;let o=(a-t)/(r-t),s=r<t?1:-1;o!==1&&o!==0||(s=r<t?.5:-.5);let c=o*(n-e)+e;return c===i?1/0:c>i?s:0}var Sr=t((()=>{})),Cr=t((()=>{})),wr,Tr=t((()=>{wr=e=>{let t=e.charCodeAt(0),n=e.length===2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r===12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r===8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r===172||r===175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r===161||r===164||167<=r&&r<=168||r===170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r===198||r===208||215<=r&&r<=216||222<=r&&r<=225||r===230||232<=r&&r<=234||236<=r&&r<=237||r===240||242<=r&&r<=243||247<=r&&r<=250||r===252||r===254||r===257||r===273||r===275||r===283||294<=r&&r<=295||r===299||305<=r&&r<=307||r===312||319<=r&&r<=322||r===324||328<=r&&r<=331||r===333||338<=r&&r<=339||358<=r&&r<=359||r===363||r===462||r===464||r===466||r===468||r===470||r===472||r===474||r===476||r===593||r===609||r===708||r===711||713<=r&&r<=715||r===717||r===720||728<=r&&r<=731||r===733||r===735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r===1025||1040<=r&&r<=1103||r===1105||r===8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r===8240||8242<=r&&r<=8243||r===8245||r===8251||r===8254||r===8308||r===8319||8321<=r&&r<=8324||r===8364||r===8451||r===8453||r===8457||r===8467||r===8470||8481<=r&&r<=8482||r===8486||r===8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r===8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r===8658||r===8660||r===8679||r===8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r===8715||r===8719||r===8721||r===8725||r===8730||8733<=r&&r<=8736||r===8739||r===8741||8743<=r&&r<=8748||r===8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r===8776||r===8780||r===8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r===8853||r===8857||r===8869||r===8895||r===8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r===9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r===9711||9733<=r&&r<=9734||r===9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r===9756||r===9758||r===9792||r===9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r===9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r===9955||9960<=r&&r<=9983||r===10045||r===10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r===65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`}}));function Er(e,t={},n){n||=1;let{fontStyle:r=t.fontStyle,fontVariant:i=t.fontVariant,fontWeight:a=t.fontWeight,fontSize:o=t.fontSize,fontFamily:s=t.fontFamily}=e;return(r?r+` `:``)+(i?i+` `:``)+(a?a+` `:``)+o*n+`px `+(s||`sans-serif`)}var Dr=t((()=>{})),Or,kr=t((()=>{xn(),Tr(),Dr(),Or=class e{constructor(e,t){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet=`-/: .,@%'"~`,this._option=e,this._userSpec=t??{},this.textSpec=this._initSpec(),P(e.specialCharSet)&&(this.specialCharSet=e.specialCharSet),this._standardMethod=P(e.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(N(this._canvas)&&(P(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),N(this._canvas)&&typeof window<`u`&&window.document!==void 0&&globalThis&&P(globalThis.document)&&(this._canvas=globalThis.document.createElement(`canvas`))),N(this._context)&&P(this._canvas)){let e=this._canvas.getContext(`2d`);P(e)&&(e.save(),e.font=Er(this.textSpec),this._contextSaved=!0,this._context=e)}return!N(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){let{defaultFontParams:e={}}=this._option,{fontStyle:t=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight??`normal`,fontSize:i=e.fontSize??12,fontFamily:a=e.fontFamily??`sans-serif`,align:o,textAlign:s=o??`center`,baseline:c,textBaseline:l=c??`middle`,ellipsis:u,limit:d}=this._userSpec,{lineHeight:f=i}=this._userSpec;return ke(f)&&f[f.length-1]===`%`&&(f=i*(Number.parseFloat(f.substring(0,f.length-1))/100)),{fontStyle:t,fontVariant:n,fontFamily:a,fontSize:i,fontWeight:r,textAlign:s,textBaseline:l,ellipsis:u,limit:d,lineHeight:f}}measure(e,t){switch(t){case`vrender`:case`canopus`:return this.fullMeasure(e);case`canvas`:return this.measureWithNaiveCanvas(e);case`simple`:return this.quickMeasureWithoutCanvas(e);default:return this.quickMeasure(e)}}fullMeasure(e){if(N(e))return{width:0,height:0};if(N(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(e);let{fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:o,limit:s,lineHeight:c}=this.textSpec,l;try{let u=this._option.getTextBounds({text:e,fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:!!o,maxLineWidth:s||1/0,lineHeight:c});l={width:u.width(),height:u.height()}}catch{this._notSupportVRender=!0,l=this.measureWithNaiveCanvas(e)}return l}measureWithNaiveCanvas(e){return this._measureReduce(e,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(e){if(!this.initContext())return this._quickMeasureWithoutCanvas(e);let t=this._context.measureText(e),{fontSize:n,lineHeight:r}=this.textSpec;return{width:t.width,height:r??n,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}quickMeasure(e){return this._measureReduce(e,this._quickMeasure.bind(this))}_quickMeasure(t){let n={width:0,height:0};for(let r=0;r<t.length;r++){let i=t[r],a=this._measureSpecialChar(i);N(a)&&e.NUMBERS_CHAR_SET.includes(i)&&(a=this._measureNumberChar()),N(a)&&[`F`,`W`].includes(wr(i))&&(a=this._measureFullSizeChar()),N(a)&&(a=this._measureLetterChar()),n.width+=a.width,n.height=Math.max(n.height,a.height),!N(a.fontBoundingBoxAscent)&&(n.fontBoundingBoxAscent=a.fontBoundingBoxAscent),!N(a.fontBoundingBoxDescent)&&(n.fontBoundingBoxDescent=a.fontBoundingBoxDescent)}return n}quickMeasureWithoutCanvas(e){return this._measureReduce(e,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(e){let t={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let r=0;r<e.length;r++){let i=e[r],a=[`F`,`W`].includes(wr(i))?1:.53;t.width+=a*n}return t.height=r??n,t}_measureReduce(e,t){let{fontSize:n,lineHeight:r}=this.textSpec,i={width:0,height:0};if(N(e))return i;if(I(e)){let a=e.filter(P).map((e=>e.toString()));return a.length===0?i:a.length===1?t(a[0]):{width:a.reduce(((e,n)=>Math.max(e,t(n).width)),0),height:a.length*((r??n)+1)+1}}return t(e.toString())}_measureNumberChar(){if(N(this._numberCharSize)){let t=this._standardMethod(e.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/e.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return N(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(e.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(N(this._letterCharSize)){let t=this._standardMethod(e.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/e.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(e){return P(this._specialCharSizeMap[e])?this._specialCharSizeMap[e]:this.specialCharSet.includes(e)?(this._specialCharSizeMap[e]=this._standardMethod(e),this._specialCharSizeMap[e]):null}release(){P(this._canvas)&&(this._canvas=null),P(this._context)&&(this._contextSaved&&=(this._context.restore(),!1),this._context=null)}},Or.ALPHABET_CHAR_SET=`abcdefghijklmnopqrstuvwxyz`,Or.NUMBERS_CHAR_SET=`0123456789`,Or.FULL_SIZE_CHAR=`字`})),Ar=t((()=>{})),jr=t((()=>{kr(),Ar(),Dr()})),Mr=t((()=>{Tr(),jr()})),Nr,Pr,Fr,Ir=t((()=>{Nr=(e,t)=>{let{x1:n,x2:r,y1:i,y2:a}=e,o=Math.abs(r-n),s=Math.abs(a-i),c=(n+r)/2,l=(i+a)/2,u=0,d=0;switch(t){case`top`:case`inside-top`:d=-.5;break;case`bottom`:case`inside-bottom`:d=.5;break;case`left`:case`inside-left`:u=-.5;break;case`right`:case`inside-right`:u=.5;break;case`top-right`:u=.5,d=-.5;break;case`top-left`:u=-.5,d=-.5;break;case`bottom-right`:u=.5,d=.5;break;case`bottom-left`:u=-.5,d=.5}return c+=u*o,l+=d*s,{x:c,y:l}},Pr=(e,t)=>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),Fr=(e,t)=>{let n=[{x:Math.cos(e.angle),y:Math.sin(e.angle)},{x:-Math.sin(e.angle),y:Math.cos(e.angle)},{x:Math.cos(t.angle),y:Math.sin(e.angle)},{x:-Math.sin(t.angle),y:Math.cos(e.angle)}];function r(e,t,n){let r=e.getRotatedCorners().map((e=>e.x*t+e.y*n));return{min:Math.min(...r),max:Math.max(...r)}}let i=0;for(let a of n){let n=r(e,a.x,a.y),o=r(t,a.x,a.y),s;s=n.max<o.min?o.min-n.max:o.max<n.min?n.min-o.max:0,i=Math.max(i,s)}return i}})),Lr=t((()=>{Kn(),yr(),br(),Sr(),Cr(),Mr(),Ir()}));function Rr(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=t;return n.onlyTranslate()?(e!==t&&e.setValue(t.x1,t.y1,t.x2,t.y2),e.translate(n.e,n.f),t):(e.clear(),e.add(n.a*r+n.c*i+n.e,n.b*r+n.d*i+n.f),e.add(n.a*a+n.c*i+n.e,n.b*a+n.d*i+n.f),e.add(n.a*a+n.c*o+n.e,n.b*a+n.d*o+n.f),e.add(n.a*r+n.c*o+n.e,n.b*r+n.d*o+n.f),t)}var zr,Br,Vr,Hr=t((()=>{xn(),Lr(),zr=class e{constructor(e){e?this.setValue(e.x1,e.y1,e.x2,e.y2):this.clear()}clone(){return new e(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}setValue(e=0,t=0,n=0,r=0){return this.x1=e,this.y1=t,this.x2=n,this.y2=r,this}set(e=0,t=0,n=0,r=0){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),r<t?(this.y2=t,this.y1=r):(this.y1=t,this.y2=r),this}add(e=0,t=0){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this}expand(e=0){return I(e)?(this.y1-=e[0],this.x2+=e[1],this.y2+=e[2],this.x1-=e[3]):(this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(e=0,t=0){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}rotate(e=0,t=0,n=0){let r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(e=0,t=0,n=0,r=0){let i=this.scalePoints(e,t,n,r);return this.clear().add(i[0],i[1]).add(i[2],i[3])}union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this}intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this}encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2}alignsWith(e){return e&&(this.x1===e.x1||this.x2===e.x2||this.y1===e.y1||this.y2===e.y2)}intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)}contains(e=0,t=0){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)}containsPoint(e){return!(e.x<this.x1||e.x>this.x2||e.y<this.y1||e.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(e=0){return this.x1*=e,this.x2*=e,this}scaleY(e=0){return this.y1*=e,this.y2*=e,this}transformWithMatrix(e){return Rr(this,this,e),this}copy(e){return this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2,this}rotatedPoints(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(e),c=Math.sin(e),l=t-t*s+n*c,u=n-t*c-n*s;return[s*r-c*i+l,c*r+s*i+u,s*r-c*o+l,c*r+s*o+u,s*a-c*i+l,c*a+s*i+u,s*a-c*o+l,c*a+s*o+u]}scalePoints(e,t,n,r){let{x1:i,y1:a,x2:o,y2:s}=this;return[e*i+(1-e)*n,t*a+(1-t)*r,e*o+(1-e)*n,t*s+(1-t)*r]}},Br=class extends zr{},Vr=class e extends zr{constructor(e,t=0){super(e),e&&(this.angle=e.angle??t)}intersects(e){return pr(this,e)}setValue(e=0,t=0,n=0,r=0,i=0){return super.setValue(e,t,n,r),this.angle=i,this}clone(){return new e(this)}getRotatedCorners(){let e={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ur({x:this.x1,y:this.y1},this.angle,e),ur({x:this.x2,y:this.y1},this.angle,e),ur({x:this.x1,y:this.y2},this.angle,e),ur({x:this.x2,y:this.y2},this.angle,e)]}}}));function Ur(e,t,n,r,i,a,o,s){let c=t.a,l=t.b,u=t.c,d=t.d,f=t.e,p=t.f,m=In(o),h=zn(o),g,_;s?(g=s[0],_=s[1]):(g=n,_=r);let v=g-n,y=_-r,b=c*m+u*h,x=l*m+d*h,S=u*m-c*h,C=d*m-l*h;e.a=i*b,e.b=i*x,e.c=a*S,e.d=a*C,e.e=f+c*g+u*_-b*v-S*y,e.f=p+l*g+d*_-x*v-C*y}var Wr,Gr=t((()=>{nr(),Hn(),Wr=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a}equalToMatrix(e){return this.e===e.e&&this.f===e.f&&this.a===e.a&&this.d===e.d&&this.b===e.b&&this.c===e.c}equalTo(e,t,n,r,i,a){return this.e===i&&this.f===a&&this.a===e&&this.d===r&&this.b===t&&this.c===n}setValue(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){let t=this.a,n=this.b,r=this.c,i=this.d,a=this.e,o=this.f,s=new e,c=t*i-n*r;return s.a=i/c,s.b=-n/c,s.c=-r/c,s.d=t/c,s.e=(r*o-i*a)/c,s.f=-(t*o-n*a)/c,s}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a*t+this.c*n,i=this.b*t+this.d*n,a=this.a*-n+this.c*t,o=this.b*-n+this.d*t;return this.a=r,this.b=i,this.c=a,this.d=o,this}rotateByCenter(e,t,n){let r=Math.cos(e),i=Math.sin(e),a=(1-r)*t+i*n,o=(1-r)*n-i*t,s=r*this.a-i*this.b,c=i*this.a+r*this.b,l=r*this.c-i*this.d,u=i*this.c+r*this.d,d=r*this.e-i*this.f+a,f=i*this.e+r*this.f+o;return this.a=s,this.b=c,this.c=l,this.d=u,this.e=d,this.f=f,this}scale(e,t){return this.a*=e,this.b*=e,this.c*=t,this.d*=t,this}setScale(e,t){return this.b=this.b/this.a*e,this.c=this.c/this.d*t,this.a=e,this.d=t,this}transform(e,t,n,r,i,a){return this.multiply(e,t,n,r,i,a),this}translate(e,t){return this.e+=this.a*e+this.c*t,this.f+=this.b*e+this.d*t,this}transpose(){let{a:e,b:t,c:n,d:r,e:i,f:a}=this;return this.a=t,this.b=e,this.c=r,this.d=n,this.e=a,this.f=i,this}multiply(e,t,n,r,i,a){let o=this.a,s=this.b,c=this.c,l=this.d,u=o*e+c*t,d=s*e+l*t,f=o*n+c*r,p=s*n+l*r,m=o*i+c*a+this.e,h=s*i+l*a+this.f;return this.a=u,this.b=d,this.c=f,this.d=p,this.e=m,this.f=h,this}interpolate(t,n){let r=new e;return r.a=this.a+(t.a-this.a)*n,r.b=this.b+(t.b-this.b)*n,r.c=this.c+(t.c-this.c)*n,r.d=this.d+(t.d-this.d)*n,r.e=this.e+(t.e-this.e)*n,r.f=this.f+(t.f-this.f)*n,r}transformPoint(e,t){let{a:n,b:r,c:i,d:a,e:o,f:s}=this,c=n*a-r*i,l=a/c,u=-r/c,d=-i/c,f=n/c,p=(i*s-a*o)/c,m=-(n*s-r*o)/c,{x:h,y:g}=e;t.x=h*l+g*d+p,t.y=h*u+g*f+m}onlyTranslate(e=1){return this.a===e&&this.b===0&&this.c===0&&this.d===e}clone(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){let e=this.a,t=this.b,n=this.c,r=this.d,i=e*r-t*n,a={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!==0||t!==0){let o=Math.sqrt(e*e+t*t);a.rotateDeg=t>0?Math.acos(e/o):-Math.acos(e/o),a.scaleX=o,a.scaleY=i/o,a.skewX=(e*n+t*r)/i,a.skewY=0}else if(n!==0||r!==0){let o=Math.sqrt(n*n+r*r);a.rotateDeg=Math.PI/2-(r>0?Math.acos(-n/o):-Math.acos(n/o)),a.scaleX=i/o,a.scaleY=o,a.skewX=0,a.skewY=(e*n+t*r)/i}return a.rotateDeg=Jn(a.rotateDeg),a}}})),Kr=t((()=>{Sn(),Gn(),Hr(),Gr()})),qr,Jr=t((()=>{qr=class{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(e,t){let{CLEAN_THRESHOLD:n=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:i=this.R_COUNT}=t;if(e.size<n)return 0;let a=0,o=t=>{a++,e.delete(t)},s=Date.now();return e.forEach(((e,t)=>{if(e.timestamp.length<i)return o(t);let n=0;for(;s-e.timestamp[e.timestamp.length-1-n]<r&&(n++,!(n>=i)););if(n<i)return o(t);for(;s-e.timestamp[0]>r;)e.timestamp.shift()})),a}addLimitedTimestamp(e,t,n){let{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=n;e.timestamp.length>r&&e.timestamp.shift(),e.timestamp.push(t)}clearTimeStamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();e.forEach((e=>{for(;r-e.timestamp[0]>n;)e.timestamp.shift()}))}clearItemTimestamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();for(;r-e.timestamp[0]>n;)e.timestamp.shift()}}}));function Yr(e,t,n){t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<60?(o=r,s=i,c=0):60<=e&&e<120?(o=i,s=r,c=0):120<=e&&e<180?(o=0,s=r,c=i):180<=e&&e<240?(o=0,s=i,c=r):240<=e&&e<300?(o=i,s=0,c=r):300<=e&&e<360&&(o=r,s=0,c=i),o=Math.round(255*(o+a)),s=Math.round(255*(s+a)),c=Math.round(255*(c+a)),{r:o,g:s,b:c}}var Xr=t((()=>{}));function Zr(e,t,n){e/=255,t/=255,n/=255;let r=Math.min(e,t,n),i=Math.max(e,t,n),a=i-r,o=0,s=0,c=0;return o=a===0?0:i===e?(t-n)/a%6:i===t?(n-e)/a+2:(e-t)/a+4,o=Math.round(60*o),o<0&&(o+=360),c=(i+r)/2,s=a===0?0:a/(1-Math.abs(2*c-1)),s=+(100*s).toFixed(1),c=+(100*c).toFixed(1),{h:o,s,l:c}}var Qr=t((()=>{}));function $r(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?`0`:``)+e.toString(16)}function ei(e){return L(e)?new li(e>>16,e>>8&255,255&e,1):I(e)?new li(e[0],e[1],e[2]):new li(255,255,255)}function ti(e){return L(e)?new li(e>>>24,e>>>16&255,e>>>8&255,255&e):I(e)?new li(e[0],e[1],e[2],e[3]):new li(255,255,255,1)}function ni(e){return e<.04045?.0773993808*e:(.9478672986*e+.0521327014)**2.4}function ri(e){return e<.0031308?12.92*e:1.055*e**.41666-.055}var ii,ai,oi,si,ci,li,ui=t((()=>{xn(),Xr(),Qr(),ii=/^#([0-9a-f]{3,8})$/,ai={transparent:4294967040},oi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},si=(e,t)=>{let n=ii.exec(e);if(t||n){let e=parseInt(n[1],16),t=n[1].length;return t===3?new li((e>>8&15)+((e>>8&15)<<4),(e>>4&15)+((e>>4&15)<<4),(15&e)+((15&e)<<4),1):t===6?ei(e):t===8?new li(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):null}},ci=class e{static Brighter(t,n=1){return n===1?t:new e(t).brighter(n).toRGBA()}static SetOpacity(t,n=1){return n===1?t:new e(t).setOpacity(n).toRGBA()}static getColorBrightness(t,n=`hsl`){let r=t instanceof e?t:new e(t);switch(n){case`hsv`:default:return r.getHSVBrightness();case`hsl`:return r.getHSLBrightness();case`lum`:return r.getLuminance();case`lum2`:return r.getLuminance2();case`lum3`:return r.getLuminance3();case`wcag`:return r.getLuminanceWCAG()}}static parseColorString(e){if(P(ai[e]))return ti(ai[e]);if(P(oi[e]))return ei(oi[e]);let t=`${e}`.trim().toLowerCase(),n=si(t);if(n!==void 0)return n;if(/^(rgb|RGB|rgba|RGBA)/.test(t)){let e=t.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,``).split(`,`);return new li(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(t)){let e=t.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,``).split(`,`),n=Yr(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10));return new li(n.r,n.g,n.b,parseFloat(e[3]))}}constructor(t){let n=e.parseColorString(t);n?this.color=n:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new li(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e))),this}add(e){let{r:t,g:n,b:r}=this.color;return this.color.r+=Math.min(255,t+e.color.r),this.color.g+=Math.min(255,n+e.color.g),this.color.b+=Math.min(255,r+e.color.b),this}sub(e){return this.color.r=Math.max(0,this.color.r-e.color.r),this.color.g=Math.max(0,this.color.g-e.color.g),this.color.b=Math.max(0,this.color.b-e.color.b),this}multiply(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(e,t,n){let r=this.color.opacity,i=Zr(this.color.r,this.color.g,this.color.b),a=Yr(N(e)?i.h:qt(e,0,360),N(t)?i.s:t>=0&&t<=1?100*t:t,N(n)?i.l:n<=1&&n>=0?100*n:n);return this.color=new li(a.r,a.g,a.b,r),this}setRGB(e,t,n){return!N(e)&&(this.color.r=e),!N(t)&&(this.color.g=t),!N(n)&&(this.color.b=n),this}setHex(e){let t=`${e}`.trim().toLowerCase();return si(t,!0)??this}setColorName(e){let t=oi[e.toLowerCase()];return t===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(t),this}setScalar(e){return this.color.r=e,this.color.g=e,this.color.b=e,this}setOpacity(e=1){return this.color.opacity=e,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){let e=this.color.r/255,t=this.color.g/255,n=this.color.b/255,r,i,a;return r=e<=.03928?e/12.92:((e+.055)/1.055)**2.4,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,.2126*r+.7152*i+.0722*a}clone(){return new e(this.color.toString())}copyGammaToLinear(e,t=2){return this.color.r=e.color.r**+t,this.color.g=e.color.g**+t,this.color.b=e.color.b**+t,this}copyLinearToGamma(e,t=2){let n=t>0?1/t:1;return this.color.r=e.color.r**+n,this.color.g=e.color.g**+n,this.color.b=e.color.b**+n,this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.color.r=ni(e.color.r),this.color.g=ni(e.color.g),this.color.b=ni(e.color.b),this}copyLinearToSRGB(e){return this.color.r=ri(e.color.r),this.color.g=ri(e.color.g),this.color.b=ri(e.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}},li=class{constructor(e,t,n,r){this.r=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.g=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.b=isNaN(+n)?255:Math.max(0,Math.min(255,+n)),this.opacity=P(r)?isNaN(+r)?1:Math.max(0,Math.min(1,+r)):1}formatHex(){return`#${$r(this.r)+$r(this.g)+$r(this.b)+(this.opacity===1?``:$r(255*this.opacity))}`}formatRgb(){let e=this.opacity;return`${e===1?`rgb(`:`rgba(`}${this.r},${this.g},${this.b}${e===1?`)`:`,${e})`}`}formatHsl(){let e=this.opacity,{h:t,s:n,l:r}=Zr(this.r,this.g,this.b);return`${e===1?`hsl(`:`hsla(`}${t},${n}%,${r}%${e===1?`)`:`,${e})`}`}toString(){return this.formatHex()}}}));function di(e){let t=``,n=``,r=``,i=+(e[0]===`#`);for(let a=i;a<e.length;a++)e[a]!==`#`&&(a<i+2?t+=e[a]:a<i+4?n+=e[a]:a<i+6&&(r+=e[a]));return[parseInt(t,16),parseInt(n,16),parseInt(r,16)]}var fi=t((()=>{}));function pi(e,t,n){return Number((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}var mi=t((()=>{}));function hi(e,t){let n=e.r,r=t.r,i=e.g,a=t.g,o=e.b,s=t.b,c=e.opacity,l=t.opacity;return e=>{let t=Math.round(n*(1-e)+r*e),u=Math.round(i*(1-e)+a*e),d=Math.round(o*(1-e)+s*e);return new li(t,u,d,c*(1-e)+l*e)}}var gi=t((()=>{ui()})),_i=r({Color:()=>ci,DEFAULT_COLORS:()=>oi,RGB:()=>li,hexToRgb:()=>di,hslToRgb:()=>Yr,interpolateRgb:()=>hi,rgbToHex:()=>pi,rgbToHsl:()=>Zr}),vi=t((()=>{ui(),fi(),Xr(),mi(),Qr(),gi()})),yi=t((()=>{}));function bi(e){if(R(e))return[e,e,e,e];if(I(e)){let t=e.length;if(t===1){let t=e[0];return[t,t,t,t]}if(t===2){let[t,n]=e;return[t,n,t,n]}if(t===3){let[t,n,r]=e;return[t,n,r,n]}if(t===4)return e}if(F(e)){let{top:t=0,right:n=0,bottom:r=0,left:i=0}=e;return[t,n,r,i]}return[0,0,0,0]}var xi=t((()=>{Le(),je(),Se()})),Si=t((()=>{})),Ci=t((()=>{})),wi=t((()=>{Si(),Ci()}));function Ti(e,t=0,n=0){if(!e)return{width:t,height:n};let r;try{r=window==null?void 0:window.getComputedStyle}catch{r=()=>({})}let i=r(e);if(/^(\d*\.?\d+)(px)$/.exec(i.width)){let r=parseFloat(i.width)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)||e.clientWidth-1,a=parseFloat(i.height)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)||e.clientHeight-1;return{width:r<=0?t:r,height:a<=0?n:a}}return{width:t,height:n}}function Ei(e){let{x:t,y:n}=e.getBoundingClientRect();return{x:t,y:n}}var Di,Oi,ki=t((()=>{Di=(e=``)=>{let t={};return e.split(`;`).forEach((e=>{if(e){let n=e.split(`:`);if(n.length===2){let e=n[0].trim(),r=n[1].trim();e&&r&&(t[e]=r)}}})),t},Oi=e=>e.replace(/([A-Z])/g,`-$1`).toLowerCase()})),Ai=t((()=>{})),ji=t((()=>{})),Mi=t((()=>{})),Ni=t((()=>{})),Pi=t((()=>{Ai(),ji(),Ni(),Mi()})),Fi,Ii=t((()=>{Fi=class e{static getInstance(){return e.instance||=new e,e.instance}constructor(){this.locale_shortWeekdays=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],this.locale_periods=[`AM`,`PM`],this.locale_weekdays=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],this.locale_shortMonths=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],this.numberRe=/^\s*\d+/,this.pads={"-":``,_:` `,0:`0`},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],this.formatShortWeekday=e=>this.locale_shortWeekdays[e.getDay()],this.formatWeekday=e=>this.locale_weekdays[e.getDay()],this.formatShortMonth=e=>this.locale_shortMonths[e.getMonth()],this.formatMonth=e=>this.locale_months[e.getMonth()],this.formatDayOfMonth=(e,t)=>this.pad(e.getDate(),t,2),this.formatHour24=(e,t)=>this.pad(e.getHours(),t,2),this.formatHour12=(e,t)=>this.pad(e.getHours()%12||12,t,2),this.formatMilliseconds=(e,t)=>this.pad(e.getMilliseconds(),t,3),this.formatMonthNumber=(e,t)=>this.pad(e.getMonth()+1,t,2),this.formatMinutes=(e,t)=>this.pad(e.getMinutes(),t,2),this.formatPeriod=e=>this.locale_periods[+(e.getHours()>=12)],this.formatSeconds=(e,t)=>this.pad(e.getSeconds(),t,2),this.formatFullYear=(e,t)=>this.pad(e.getFullYear()%1e4,t,4),this.formatUTCShortWeekday=e=>this.locale_shortWeekdays[e.getUTCDay()],this.formatUTCWeekday=e=>this.locale_weekdays[e.getUTCDay()],this.formatUTCShortMonth=e=>this.locale_shortMonths[e.getUTCMonth()],this.formatUTCMonth=e=>this.locale_months[e.getUTCMonth()],this.formatUTCDayOfMonth=(e,t)=>this.pad(e.getUTCDate(),t,2),this.formatUTCHour24=(e,t)=>this.pad(e.getUTCHours(),t,2),this.formatUTCHour12=(e,t)=>this.pad(e.getUTCHours()%12||12,t,2),this.formatUTCMilliseconds=(e,t)=>this.pad(e.getUTCMilliseconds(),t,3),this.formatUTCMonthNumber=(e,t)=>this.pad(e.getUTCMonth()+1,t,2),this.formatUTCMinutes=(e,t)=>this.pad(e.getUTCMinutes(),t,2),this.formatUTCPeriod=e=>this.locale_periods[+(e.getUTCHours()>=12)],this.formatUTCSeconds=(e,t)=>this.pad(e.getUTCSeconds(),t,2),this.formatUTCFullYear=(e,t)=>this.pad(e.getUTCFullYear()%1e4,t,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(e,t,n)=>{let r=this.shortWeekdayRe.exec(t.slice(n));return r?(e.w=this.shortWeekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseWeekday=(e,t,n)=>{let r=this.weekdayRe.exec(t.slice(n));return r?(e.w=this.weekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseShortMonth=(e,t,n)=>{let r=this.shortMonthRe.exec(t.slice(n));return r?(e.m=this.shortMonthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseMonth=(e,t,n)=>{let r=this.monthRe.exec(t.slice(n));return r?(e.m=this.monthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseDayOfMonth=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1},this.parseHour24=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1},this.parseMilliseconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1},this.parseMonthNumber=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.m=r-1,n+r[0].length):-1},this.parseMinutes=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1},this.parsePeriod=(e,t,n)=>{let r=this.periodRe.exec(t.slice(n));return r?(e.p=this.periodLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseSeconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1},this.parseFullYear=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(e,t)=>this.newFormat(e,this.formats)(new Date(this.getFullTimeStamp(t))),this.timeUTCFormat=(e,t)=>this.newFormat(e,this.utcFormats)(new Date(this.getFullTimeStamp(t))),this.timeParse=(e,t)=>this.newParse(e,!1)(t+``),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(e){return e.replace(this.requoteRe,`\\$&`)}localDate(e){if(0<=e.y&&e.y<100){let t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}utcDate(e){if(0<=e.y&&e.y<100){let t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}newDate(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}formatRe(e){return RegExp(`^(?:`+e.map(this.requoteF).join(`|`)+`)`,`i`)}formatLookup(e){return new Map(e.map(((e,t)=>[e.toLowerCase(),t])))}pad(e,t,n){let r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}parseSpecifier(e,t,n,r){let i=0,a=t.length,o=n.length,s,c;for(;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=this.parses[s in this.pads?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!==n.charCodeAt(r++))return-1}return r}newParse(e,t){let n=this;return function(r){let i=n.newDate(1900,void 0,1);return n.parseSpecifier(i,e,r+=``,0)===r.length?`Q`in i?new Date(i.Q):`s`in i?new Date(1e3*i.s+(`L`in i?i.L:0)):(t&&!(`Z`in i)&&(i.Z=0),`p`in i&&(i.H=i.H%12+12*i.p),i.m===void 0&&(i.m=`q`in i?i.q:0),`Z`in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,n.utcDate(i)):n.localDate(i)):null}}newFormat(e,t){let n=this;return function(r){let i=[],a=-1,o=0,s=e.length,c,l,u;for(r instanceof Date||(r=new Date(+r));++a<s;)e.charCodeAt(a)===37&&(i.push(e.slice(o,a)),(l=n.pads[c=e.charAt(++a)])?c=e.charAt(++a):l=c===`e`?` `:`0`,u=t[c],c=u(r,l),i.push(c),o=a+1);return i.push(e.slice(o,a)),i.join(``)}}getFullTimeStamp(e){let t=parseInt(e+``,10);return String(t).length===10?1e3*t:t}}})),Li=t((()=>{})),Ri=t((()=>{})),zi=t((()=>{Ri(),Li()})),Bi=t((()=>{})),Vi=t((()=>{})),Hi=t((()=>{})),Ui=t((()=>{Bi(),Vi(),Hi()})),Wi,H=t((()=>{Wi=n(me()),xn(),Kr(),Jr(),Hn(),nr(),vi(),Lr(),yi(),Ft(),xi(),wi(),ki(),Pi(),vi(),Ii(),zi(),Ui()})),Gi=(e,t)=>{let{callback:n}=t;return n&&(e=e.filter(n)),e};H();var Ki=function(e,...t){return Yi(et(e),...t)};function qi(e,t,n){let r=t[n];if(r===void 0)e[n]=null;else if(F(r)){F(e[n])||(e[n]={});for(let t in r)qi(e[n],r,t)}else e[n]=r}function Ji(e,t){if(F(t)&&e!==t)for(let n in t)qi(e,t,n)}function Yi(e,...t){e||={};let n=-1,r=t.length;for(;++n<r;)Ji(e,t[n]);return e}var Xi;(function(e){e.DSV=`dsv`,e.TREE=`tree`,e.GEO=`geo`,e.BYTE=`bytejson`,e.HEX=`hex`,e.GRAPH=`graph`,e.TABLE=`table`,e.GEO_GRATICULE=`geo-graticule`})(Xi||={});var Zi=(e,t)=>{let{fields:n,key:r,value:i,retains:a}=t,o=[];for(let t=0;t<e.length;t++)n.forEach((s=>{let c={};if(c[r]=s,c[i]=e[t][s],a)a.forEach((n=>{c[n]=e[t][n]}));else for(let r in e[t])n.indexOf(r)===-1&&(c[r]=e[t][r]);o.push(c)}));return o};H();var Qi=(e,t)=>{if(!t?.fields||e.length===0)return e;let n=t.fields,r=e[0],i={},a=[];for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t)){let o=n[t];if(o.sort&&(R(o.sortIndex)||(o.sortIndex=0),P(o.sortReverse)||(o.sortReverse=o.sort===`desc`)),!o.type){let n=r;t in r||(n=e.find((e=>t in e))??r),o.type=typeof n[t]==`number`?`linear`:`ordinal`}let s;if(typeof o.sortIndex==`number`&&(s={key:t,type:o.type,index:o.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===o.sortReverse},a.push(s)),o.domain?.length>0){if(o.type===`ordinal`){o._domainCache={},i[t]=o;let e={};o.domain.forEach(((t,n)=>{e[t]=n,o._domainCache[t]=n})),s&&(s.sortIndex=e,s.sortIndexCount=o.domain.length)}else o.domain.length>=2&&(i[t]=o)}}return Object.keys(i).length>0&&(e=e.filter((e=>{for(let t in i){let n=i[t];if(n.type===`ordinal`){if(!(e[t]in n._domainCache))return!1}else if(n.domain[0]>e[t]||n.domain[1]<e[t])return!1}return!0}))),a.sort(((e,t)=>e.index-t.index)),e.sort(((e,t)=>$i(e,t,a))),e};function $i(e,t,n){for(let r=0;r<n.length;r++){let i=n[r],a=0;if(i.type===`ordinal`?(i.sortIndex[t[i.key]]===void 0&&(i.sortIndex[t[i.key]]=i.sortIndexCount++),i.sortIndex[e[i.key]]===void 0&&(i.sortIndex[e[i.key]]=i.sortIndexCount++),a=i.sortIndex[e[i.key]]-i.sortIndex[t[i.key]]):i.type===`linear`&&(a=e[i.key]-t[i.key]),i.sortReverse&&(a=-a),a!==0)return a}return 0}var ea={},ta={},na=34,ra=10,ia=13;function aa(e){return Function(`d`,`return {`+e.map(function(e,t){return JSON.stringify(e)+`: d[`+t+`] || ""`}).join(`,`)+`}`)}function oa(e,t){var n=aa(e);return function(r,i){return t(n(r),i,e)}}function sa(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}function ca(e,t){var n=e+``,r=n.length;return r<t?Array(t-r+1).join(0)+n:n}function la(e){return e<0?`-`+ca(-e,6):e>9999?`+`+ca(e,6):ca(e,4)}function ua(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?`Invalid Date`:la(e.getUTCFullYear(),4)+`-`+ca(e.getUTCMonth()+1,2)+`-`+ca(e.getUTCDate(),2)+(i?`T`+ca(t,2)+`:`+ca(n,2)+`:`+ca(r,2)+`.`+ca(i,3)+`Z`:r?`T`+ca(t,2)+`:`+ca(n,2)+`:`+ca(r,2)+`Z`:n||t?`T`+ca(t,2)+`:`+ca(n,2)+`Z`:``)}function da(e){var t=RegExp(`["`+e+`
|
|
2
2
|
\r]`),n=e.charCodeAt(0);function r(e,t){var n,r,a=i(e,function(e,i){if(n)return n(e,i-1);r=e,n=t?oa(e,t):aa(e)});return a.columns=r||[],a}function i(e,t){var r=[],i=e.length,a=0,o=0,s,c=i<=0,l=!1;e.charCodeAt(i-1)===ra&&--i,e.charCodeAt(i-1)===ia&&--i;function u(){if(c)return ta;if(l)return l=!1,ea;var t,r=a,o;if(e.charCodeAt(r)===na){for(;a++<i&&e.charCodeAt(a)!==na||e.charCodeAt(++a)===na;);return(t=a)>=i?c=!0:(o=e.charCodeAt(a++))===ra?l=!0:o===ia&&(l=!0,e.charCodeAt(a)===ra&&++a),e.slice(r+1,t-1).replace(/""/g,`"`)}for(;a<i;){if((o=e.charCodeAt(t=a++))===ra)l=!0;else if(o===ia)l=!0,e.charCodeAt(a)===ra&&++a;else if(o!==n)continue;return e.slice(r,t)}return c=!0,e.slice(r,i)}for(;(s=u())!==ta;){for(var d=[];s!==ea&&s!==ta;)d.push(s),s=u();t&&(d=t(d,o++))==null||r.push(d)}return r}function a(t,n){return t.map(function(t){return n.map(function(e){return u(t[e])}).join(e)})}function o(t,n){return n??=sa(t),[n.map(u).join(e)].concat(a(t,n)).join(`
|
|
3
3
|
`)}function s(e,t){return t??=sa(e),a(e,t).join(`
|
|
4
4
|
`)}function c(e){return e.map(l).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{l as n,u as r}from"./chunk-OB3PAWPO-CCBUsQEH.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{i as a,m as o,t as s}from"./log-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{l as n,u as r}from"./chunk-OB3PAWPO-CCBUsQEH.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{i as a,m as o,t as s}from"./log-7fGlFSON.js";import{c,d as l,f as u}from"./pendingActionsStore-idc6m2Ya.js";import{n as d,t as f}from"./WorkflowsSection-B5TkVqRA.js";import{a as p,i as m,m as h,n as g,p as _,r as v}from"./ToolCallMessage-BhxowUjs.js";import{Vt as y}from"./lexicalToReact-DdXqoi0d.js";import{t as b}from"./createScopedStore-DW4wfjbM.js";import{t as x}from"./runDetached-BWsF_7Xo.js";import{l as S}from"./contextWindow-WJUHfP_d.js";import{t as C}from"./settings-header-button-CKZHCdXh.js";var w={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};w.node;var T=u(w),E=e(t(),1),D=b(`WorkflowsPageView`,()=>e=>({selectedRunId:null,selectedRun:null,selectedAgentId:null,setSelectedRunId:t=>e({selectedRunId:t}),setSelectedRun:t=>e({selectedRun:t}),setSelectedAgentId:t=>e({selectedAgentId:t}),clearSelection:()=>e({selectedRunId:null,selectedRun:null,selectedAgentId:null})})),O=[],k=b(`WorkflowAgentTranscript`,()=>e=>({loadState:`loading`,messages:O,error:null,reloadNonce:0,setLoaded:t=>e({loadState:`loaded`,messages:t}),setError:t=>e({loadState:`error`,error:t}),refresh:()=>e(e=>({loadState:`loading`,error:null,reloadNonce:e.reloadNonce+1}))})),A=e(i(),1);function j({runId:e,agentId:t,agentLabel:n,promptPreview:r,agentIsRunning:i=!1,onClose:a,getTranscript:s}){let c=k.useScopedStore(e=>e.loadState),u=k.useScopedStore(e=>e.messages),d=k.useScopedStore(e=>e.error),f=k.useScopedStore(e=>e.reloadNonce),h=k.useScopedStore(e=>e.setLoaded),g=k.useScopedStore(e=>e.setError),v=k.useScopedStore(e=>e.refresh);(0,E.useEffect)(()=>{let n=!1;return s(e,t).then(e=>{n||h(_(e))}).catch(o(e=>{n||g(e.message)})),()=>{n=!0}},[e,t,s,f,h,g]);let b=(0,E.useCallback)(()=>{v()},[v]);return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,"data-testid":`workflow-agent-transcript-panel`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border pb-2.5`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:a,"aria-label":`Back to run`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,A.jsx)(T,{className:`size-4`,"aria-hidden":!0})}),(0,A.jsx)(`span`,{className:`truncate text-sm font-semibold text-foreground`,children:n}),(0,A.jsx)(`span`,{className:`shrink-0 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide text-muted-foreground`,children:`Transcript`}),i?(0,A.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-1.5 animate-pulse rounded-full bg-emerald-500 dark:bg-emerald-400`}),(0,A.jsx)(`span`,{className:`text-emerald-500 dark:text-emerald-400`,children:`Running`})]}):null,(0,A.jsx)(`button`,{type:`button`,onClick:b,"aria-label":`Refresh transcript`,className:`ml-auto inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,A.jsx)(y,{className:c===`loading`?`size-3.5 animate-spin`:`size-3.5`,"aria-hidden":!0})})]}),i?(0,A.jsx)(`p`,{className:`rounded-md border border-amber-500/20 bg-amber-500/5 px-2.5 py-1.5 text-xs text-amber-600 dark:text-amber-400`,children:`This agent is still running — the transcript may be incomplete. Refresh to update.`}):null,r?(0,A.jsxs)(`div`,{className:`rounded-md border border-border/50 bg-muted/40 px-2.5 py-1.5`,children:[(0,A.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground`,children:`Prompt (preview)`}),(0,A.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-xs text-muted-foreground/90`,children:r})]}):null,(0,A.jsx)(m,{value:null,children:(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,children:[c===`loading`?(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,A.jsx)(l,{className:`size-3 animate-spin`,"aria-label":`Loading`}),`Loading transcript…`]}):null,c===`error`?(0,A.jsx)(`div`,{className:`text-xs text-destructive`,children:d}):null,c===`loaded`&&u.length===0?(0,A.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No transcript recorded yet.`}):null,u.map(e=>(0,A.jsx)(p,{message:e,localPath:``},e.id))]})})]})}function M(e){return(0,A.jsx)(k.Provider,{init:void 0,children:(0,A.jsx)(j,{...e})})}function N({runs:e,getRunDetail:t,getAgentTranscript:n,onBackToChat:r}){let i=D.useScopedStore(e=>e.selectedRunId),u=D.useScopedStore(e=>e.selectedRun),p=D.useScopedStore(e=>e.selectedAgentId),m=D.useScopedStore(e=>e.setSelectedRunId),g=D.useScopedStore(e=>e.setSelectedRun),_=D.useScopedStore(e=>e.setSelectedAgentId),v=D.useScopedStore(e=>e.clearSelection),y=(0,E.useRef)(null),b=(0,E.useRef)(0),S=(0,E.useCallback)(n=>{y.current=e,m(n),_(null),g(`loading`);let r=++b.current,i=()=>b.current===r;t(n).then(e=>{i()&&g(e??`not-found`)},o(e=>{s.error(a,`workflows.getRun failed`,e),i()&&g(`failed`)}))},[t,e,m,_,g]),w=(0,E.useCallback)(()=>{v(),y.current=null},[v]);(0,E.useEffect)(()=>{if(i===null||e===y.current)return;let n=e.find(e=>e.runId===i);if(!n||n.status!==`running`)return;let r=!1,a=++b.current;return x(`workflows.getRun refresh`,t(i).then(e=>{r||b.current!==a||e===null||(p===null||e.agents.some(e=>e.agentId===p))&&g(e)})),()=>{r=!0}},[e,i,p,t,g]);let O=u!==`loading`&&u!==`not-found`&&u!==`failed`?u:null,k=p!==null&&O?O.agents.find(e=>e.agentId===p):void 0,j=i!==null,N;return N=u===`loading`?(0,A.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,A.jsx)(l,{className:`size-4 animate-spin`,"aria-label":`Loading`}),`Loading run…`]}):u===`failed`?(0,A.jsx)(F,{text:`Couldn't load this run. Select it again to retry.`}):u===`not-found`?(0,A.jsx)(F,{text:`Run not found or no longer available.`}):k&&O?(0,A.jsx)(M,{runId:O.runId,agentId:k.agentId,agentLabel:k.label,promptPreview:k.promptPreview,agentIsRunning:k.state===`running`||k.state===`progress`,onClose:()=>_(null),getTranscript:n},p??``):O?(0,A.jsx)(f,{run:O,title:O.workflowName??O.runId,onSelectAgent:e=>_(e)}):(0,A.jsx)(F,{text:`Select a run to view its phases and agents.`}),(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-3 md:px-6`,children:[(0,A.jsx)(h,{className:`size-5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,A.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:`Workflows`}),e.length>0?(0,A.jsxs)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground tabular-nums`,style:{fontVariantNumeric:`tabular-nums`},children:[e.length,` `,e.length===1?`run`:`runs`]}):null,r?(0,A.jsx)(C,{"aria-label":`Back to chat`,className:`ml-auto`,icon:(0,A.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),onClick:r,children:`Back to chat`}):null]}),(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,A.jsx)(`div`,{className:c(`w-full shrink-0 overflow-auto p-3 md:w-80 md:border-r md:border-border`,j&&`hidden md:block`),children:(0,A.jsx)(d,{runs:e,selectedRunId:i,onSelectRun:S})}),(0,A.jsxs)(`div`,{className:c(`min-w-0 flex-1 overflow-auto px-4 py-4 md:px-6`,!j&&`hidden md:block`),children:[j?(0,A.jsxs)(`button`,{type:`button`,onClick:w,"aria-label":`Back to runs`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground md:hidden`,children:[(0,A.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),`All runs`]}):null,N]})]})]})}function P(e){return(0,A.jsx)(D.Provider,{init:void 0,children:(0,A.jsx)(N,{...e})})}function F({text:e}){return(0,A.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-lg border border-dashed border-border px-8 py-10 text-center`,children:[(0,A.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-full bg-muted text-muted-foreground`,children:(0,A.jsx)(h,{className:`size-5`,"aria-hidden":!0})}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e})]})})}function I({chatId:e}){let t=r(),i=n(),a=v(S(g(e??``))),o=(0,E.useCallback)(async n=>e?t.socket.command({type:`workflows.getRun`,chatId:e,runId:n}):null,[e,t.socket]),s=(0,E.useCallback)(async(n,r)=>e?t.socket.command({type:`workflows.getAgentTranscript`,chatId:e,runId:n,agentId:r}):[],[e,t.socket]),c=(0,E.useCallback)(()=>{e&&i(`/chat/${e}`)},[e,i]);return e?(0,A.jsx)(P,{runs:a,getRunDetail:o,getAgentTranscript:s,onBackToChat:c}):(0,A.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Open a chat to view its workflows.`})}export{I as WorkflowsPage};
|